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    #[serde(deserialize_with = "crate::types::integer::option")]
114    pub sim_pin: Option<i32>,
115    /// Preferred network, written as MCC and MNC concatenated. See note.
116    #[serde(rename = "preferredNetwork")]
117    #[serde(default, skip_serializing_if = "Option::is_none")]
118    pub preferred_network: Option<String>,
119    /// Default: false. Use only the preferred Network, do
120    /// not dial in when not available. See Note.
121    /// Schema default: `false`.
122    #[serde(rename = "useOnlyPreferredNetwork")]
123    #[serde(default, skip_serializing_if = "Option::is_none")]
124    pub use_only_preferred_network: Option<bool>,
125    /// The `customData` member.
126    #[serde(rename = "customData")]
127    #[serde(default, skip_serializing_if = "Option::is_none")]
128    pub custom_data: Option<crate::types::CustomData>,
129}
130
131impl APN {
132    /// Creates a `APN` from its required fields.
133    #[must_use]
134    pub fn new(apn: impl Into<String>, apn_authentication: APNAuthentication) -> Self {
135        Self {
136            apn: apn.into(),
137            apn_authentication,
138            apn_user_name: None,
139            apn_password: None,
140            sim_pin: None,
141            preferred_network: None,
142            use_only_preferred_network: None,
143            custom_data: None,
144        }
145    }
146
147    /// Sets the optional `apnUserName` field.
148    #[must_use]
149    pub fn with_apn_user_name(mut self, value: impl Into<String>) -> Self {
150        self.apn_user_name = Some(value.into());
151        self
152    }
153
154    /// Sets the optional `apnPassword` field.
155    #[must_use]
156    pub fn with_apn_password(mut self, value: impl Into<String>) -> Self {
157        self.apn_password = Some(value.into());
158        self
159    }
160
161    /// Sets the optional `simPin` field.
162    #[must_use]
163    pub fn with_sim_pin(mut self, value: i32) -> Self {
164        self.sim_pin = Some(value);
165        self
166    }
167
168    /// Sets the optional `preferredNetwork` field.
169    #[must_use]
170    pub fn with_preferred_network(mut self, value: impl Into<String>) -> Self {
171        self.preferred_network = Some(value.into());
172        self
173    }
174
175    /// Sets the optional `useOnlyPreferredNetwork` field.
176    #[must_use]
177    pub fn with_use_only_preferred_network(mut self, value: bool) -> Self {
178        self.use_only_preferred_network = Some(value);
179        self
180    }
181
182    /// Sets the optional `customData` field.
183    #[must_use]
184    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
185        self.custom_data = Some(value);
186        self
187    }
188}
189
190impl Validate for APN {
191    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
192        path.push_key("apn");
193        validate::string(self.apn.as_str(), None, Some(2000), path, out);
194        path.pop();
195        path.push_key("apnAuthentication");
196        Validate::validate_at(&self.apn_authentication, path, out);
197        path.pop();
198        path.push_key("apnUserName");
199        if let Some(value) = &self.apn_user_name {
200            validate::string(value.as_str(), None, Some(50), path, out);
201        }
202        path.pop();
203        path.push_key("apnPassword");
204        if let Some(value) = &self.apn_password {
205            validate::string(value.as_str(), None, Some(64), path, out);
206        }
207        path.pop();
208        path.push_key("preferredNetwork");
209        if let Some(value) = &self.preferred_network {
210            validate::string(value.as_str(), None, Some(6), path, out);
211        }
212        path.pop();
213        path.push_key("customData");
214        if let Some(value) = &self.custom_data {
215            Validate::validate_at(value, path, out);
216        }
217        path.pop();
218    }
219}
220
221/// 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.
222///
223/// image::images/AbsolutePriceSchedule-Simple.png\[\]
224///
225/// The OCPP 2.1 `AbsolutePriceSchedule` data type.
226#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
227pub struct AbsolutePriceSchedule {
228    /// Starting point of price schedule.
229    #[serde(rename = "timeAnchor")]
230    pub time_anchor: crate::types::DateTime,
231    /// Unique ID of price schedule
232    #[serde(rename = "priceScheduleID")]
233    #[serde(deserialize_with = "crate::types::integer::one")]
234    pub price_schedule_id: i32,
235    /// Currency according to ISO 4217.
236    pub currency: String,
237    /// String that indicates what language is used for the human readable strings in the price schedule. Based on ISO 639.
238    pub language: String,
239    /// 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.
240    #[serde(rename = "priceAlgorithm")]
241    pub price_algorithm: String,
242    /// The `priceRuleStacks` member.
243    #[serde(rename = "priceRuleStacks")]
244    pub price_rule_stacks: Vec<PriceRuleStack>,
245    /// Description of the price schedule.
246    #[serde(rename = "priceScheduleDescription")]
247    #[serde(default, skip_serializing_if = "Option::is_none")]
248    pub price_schedule_description: Option<String>,
249    /// The `minimumCost` member.
250    #[serde(rename = "minimumCost")]
251    #[serde(default, skip_serializing_if = "Option::is_none")]
252    pub minimum_cost: Option<RationalNumber>,
253    /// The `maximumCost` member.
254    #[serde(rename = "maximumCost")]
255    #[serde(default, skip_serializing_if = "Option::is_none")]
256    pub maximum_cost: Option<RationalNumber>,
257    /// The `taxRules` member.
258    #[serde(rename = "taxRules")]
259    #[serde(default, skip_serializing_if = "Option::is_none")]
260    pub tax_rules: Option<Vec<TaxRule>>,
261    /// The `overstayRuleList` member.
262    #[serde(rename = "overstayRuleList")]
263    #[serde(default, skip_serializing_if = "Option::is_none")]
264    pub overstay_rule_list: Option<OverstayRuleList>,
265    /// The `additionalSelectedServices` member.
266    #[serde(rename = "additionalSelectedServices")]
267    #[serde(default, skip_serializing_if = "Option::is_none")]
268    pub additional_selected_services: Option<Vec<AdditionalSelectedServices>>,
269    /// The `customData` member.
270    #[serde(rename = "customData")]
271    #[serde(default, skip_serializing_if = "Option::is_none")]
272    pub custom_data: Option<crate::types::CustomData>,
273}
274
275impl AbsolutePriceSchedule {
276    /// Creates a `AbsolutePriceSchedule` from its required fields.
277    #[must_use]
278    pub fn new(
279        time_anchor: impl Into<crate::types::DateTime>,
280        price_schedule_id: i32,
281        currency: impl Into<String>,
282        language: impl Into<String>,
283        price_algorithm: impl Into<String>,
284        price_rule_stacks: Vec<PriceRuleStack>,
285    ) -> Self {
286        Self {
287            time_anchor: time_anchor.into(),
288            price_schedule_id,
289            currency: currency.into(),
290            language: language.into(),
291            price_algorithm: price_algorithm.into(),
292            price_rule_stacks,
293            price_schedule_description: None,
294            minimum_cost: None,
295            maximum_cost: None,
296            tax_rules: None,
297            overstay_rule_list: None,
298            additional_selected_services: None,
299            custom_data: None,
300        }
301    }
302
303    /// Sets the optional `priceScheduleDescription` field.
304    #[must_use]
305    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
306        self.price_schedule_description = Some(value.into());
307        self
308    }
309
310    /// Sets the optional `minimumCost` field.
311    #[must_use]
312    pub fn with_minimum_cost(mut self, value: RationalNumber) -> Self {
313        self.minimum_cost = Some(value);
314        self
315    }
316
317    /// Sets the optional `maximumCost` field.
318    #[must_use]
319    pub fn with_maximum_cost(mut self, value: RationalNumber) -> Self {
320        self.maximum_cost = Some(value);
321        self
322    }
323
324    /// Sets the optional `taxRules` field.
325    #[must_use]
326    pub fn with_tax_rules(mut self, value: Vec<TaxRule>) -> Self {
327        self.tax_rules = Some(value);
328        self
329    }
330
331    /// Sets the optional `overstayRuleList` field.
332    #[must_use]
333    pub fn with_overstay_rule_list(mut self, value: OverstayRuleList) -> Self {
334        self.overstay_rule_list = Some(value);
335        self
336    }
337
338    /// Sets the optional `additionalSelectedServices` field.
339    #[must_use]
340    pub fn with_additional_selected_services(
341        mut self,
342        value: Vec<AdditionalSelectedServices>,
343    ) -> Self {
344        self.additional_selected_services = Some(value);
345        self
346    }
347
348    /// Sets the optional `customData` field.
349    #[must_use]
350    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
351        self.custom_data = Some(value);
352        self
353    }
354}
355
356impl Validate for AbsolutePriceSchedule {
357    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
358        path.push_key("priceScheduleID");
359        validate::int_range(i64::from(self.price_schedule_id), Some(0), None, path, out);
360        path.pop();
361        path.push_key("currency");
362        validate::string(self.currency.as_str(), None, Some(3), path, out);
363        path.pop();
364        path.push_key("language");
365        validate::string(self.language.as_str(), None, Some(8), path, out);
366        path.pop();
367        path.push_key("priceAlgorithm");
368        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
369        path.pop();
370        path.push_key("priceRuleStacks");
371        validate::list_len(self.price_rule_stacks.len(), Some(1), Some(1024), path, out);
372        for (index, item) in self.price_rule_stacks.iter().enumerate() {
373            path.push_index(index);
374            Validate::validate_at(item, path, out);
375            path.pop();
376        }
377        path.pop();
378        path.push_key("priceScheduleDescription");
379        if let Some(value) = &self.price_schedule_description {
380            validate::string(value.as_str(), None, Some(160), path, out);
381        }
382        path.pop();
383        path.push_key("minimumCost");
384        if let Some(value) = &self.minimum_cost {
385            Validate::validate_at(value, path, out);
386        }
387        path.pop();
388        path.push_key("maximumCost");
389        if let Some(value) = &self.maximum_cost {
390            Validate::validate_at(value, path, out);
391        }
392        path.pop();
393        path.push_key("taxRules");
394        if let Some(value) = &self.tax_rules {
395            validate::list_len(value.len(), Some(1), Some(10), path, out);
396            for (index, item) in value.iter().enumerate() {
397                path.push_index(index);
398                Validate::validate_at(item, path, out);
399                path.pop();
400            }
401        }
402        path.pop();
403        path.push_key("overstayRuleList");
404        if let Some(value) = &self.overstay_rule_list {
405            Validate::validate_at(value, path, out);
406        }
407        path.pop();
408        path.push_key("additionalSelectedServices");
409        if let Some(value) = &self.additional_selected_services {
410            validate::list_len(value.len(), Some(1), Some(5), path, out);
411            for (index, item) in value.iter().enumerate() {
412                path.push_index(index);
413                Validate::validate_at(item, path, out);
414                path.pop();
415            }
416        }
417        path.pop();
418        path.push_key("customData");
419        if let Some(value) = &self.custom_data {
420            Validate::validate_at(value, path, out);
421        }
422        path.pop();
423    }
424}
425
426/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
427///
428/// The OCPP 2.1 `AdditionalInfo` data type.
429#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
430pub struct AdditionalInfo {
431    /// *(2.1)* This field specifies the additional IdToken.
432    #[serde(rename = "additionalIdToken")]
433    pub additional_id_token: String,
434    /// _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_.
435    pub r#type: String,
436    /// The `customData` member.
437    #[serde(rename = "customData")]
438    #[serde(default, skip_serializing_if = "Option::is_none")]
439    pub custom_data: Option<crate::types::CustomData>,
440}
441
442impl AdditionalInfo {
443    /// Creates a `AdditionalInfo` from its required fields.
444    #[must_use]
445    pub fn new(additional_id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
446        Self {
447            additional_id_token: additional_id_token.into(),
448            r#type: r#type.into(),
449            custom_data: None,
450        }
451    }
452
453    /// Sets the optional `customData` field.
454    #[must_use]
455    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
456        self.custom_data = Some(value);
457        self
458    }
459}
460
461impl Validate for AdditionalInfo {
462    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
463        path.push_key("additionalIdToken");
464        validate::string(
465            self.additional_id_token.as_str(),
466            None,
467            Some(255),
468            path,
469            out,
470        );
471        path.pop();
472        path.push_key("type");
473        validate::string(self.r#type.as_str(), None, Some(50), path, out);
474        path.pop();
475        path.push_key("customData");
476        if let Some(value) = &self.custom_data {
477            Validate::validate_at(value, path, out);
478        }
479        path.pop();
480    }
481}
482
483/// Part of ISO 15118-20 price schedule.
484///
485/// The OCPP 2.1 `AdditionalSelectedServices` data type.
486#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
487pub struct AdditionalSelectedServices {
488    /// The `serviceFee` member.
489    #[serde(rename = "serviceFee")]
490    pub service_fee: RationalNumber,
491    /// Human readable string to identify this service.
492    #[serde(rename = "serviceName")]
493    pub service_name: String,
494    /// The `customData` member.
495    #[serde(rename = "customData")]
496    #[serde(default, skip_serializing_if = "Option::is_none")]
497    pub custom_data: Option<crate::types::CustomData>,
498}
499
500impl AdditionalSelectedServices {
501    /// Creates a `AdditionalSelectedServices` from its required fields.
502    #[must_use]
503    pub fn new(service_fee: RationalNumber, service_name: impl Into<String>) -> Self {
504        Self {
505            service_fee,
506            service_name: service_name.into(),
507            custom_data: None,
508        }
509    }
510
511    /// Sets the optional `customData` field.
512    #[must_use]
513    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
514        self.custom_data = Some(value);
515        self
516    }
517}
518
519impl Validate for AdditionalSelectedServices {
520    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
521        path.push_key("serviceFee");
522        Validate::validate_at(&self.service_fee, path, out);
523        path.pop();
524        path.push_key("serviceName");
525        validate::string(self.service_name.as_str(), None, Some(80), path, out);
526        path.pop();
527        path.push_key("customData");
528        if let Some(value) = &self.custom_data {
529            Validate::validate_at(value, path, out);
530        }
531        path.pop();
532    }
533}
534
535/// *(2.1)* A generic address format.
536///
537/// The OCPP 2.1 `Address` data type.
538#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
539pub struct Address {
540    /// Name of person/company
541    pub name: String,
542    /// Address line 1
543    pub address1: String,
544    /// City
545    pub city: String,
546    /// Country name
547    pub country: String,
548    /// Address line 2
549    #[serde(default, skip_serializing_if = "Option::is_none")]
550    pub address2: Option<String>,
551    /// Postal code
552    #[serde(rename = "postalCode")]
553    #[serde(default, skip_serializing_if = "Option::is_none")]
554    pub postal_code: Option<String>,
555    /// The `customData` member.
556    #[serde(rename = "customData")]
557    #[serde(default, skip_serializing_if = "Option::is_none")]
558    pub custom_data: Option<crate::types::CustomData>,
559}
560
561impl Address {
562    /// Creates a `Address` from its required fields.
563    #[must_use]
564    pub fn new(
565        name: impl Into<String>,
566        address1: impl Into<String>,
567        city: impl Into<String>,
568        country: impl Into<String>,
569    ) -> Self {
570        Self {
571            name: name.into(),
572            address1: address1.into(),
573            city: city.into(),
574            country: country.into(),
575            address2: None,
576            postal_code: None,
577            custom_data: None,
578        }
579    }
580
581    /// Sets the optional `address2` field.
582    #[must_use]
583    pub fn with_address2(mut self, value: impl Into<String>) -> Self {
584        self.address2 = Some(value.into());
585        self
586    }
587
588    /// Sets the optional `postalCode` field.
589    #[must_use]
590    pub fn with_postal_code(mut self, value: impl Into<String>) -> Self {
591        self.postal_code = Some(value.into());
592        self
593    }
594
595    /// Sets the optional `customData` field.
596    #[must_use]
597    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
598        self.custom_data = Some(value);
599        self
600    }
601}
602
603impl Validate for Address {
604    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
605        path.push_key("name");
606        validate::string(self.name.as_str(), None, Some(50), path, out);
607        path.pop();
608        path.push_key("address1");
609        validate::string(self.address1.as_str(), None, Some(100), path, out);
610        path.pop();
611        path.push_key("city");
612        validate::string(self.city.as_str(), None, Some(100), path, out);
613        path.pop();
614        path.push_key("country");
615        validate::string(self.country.as_str(), None, Some(50), path, out);
616        path.pop();
617        path.push_key("address2");
618        if let Some(value) = &self.address2 {
619            validate::string(value.as_str(), None, Some(100), path, out);
620        }
621        path.pop();
622        path.push_key("postalCode");
623        if let Some(value) = &self.postal_code {
624            validate::string(value.as_str(), None, Some(20), path, out);
625        }
626        path.pop();
627        path.push_key("customData");
628        if let Some(value) = &self.custom_data {
629            Validate::validate_at(value, path, out);
630        }
631        path.pop();
632    }
633}
634
635/// Contains the identifier to use for authorization.
636///
637/// The OCPP 2.1 `AuthorizationData` data type.
638#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
639pub struct AuthorizationData {
640    /// The `idToken` member.
641    #[serde(rename = "idToken")]
642    pub id_token: IdToken,
643    /// The `idTokenInfo` member.
644    #[serde(rename = "idTokenInfo")]
645    #[serde(default, skip_serializing_if = "Option::is_none")]
646    pub id_token_info: Option<IdTokenInfo>,
647    /// The `customData` member.
648    #[serde(rename = "customData")]
649    #[serde(default, skip_serializing_if = "Option::is_none")]
650    pub custom_data: Option<crate::types::CustomData>,
651}
652
653impl AuthorizationData {
654    /// Creates a `AuthorizationData` from its required fields.
655    #[must_use]
656    pub fn new(id_token: IdToken) -> Self {
657        Self {
658            id_token,
659            id_token_info: None,
660            custom_data: None,
661        }
662    }
663
664    /// Sets the optional `idTokenInfo` field.
665    #[must_use]
666    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
667        self.id_token_info = Some(value);
668        self
669    }
670
671    /// Sets the optional `customData` field.
672    #[must_use]
673    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
674        self.custom_data = Some(value);
675        self
676    }
677}
678
679impl Validate for AuthorizationData {
680    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
681        path.push_key("idToken");
682        Validate::validate_at(&self.id_token, path, out);
683        path.pop();
684        path.push_key("idTokenInfo");
685        if let Some(value) = &self.id_token_info {
686            Validate::validate_at(value, path, out);
687        }
688        path.pop();
689        path.push_key("customData");
690        if let Some(value) = &self.custom_data {
691            Validate::validate_at(value, path, out);
692        }
693        path.pop();
694    }
695}
696
697/// The OCPP 2.1 `BatteryData` data type.
698#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
699pub struct BatteryData {
700    /// Slot number where battery is inserted or removed.
701    #[serde(rename = "evseId")]
702    #[serde(deserialize_with = "crate::types::integer::one")]
703    pub evse_id: i32,
704    /// Serial number of battery.
705    #[serde(rename = "serialNumber")]
706    pub serial_number: String,
707    /// State of charge
708    #[serde(rename = "soC")]
709    pub so_c: crate::types::Decimal,
710    /// State of health
711    #[serde(rename = "soH")]
712    pub so_h: crate::types::Decimal,
713    /// Production date of battery.
714    #[serde(rename = "productionDate")]
715    #[serde(default, skip_serializing_if = "Option::is_none")]
716    pub production_date: Option<crate::types::DateTime>,
717    /// Vendor-specific info from battery in undefined format.
718    #[serde(rename = "vendorInfo")]
719    #[serde(default, skip_serializing_if = "Option::is_none")]
720    pub vendor_info: Option<String>,
721    /// The `customData` member.
722    #[serde(rename = "customData")]
723    #[serde(default, skip_serializing_if = "Option::is_none")]
724    pub custom_data: Option<crate::types::CustomData>,
725}
726
727impl BatteryData {
728    /// Creates a `BatteryData` from its required fields.
729    #[must_use]
730    pub fn new(
731        evse_id: i32,
732        serial_number: impl Into<String>,
733        so_c: impl Into<crate::types::Decimal>,
734        so_h: impl Into<crate::types::Decimal>,
735    ) -> Self {
736        Self {
737            evse_id,
738            serial_number: serial_number.into(),
739            so_c: so_c.into(),
740            so_h: so_h.into(),
741            production_date: None,
742            vendor_info: None,
743            custom_data: None,
744        }
745    }
746
747    /// Sets the optional `productionDate` field.
748    #[must_use]
749    pub fn with_production_date(mut self, value: impl Into<crate::types::DateTime>) -> Self {
750        self.production_date = Some(value.into());
751        self
752    }
753
754    /// Sets the optional `vendorInfo` field.
755    #[must_use]
756    pub fn with_vendor_info(mut self, value: impl Into<String>) -> Self {
757        self.vendor_info = Some(value.into());
758        self
759    }
760
761    /// Sets the optional `customData` field.
762    #[must_use]
763    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
764        self.custom_data = Some(value);
765        self
766    }
767}
768
769impl Validate for BatteryData {
770    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
771        path.push_key("evseId");
772        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
773        path.pop();
774        path.push_key("serialNumber");
775        validate::string(self.serial_number.as_str(), None, Some(50), path, out);
776        path.pop();
777        path.push_key("soC");
778        validate::range(
779            self.so_c,
780            Some(crate::types::Decimal::new(0, 0)),
781            Some(crate::types::Decimal::new(100, 0)),
782            path,
783            out,
784        );
785        path.pop();
786        path.push_key("soH");
787        validate::range(
788            self.so_h,
789            Some(crate::types::Decimal::new(0, 0)),
790            Some(crate::types::Decimal::new(100, 0)),
791            path,
792            out,
793        );
794        path.pop();
795        path.push_key("vendorInfo");
796        if let Some(value) = &self.vendor_info {
797            validate::string(value.as_str(), None, Some(500), path, out);
798        }
799        path.pop();
800        path.push_key("customData");
801        if let Some(value) = &self.custom_data {
802            Validate::validate_at(value, path, out);
803        }
804        path.pop();
805    }
806}
807
808/// The OCPP 2.1 `CertificateHashData` data type.
809#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
810pub struct CertificateHashData {
811    /// The `hashAlgorithm` member.
812    #[serde(rename = "hashAlgorithm")]
813    pub hash_algorithm: HashAlgorithm,
814    /// The hash of the issuer’s distinguished
815    /// name (DN), that must be calculated over the DER
816    /// encoding of the issuer’s name field in the certificate
817    /// being checked.
818    #[serde(rename = "issuerNameHash")]
819    pub issuer_name_hash: String,
820    /// The hash of the DER encoded public key:
821    /// the value (excluding tag and length) of the subject
822    /// public key field in the issuer’s certificate.
823    #[serde(rename = "issuerKeyHash")]
824    pub issuer_key_hash: String,
825    /// The string representation of the
826    /// hexadecimal value of the serial number without the
827    /// prefix "0x" and without leading zeroes.
828    #[serde(rename = "serialNumber")]
829    pub serial_number: String,
830    /// The `customData` member.
831    #[serde(rename = "customData")]
832    #[serde(default, skip_serializing_if = "Option::is_none")]
833    pub custom_data: Option<crate::types::CustomData>,
834}
835
836impl CertificateHashData {
837    /// Creates a `CertificateHashData` from its required fields.
838    #[must_use]
839    pub fn new(
840        hash_algorithm: HashAlgorithm,
841        issuer_name_hash: impl Into<String>,
842        issuer_key_hash: impl Into<String>,
843        serial_number: impl Into<String>,
844    ) -> Self {
845        Self {
846            hash_algorithm,
847            issuer_name_hash: issuer_name_hash.into(),
848            issuer_key_hash: issuer_key_hash.into(),
849            serial_number: serial_number.into(),
850            custom_data: None,
851        }
852    }
853
854    /// Sets the optional `customData` field.
855    #[must_use]
856    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
857        self.custom_data = Some(value);
858        self
859    }
860}
861
862impl Validate for CertificateHashData {
863    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
864        path.push_key("hashAlgorithm");
865        Validate::validate_at(&self.hash_algorithm, path, out);
866        path.pop();
867        path.push_key("issuerNameHash");
868        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
869        path.pop();
870        path.push_key("issuerKeyHash");
871        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
872        path.pop();
873        path.push_key("serialNumber");
874        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
875        path.pop();
876        path.push_key("customData");
877        if let Some(value) = &self.custom_data {
878            Validate::validate_at(value, path, out);
879        }
880        path.pop();
881    }
882}
883
884/// The OCPP 2.1 `CertificateHashDataChain` data type.
885#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
886pub struct CertificateHashDataChain {
887    /// The `certificateHashData` member.
888    #[serde(rename = "certificateHashData")]
889    pub certificate_hash_data: CertificateHashData,
890    /// The `certificateType` member.
891    #[serde(rename = "certificateType")]
892    pub certificate_type: GetCertificateIdUse,
893    /// The `childCertificateHashData` member.
894    #[serde(rename = "childCertificateHashData")]
895    #[serde(default, skip_serializing_if = "Option::is_none")]
896    pub child_certificate_hash_data: Option<Vec<CertificateHashData>>,
897    /// The `customData` member.
898    #[serde(rename = "customData")]
899    #[serde(default, skip_serializing_if = "Option::is_none")]
900    pub custom_data: Option<crate::types::CustomData>,
901}
902
903impl CertificateHashDataChain {
904    /// Creates a `CertificateHashDataChain` from its required fields.
905    #[must_use]
906    pub fn new(
907        certificate_hash_data: CertificateHashData,
908        certificate_type: GetCertificateIdUse,
909    ) -> Self {
910        Self {
911            certificate_hash_data,
912            certificate_type,
913            child_certificate_hash_data: None,
914            custom_data: None,
915        }
916    }
917
918    /// Sets the optional `childCertificateHashData` field.
919    #[must_use]
920    pub fn with_child_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
921        self.child_certificate_hash_data = Some(value);
922        self
923    }
924
925    /// Sets the optional `customData` field.
926    #[must_use]
927    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
928        self.custom_data = Some(value);
929        self
930    }
931}
932
933impl Validate for CertificateHashDataChain {
934    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
935        path.push_key("certificateHashData");
936        Validate::validate_at(&self.certificate_hash_data, path, out);
937        path.pop();
938        path.push_key("certificateType");
939        Validate::validate_at(&self.certificate_type, path, out);
940        path.pop();
941        path.push_key("childCertificateHashData");
942        if let Some(value) = &self.child_certificate_hash_data {
943            validate::list_len(value.len(), Some(1), Some(4), path, out);
944            for (index, item) in value.iter().enumerate() {
945                path.push_index(index);
946                Validate::validate_at(item, path, out);
947                path.pop();
948            }
949        }
950        path.pop();
951        path.push_key("customData");
952        if let Some(value) = &self.custom_data {
953            Validate::validate_at(value, path, out);
954        }
955        path.pop();
956    }
957}
958
959/// Revocation status of certificate
960///
961/// The OCPP 2.1 `CertificateStatus` data type.
962#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
963pub struct CertificateStatus {
964    /// The `certificateHashData` member.
965    #[serde(rename = "certificateHashData")]
966    pub certificate_hash_data: CertificateHashData,
967    /// The `source` member.
968    pub source: CertificateStatusSource,
969    /// The `status` member.
970    pub status: CertificateStatusEnum,
971    /// The `nextUpdate` member.
972    #[serde(rename = "nextUpdate")]
973    pub next_update: crate::types::DateTime,
974    /// The `customData` member.
975    #[serde(rename = "customData")]
976    #[serde(default, skip_serializing_if = "Option::is_none")]
977    pub custom_data: Option<crate::types::CustomData>,
978}
979
980impl CertificateStatus {
981    /// Creates a `CertificateStatus` from its required fields.
982    #[must_use]
983    pub fn new(
984        certificate_hash_data: CertificateHashData,
985        source: CertificateStatusSource,
986        status: CertificateStatusEnum,
987        next_update: impl Into<crate::types::DateTime>,
988    ) -> Self {
989        Self {
990            certificate_hash_data,
991            source,
992            status,
993            next_update: next_update.into(),
994            custom_data: None,
995        }
996    }
997
998    /// Sets the optional `customData` field.
999    #[must_use]
1000    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1001        self.custom_data = Some(value);
1002        self
1003    }
1004}
1005
1006impl Validate for CertificateStatus {
1007    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1008        path.push_key("certificateHashData");
1009        Validate::validate_at(&self.certificate_hash_data, path, out);
1010        path.pop();
1011        path.push_key("source");
1012        Validate::validate_at(&self.source, path, out);
1013        path.pop();
1014        path.push_key("status");
1015        Validate::validate_at(&self.status, path, out);
1016        path.pop();
1017        path.push_key("customData");
1018        if let Some(value) = &self.custom_data {
1019            Validate::validate_at(value, path, out);
1020        }
1021        path.pop();
1022    }
1023}
1024
1025/// Data necessary to request the revocation status of a certificate.
1026///
1027/// The OCPP 2.1 `CertificateStatusRequestInfo` data type.
1028#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1029pub struct CertificateStatusRequestInfo {
1030    /// The `certificateHashData` member.
1031    #[serde(rename = "certificateHashData")]
1032    pub certificate_hash_data: CertificateHashData,
1033    /// The `source` member.
1034    pub source: CertificateStatusSource,
1035    /// URL(s) of _source_.
1036    pub urls: Vec<String>,
1037    /// The `customData` member.
1038    #[serde(rename = "customData")]
1039    #[serde(default, skip_serializing_if = "Option::is_none")]
1040    pub custom_data: Option<crate::types::CustomData>,
1041}
1042
1043impl CertificateStatusRequestInfo {
1044    /// Creates a `CertificateStatusRequestInfo` from its required fields.
1045    #[must_use]
1046    pub fn new(
1047        certificate_hash_data: CertificateHashData,
1048        source: CertificateStatusSource,
1049        urls: impl IntoIterator<Item = impl Into<String>>,
1050    ) -> Self {
1051        Self {
1052            certificate_hash_data,
1053            source,
1054            urls: urls.into_iter().map(Into::into).collect(),
1055            custom_data: None,
1056        }
1057    }
1058
1059    /// Sets the optional `customData` field.
1060    #[must_use]
1061    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1062        self.custom_data = Some(value);
1063        self
1064    }
1065}
1066
1067impl Validate for CertificateStatusRequestInfo {
1068    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1069        path.push_key("certificateHashData");
1070        Validate::validate_at(&self.certificate_hash_data, path, out);
1071        path.pop();
1072        path.push_key("source");
1073        Validate::validate_at(&self.source, path, out);
1074        path.pop();
1075        path.push_key("urls");
1076        validate::list_len(self.urls.len(), Some(1), Some(5), path, out);
1077        for (index, item) in self.urls.iter().enumerate() {
1078            path.push_index(index);
1079            validate::string(item.as_str(), None, Some(2000), path, out);
1080            path.pop();
1081        }
1082        path.pop();
1083        path.push_key("customData");
1084        if let Some(value) = &self.custom_data {
1085            Validate::validate_at(value, path, out);
1086        }
1087        path.pop();
1088    }
1089}
1090
1091/// The OCPP 2.1 `ChargingLimit` data type.
1092#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1093pub struct ChargingLimit {
1094    /// Represents the source of the charging limit. Values defined in appendix as ChargingLimitSourceEnumStringType.
1095    #[serde(rename = "chargingLimitSource")]
1096    pub charging_limit_source: String,
1097    /// *(2.1)* True when the reported limit concerns local generation that is providing extra capacity, instead of a limitation.
1098    #[serde(rename = "isLocalGeneration")]
1099    #[serde(default, skip_serializing_if = "Option::is_none")]
1100    pub is_local_generation: Option<bool>,
1101    /// Indicates whether the charging limit is critical for the grid.
1102    #[serde(rename = "isGridCritical")]
1103    #[serde(default, skip_serializing_if = "Option::is_none")]
1104    pub is_grid_critical: Option<bool>,
1105    /// The `customData` member.
1106    #[serde(rename = "customData")]
1107    #[serde(default, skip_serializing_if = "Option::is_none")]
1108    pub custom_data: Option<crate::types::CustomData>,
1109}
1110
1111impl ChargingLimit {
1112    /// Creates a `ChargingLimit` from its required fields.
1113    #[must_use]
1114    pub fn new(charging_limit_source: impl Into<String>) -> Self {
1115        Self {
1116            charging_limit_source: charging_limit_source.into(),
1117            is_local_generation: None,
1118            is_grid_critical: None,
1119            custom_data: None,
1120        }
1121    }
1122
1123    /// Sets the optional `isLocalGeneration` field.
1124    #[must_use]
1125    pub fn with_is_local_generation(mut self, value: bool) -> Self {
1126        self.is_local_generation = Some(value);
1127        self
1128    }
1129
1130    /// Sets the optional `isGridCritical` field.
1131    #[must_use]
1132    pub fn with_is_grid_critical(mut self, value: bool) -> Self {
1133        self.is_grid_critical = Some(value);
1134        self
1135    }
1136
1137    /// Sets the optional `customData` field.
1138    #[must_use]
1139    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1140        self.custom_data = Some(value);
1141        self
1142    }
1143}
1144
1145impl Validate for ChargingLimit {
1146    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1147        path.push_key("chargingLimitSource");
1148        validate::string(
1149            self.charging_limit_source.as_str(),
1150            None,
1151            Some(20),
1152            path,
1153            out,
1154        );
1155        path.pop();
1156        path.push_key("customData");
1157        if let Some(value) = &self.custom_data {
1158            Validate::validate_at(value, path, out);
1159        }
1160        path.pop();
1161    }
1162}
1163
1164/// The OCPP 2.1 `ChargingNeeds` data type.
1165#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1166pub struct ChargingNeeds {
1167    /// The `requestedEnergyTransfer` member.
1168    #[serde(rename = "requestedEnergyTransfer")]
1169    pub requested_energy_transfer: EnergyTransferMode,
1170    /// The `acChargingParameters` member.
1171    #[serde(rename = "acChargingParameters")]
1172    #[serde(default, skip_serializing_if = "Option::is_none")]
1173    pub ac_charging_parameters: Option<ACChargingParameters>,
1174    /// The `derChargingParameters` member.
1175    #[serde(rename = "derChargingParameters")]
1176    #[serde(default, skip_serializing_if = "Option::is_none")]
1177    pub der_charging_parameters: Option<DERChargingParameters>,
1178    /// The `evEnergyOffer` member.
1179    #[serde(rename = "evEnergyOffer")]
1180    #[serde(default, skip_serializing_if = "Option::is_none")]
1181    pub ev_energy_offer: Option<EVEnergyOffer>,
1182    /// The `dcChargingParameters` member.
1183    #[serde(rename = "dcChargingParameters")]
1184    #[serde(default, skip_serializing_if = "Option::is_none")]
1185    pub dc_charging_parameters: Option<DCChargingParameters>,
1186    /// The `v2xChargingParameters` member.
1187    #[serde(rename = "v2xChargingParameters")]
1188    #[serde(default, skip_serializing_if = "Option::is_none")]
1189    pub v2x_charging_parameters: Option<V2XChargingParameters>,
1190    /// *(2.1)* Modes of energy transfer that are marked as available by EV.
1191    #[serde(rename = "availableEnergyTransfer")]
1192    #[serde(default, skip_serializing_if = "Option::is_none")]
1193    pub available_energy_transfer: Option<Vec<EnergyTransferMode>>,
1194    /// The `controlMode` member.
1195    #[serde(rename = "controlMode")]
1196    #[serde(default, skip_serializing_if = "Option::is_none")]
1197    pub control_mode: Option<ControlMode>,
1198    /// The `mobilityNeedsMode` member.
1199    #[serde(rename = "mobilityNeedsMode")]
1200    #[serde(default, skip_serializing_if = "Option::is_none")]
1201    pub mobility_needs_mode: Option<MobilityNeedsMode>,
1202    /// Estimated departure time of the EV. +
1203    /// *ISO 15118-2:* AC/DC_EVChargeParameterType: DepartureTime +
1204    /// *ISO 15118-20:* Dynamic/Scheduled_SEReqControlModeType: DepartureTIme
1205    #[serde(rename = "departureTime")]
1206    #[serde(default, skip_serializing_if = "Option::is_none")]
1207    pub departure_time: Option<crate::types::DateTime>,
1208    /// The `customData` member.
1209    #[serde(rename = "customData")]
1210    #[serde(default, skip_serializing_if = "Option::is_none")]
1211    pub custom_data: Option<crate::types::CustomData>,
1212}
1213
1214impl ChargingNeeds {
1215    /// Creates a `ChargingNeeds` from its required fields.
1216    #[must_use]
1217    pub fn new(requested_energy_transfer: EnergyTransferMode) -> Self {
1218        Self {
1219            requested_energy_transfer,
1220            ac_charging_parameters: None,
1221            der_charging_parameters: None,
1222            ev_energy_offer: None,
1223            dc_charging_parameters: None,
1224            v2x_charging_parameters: None,
1225            available_energy_transfer: None,
1226            control_mode: None,
1227            mobility_needs_mode: None,
1228            departure_time: None,
1229            custom_data: None,
1230        }
1231    }
1232
1233    /// Sets the optional `acChargingParameters` field.
1234    #[must_use]
1235    pub fn with_ac_charging_parameters(mut self, value: ACChargingParameters) -> Self {
1236        self.ac_charging_parameters = Some(value);
1237        self
1238    }
1239
1240    /// Sets the optional `derChargingParameters` field.
1241    #[must_use]
1242    pub fn with_der_charging_parameters(mut self, value: DERChargingParameters) -> Self {
1243        self.der_charging_parameters = Some(value);
1244        self
1245    }
1246
1247    /// Sets the optional `evEnergyOffer` field.
1248    #[must_use]
1249    pub fn with_ev_energy_offer(mut self, value: EVEnergyOffer) -> Self {
1250        self.ev_energy_offer = Some(value);
1251        self
1252    }
1253
1254    /// Sets the optional `dcChargingParameters` field.
1255    #[must_use]
1256    pub fn with_dc_charging_parameters(mut self, value: DCChargingParameters) -> Self {
1257        self.dc_charging_parameters = Some(value);
1258        self
1259    }
1260
1261    /// Sets the optional `v2xChargingParameters` field.
1262    #[must_use]
1263    pub fn with_v2x_charging_parameters(mut self, value: V2XChargingParameters) -> Self {
1264        self.v2x_charging_parameters = Some(value);
1265        self
1266    }
1267
1268    /// Sets the optional `availableEnergyTransfer` field.
1269    #[must_use]
1270    pub fn with_available_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
1271        self.available_energy_transfer = Some(value);
1272        self
1273    }
1274
1275    /// Sets the optional `controlMode` field.
1276    #[must_use]
1277    pub fn with_control_mode(mut self, value: ControlMode) -> Self {
1278        self.control_mode = Some(value);
1279        self
1280    }
1281
1282    /// Sets the optional `mobilityNeedsMode` field.
1283    #[must_use]
1284    pub fn with_mobility_needs_mode(mut self, value: MobilityNeedsMode) -> Self {
1285        self.mobility_needs_mode = Some(value);
1286        self
1287    }
1288
1289    /// Sets the optional `departureTime` field.
1290    #[must_use]
1291    pub fn with_departure_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1292        self.departure_time = Some(value.into());
1293        self
1294    }
1295
1296    /// Sets the optional `customData` field.
1297    #[must_use]
1298    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1299        self.custom_data = Some(value);
1300        self
1301    }
1302}
1303
1304impl Validate for ChargingNeeds {
1305    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1306        path.push_key("requestedEnergyTransfer");
1307        Validate::validate_at(&self.requested_energy_transfer, path, out);
1308        path.pop();
1309        path.push_key("acChargingParameters");
1310        if let Some(value) = &self.ac_charging_parameters {
1311            Validate::validate_at(value, path, out);
1312        }
1313        path.pop();
1314        path.push_key("derChargingParameters");
1315        if let Some(value) = &self.der_charging_parameters {
1316            Validate::validate_at(value, path, out);
1317        }
1318        path.pop();
1319        path.push_key("evEnergyOffer");
1320        if let Some(value) = &self.ev_energy_offer {
1321            Validate::validate_at(value, path, out);
1322        }
1323        path.pop();
1324        path.push_key("dcChargingParameters");
1325        if let Some(value) = &self.dc_charging_parameters {
1326            Validate::validate_at(value, path, out);
1327        }
1328        path.pop();
1329        path.push_key("v2xChargingParameters");
1330        if let Some(value) = &self.v2x_charging_parameters {
1331            Validate::validate_at(value, path, out);
1332        }
1333        path.pop();
1334        path.push_key("availableEnergyTransfer");
1335        if let Some(value) = &self.available_energy_transfer {
1336            validate::list_len(value.len(), Some(1), None, path, out);
1337            for (index, item) in value.iter().enumerate() {
1338                path.push_index(index);
1339                Validate::validate_at(item, path, out);
1340                path.pop();
1341            }
1342        }
1343        path.pop();
1344        path.push_key("controlMode");
1345        if let Some(value) = &self.control_mode {
1346            Validate::validate_at(value, path, out);
1347        }
1348        path.pop();
1349        path.push_key("mobilityNeedsMode");
1350        if let Some(value) = &self.mobility_needs_mode {
1351            Validate::validate_at(value, path, out);
1352        }
1353        path.pop();
1354        path.push_key("customData");
1355        if let Some(value) = &self.custom_data {
1356            Validate::validate_at(value, path, out);
1357        }
1358        path.pop();
1359    }
1360}
1361
1362/// 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.
1363///
1364/// The OCPP 2.1 `ChargingPeriod` data type.
1365#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1366pub struct ChargingPeriod {
1367    /// Start timestamp of charging period. A period ends when the next period starts. The last period ends when the session ends.
1368    #[serde(rename = "startPeriod")]
1369    pub start_period: crate::types::DateTime,
1370    /// The `dimensions` member.
1371    #[serde(default, skip_serializing_if = "Option::is_none")]
1372    pub dimensions: Option<Vec<CostDimension>>,
1373    /// Unique identifier of the Tariff that was used to calculate cost. If not provided, then cost was calculated by some other means.
1374    #[serde(rename = "tariffId")]
1375    #[serde(default, skip_serializing_if = "Option::is_none")]
1376    pub tariff_id: Option<String>,
1377    /// The `customData` member.
1378    #[serde(rename = "customData")]
1379    #[serde(default, skip_serializing_if = "Option::is_none")]
1380    pub custom_data: Option<crate::types::CustomData>,
1381}
1382
1383impl ChargingPeriod {
1384    /// Creates a `ChargingPeriod` from its required fields.
1385    #[must_use]
1386    pub fn new(start_period: impl Into<crate::types::DateTime>) -> Self {
1387        Self {
1388            start_period: start_period.into(),
1389            dimensions: None,
1390            tariff_id: None,
1391            custom_data: None,
1392        }
1393    }
1394
1395    /// Sets the optional `dimensions` field.
1396    #[must_use]
1397    pub fn with_dimensions(mut self, value: Vec<CostDimension>) -> Self {
1398        self.dimensions = Some(value);
1399        self
1400    }
1401
1402    /// Sets the optional `tariffId` field.
1403    #[must_use]
1404    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
1405        self.tariff_id = Some(value.into());
1406        self
1407    }
1408
1409    /// Sets the optional `customData` field.
1410    #[must_use]
1411    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1412        self.custom_data = Some(value);
1413        self
1414    }
1415}
1416
1417impl Validate for ChargingPeriod {
1418    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1419        path.push_key("dimensions");
1420        if let Some(value) = &self.dimensions {
1421            validate::list_len(value.len(), Some(1), None, path, out);
1422            for (index, item) in value.iter().enumerate() {
1423                path.push_index(index);
1424                Validate::validate_at(item, path, out);
1425                path.pop();
1426            }
1427        }
1428        path.pop();
1429        path.push_key("tariffId");
1430        if let Some(value) = &self.tariff_id {
1431            validate::string(value.as_str(), None, Some(60), path, out);
1432        }
1433        path.pop();
1434        path.push_key("customData");
1435        if let Some(value) = &self.custom_data {
1436            Validate::validate_at(value, path, out);
1437        }
1438        path.pop();
1439    }
1440}
1441
1442/// 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.
1443///
1444/// image::images/ChargingProfile-Simple.png\[\]
1445///
1446/// The OCPP 2.1 `ChargingProfile` data type.
1447#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1448pub struct ChargingProfile {
1449    /// 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.
1450    #[serde(deserialize_with = "crate::types::integer::one")]
1451    pub id: i32,
1452    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1453    #[serde(rename = "stackLevel")]
1454    #[serde(deserialize_with = "crate::types::integer::one")]
1455    pub stack_level: i32,
1456    /// The `chargingProfilePurpose` member.
1457    #[serde(rename = "chargingProfilePurpose")]
1458    pub charging_profile_purpose: ChargingProfilePurpose,
1459    /// The `chargingProfileKind` member.
1460    #[serde(rename = "chargingProfileKind")]
1461    pub charging_profile_kind: ChargingProfileKind,
1462    /// The `chargingSchedule` member.
1463    #[serde(rename = "chargingSchedule")]
1464    pub charging_schedule: Vec<ChargingSchedule>,
1465    /// The `recurrencyKind` member.
1466    #[serde(rename = "recurrencyKind")]
1467    #[serde(default, skip_serializing_if = "Option::is_none")]
1468    pub recurrency_kind: Option<RecurrencyKind>,
1469    /// 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.
1470    #[serde(rename = "validFrom")]
1471    #[serde(default, skip_serializing_if = "Option::is_none")]
1472    pub valid_from: Option<crate::types::DateTime>,
1473    /// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
1474    #[serde(rename = "validTo")]
1475    #[serde(default, skip_serializing_if = "Option::is_none")]
1476    pub valid_to: Option<crate::types::DateTime>,
1477    /// 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.
1478    #[serde(rename = "transactionId")]
1479    #[serde(default, skip_serializing_if = "Option::is_none")]
1480    pub transaction_id: Option<String>,
1481    /// *(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.
1482    /// If _invalidAfterOfflineDuration_ is true, then this charging profile will become permanently invalid.
1483    /// 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.
1484    #[serde(rename = "maxOfflineDuration")]
1485    #[serde(default, skip_serializing_if = "Option::is_none")]
1486    #[serde(deserialize_with = "crate::types::integer::option")]
1487    pub max_offline_duration: Option<i32>,
1488    /// *(2.1)* When set to true this charging profile will not be valid anymore after being offline for more than _maxOfflineDuration_. +
1489    ///     When absent defaults to false.
1490    #[serde(rename = "invalidAfterOfflineDuration")]
1491    #[serde(default, skip_serializing_if = "Option::is_none")]
1492    pub invalid_after_offline_duration: Option<bool>,
1493    /// *(2.1)*  Interval in seconds after receipt of last update, when to request a profile update by sending a PullDynamicScheduleUpdateRequest message.
1494    ///     A value of 0 or no value means that no update interval applies. +
1495    ///     Only relevant in a dynamic charging profile.
1496    #[serde(rename = "dynUpdateInterval")]
1497    #[serde(default, skip_serializing_if = "Option::is_none")]
1498    #[serde(deserialize_with = "crate::types::integer::option")]
1499    pub dyn_update_interval: Option<i32>,
1500    /// *(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. +
1501    ///     Only relevant in a dynamic charging profile.
1502    #[serde(rename = "dynUpdateTime")]
1503    #[serde(default, skip_serializing_if = "Option::is_none")]
1504    pub dyn_update_time: Option<crate::types::DateTime>,
1505    /// *(2.1)* ISO 15118-20 signature for all price schedules in _chargingSchedules_. +
1506    /// 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.
1507    #[serde(rename = "priceScheduleSignature")]
1508    #[serde(default, skip_serializing_if = "Option::is_none")]
1509    pub price_schedule_signature: Option<String>,
1510    /// The `customData` member.
1511    #[serde(rename = "customData")]
1512    #[serde(default, skip_serializing_if = "Option::is_none")]
1513    pub custom_data: Option<crate::types::CustomData>,
1514}
1515
1516impl ChargingProfile {
1517    /// Creates a `ChargingProfile` from its required fields.
1518    #[must_use]
1519    pub fn new(
1520        id: i32,
1521        stack_level: i32,
1522        charging_profile_purpose: ChargingProfilePurpose,
1523        charging_profile_kind: ChargingProfileKind,
1524        charging_schedule: Vec<ChargingSchedule>,
1525    ) -> Self {
1526        Self {
1527            id,
1528            stack_level,
1529            charging_profile_purpose,
1530            charging_profile_kind,
1531            charging_schedule,
1532            recurrency_kind: None,
1533            valid_from: None,
1534            valid_to: None,
1535            transaction_id: None,
1536            max_offline_duration: None,
1537            invalid_after_offline_duration: None,
1538            dyn_update_interval: None,
1539            dyn_update_time: None,
1540            price_schedule_signature: None,
1541            custom_data: None,
1542        }
1543    }
1544
1545    /// Sets the optional `recurrencyKind` field.
1546    #[must_use]
1547    pub fn with_recurrency_kind(mut self, value: RecurrencyKind) -> Self {
1548        self.recurrency_kind = Some(value);
1549        self
1550    }
1551
1552    /// Sets the optional `validFrom` field.
1553    #[must_use]
1554    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1555        self.valid_from = Some(value.into());
1556        self
1557    }
1558
1559    /// Sets the optional `validTo` field.
1560    #[must_use]
1561    pub fn with_valid_to(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1562        self.valid_to = Some(value.into());
1563        self
1564    }
1565
1566    /// Sets the optional `transactionId` field.
1567    #[must_use]
1568    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
1569        self.transaction_id = Some(value.into());
1570        self
1571    }
1572
1573    /// Sets the optional `maxOfflineDuration` field.
1574    #[must_use]
1575    pub fn with_max_offline_duration(mut self, value: i32) -> Self {
1576        self.max_offline_duration = Some(value);
1577        self
1578    }
1579
1580    /// Sets the optional `invalidAfterOfflineDuration` field.
1581    #[must_use]
1582    pub fn with_invalid_after_offline_duration(mut self, value: bool) -> Self {
1583        self.invalid_after_offline_duration = Some(value);
1584        self
1585    }
1586
1587    /// Sets the optional `dynUpdateInterval` field.
1588    #[must_use]
1589    pub fn with_dyn_update_interval(mut self, value: i32) -> Self {
1590        self.dyn_update_interval = Some(value);
1591        self
1592    }
1593
1594    /// Sets the optional `dynUpdateTime` field.
1595    #[must_use]
1596    pub fn with_dyn_update_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1597        self.dyn_update_time = Some(value.into());
1598        self
1599    }
1600
1601    /// Sets the optional `priceScheduleSignature` field.
1602    #[must_use]
1603    pub fn with_price_schedule_signature(mut self, value: impl Into<String>) -> Self {
1604        self.price_schedule_signature = Some(value.into());
1605        self
1606    }
1607
1608    /// Sets the optional `customData` field.
1609    #[must_use]
1610    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1611        self.custom_data = Some(value);
1612        self
1613    }
1614}
1615
1616impl Validate for ChargingProfile {
1617    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1618        path.push_key("stackLevel");
1619        validate::int_range(i64::from(self.stack_level), Some(0), None, path, out);
1620        path.pop();
1621        path.push_key("chargingProfilePurpose");
1622        Validate::validate_at(&self.charging_profile_purpose, path, out);
1623        path.pop();
1624        path.push_key("chargingProfileKind");
1625        Validate::validate_at(&self.charging_profile_kind, path, out);
1626        path.pop();
1627        path.push_key("chargingSchedule");
1628        validate::list_len(self.charging_schedule.len(), Some(1), Some(3), path, out);
1629        for (index, item) in self.charging_schedule.iter().enumerate() {
1630            path.push_index(index);
1631            Validate::validate_at(item, path, out);
1632            path.pop();
1633        }
1634        path.pop();
1635        path.push_key("recurrencyKind");
1636        if let Some(value) = &self.recurrency_kind {
1637            Validate::validate_at(value, path, out);
1638        }
1639        path.pop();
1640        path.push_key("transactionId");
1641        if let Some(value) = &self.transaction_id {
1642            validate::string(value.as_str(), None, Some(36), path, out);
1643        }
1644        path.pop();
1645        path.push_key("priceScheduleSignature");
1646        if let Some(value) = &self.price_schedule_signature {
1647            validate::string(value.as_str(), None, Some(256), path, out);
1648        }
1649        path.pop();
1650        path.push_key("customData");
1651        if let Some(value) = &self.custom_data {
1652            Validate::validate_at(value, path, out);
1653        }
1654        path.pop();
1655    }
1656}
1657
1658/// A ChargingProfileCriterionType is a filter for charging profiles to be selected by a GetChargingProfilesRequest.
1659///
1660/// The OCPP 2.1 `ChargingProfileCriterion` data type.
1661#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1662pub struct ChargingProfileCriterion {
1663    /// The `chargingProfilePurpose` member.
1664    #[serde(rename = "chargingProfilePurpose")]
1665    #[serde(default, skip_serializing_if = "Option::is_none")]
1666    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
1667    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1668    #[serde(rename = "stackLevel")]
1669    #[serde(default, skip_serializing_if = "Option::is_none")]
1670    #[serde(deserialize_with = "crate::types::integer::option")]
1671    pub stack_level: Option<i32>,
1672    /// 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;
1673    #[serde(rename = "chargingProfileId")]
1674    #[serde(default, skip_serializing_if = "Option::is_none")]
1675    #[serde(deserialize_with = "crate::types::integer::option_list")]
1676    pub charging_profile_id: Option<Vec<i32>>,
1677    /// 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.
1678    #[serde(rename = "chargingLimitSource")]
1679    #[serde(default, skip_serializing_if = "Option::is_none")]
1680    pub charging_limit_source: Option<Vec<String>>,
1681    /// The `customData` member.
1682    #[serde(rename = "customData")]
1683    #[serde(default, skip_serializing_if = "Option::is_none")]
1684    pub custom_data: Option<crate::types::CustomData>,
1685}
1686
1687impl ChargingProfileCriterion {
1688    /// Creates an empty `ChargingProfileCriterion`. Every field of this type is optional.
1689    #[must_use]
1690    pub fn new() -> Self {
1691        Self::default()
1692    }
1693
1694    /// Sets the optional `chargingProfilePurpose` field.
1695    #[must_use]
1696    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
1697        self.charging_profile_purpose = Some(value);
1698        self
1699    }
1700
1701    /// Sets the optional `stackLevel` field.
1702    #[must_use]
1703    pub fn with_stack_level(mut self, value: i32) -> Self {
1704        self.stack_level = Some(value);
1705        self
1706    }
1707
1708    /// Sets the optional `chargingProfileId` field.
1709    #[must_use]
1710    pub fn with_charging_profile_id(mut self, value: Vec<i32>) -> Self {
1711        self.charging_profile_id = Some(value);
1712        self
1713    }
1714
1715    /// Sets the optional `chargingLimitSource` field.
1716    #[must_use]
1717    pub fn with_charging_limit_source(
1718        mut self,
1719        value: impl IntoIterator<Item = impl Into<String>>,
1720    ) -> Self {
1721        self.charging_limit_source = Some(value.into_iter().map(Into::into).collect());
1722        self
1723    }
1724
1725    /// Sets the optional `customData` field.
1726    #[must_use]
1727    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1728        self.custom_data = Some(value);
1729        self
1730    }
1731}
1732
1733impl Validate for ChargingProfileCriterion {
1734    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1735        path.push_key("chargingProfilePurpose");
1736        if let Some(value) = &self.charging_profile_purpose {
1737            Validate::validate_at(value, path, out);
1738        }
1739        path.pop();
1740        path.push_key("stackLevel");
1741        if let Some(value) = &self.stack_level {
1742            validate::int_range(i64::from(*value), Some(0), None, path, out);
1743        }
1744        path.pop();
1745        path.push_key("chargingProfileId");
1746        if let Some(value) = &self.charging_profile_id {
1747            validate::list_len(value.len(), Some(1), None, path, out);
1748        }
1749        path.pop();
1750        path.push_key("chargingLimitSource");
1751        if let Some(value) = &self.charging_limit_source {
1752            validate::list_len(value.len(), Some(1), Some(4), path, out);
1753            for (index, item) in value.iter().enumerate() {
1754                path.push_index(index);
1755                validate::string(item.as_str(), None, Some(20), path, out);
1756                path.pop();
1757            }
1758        }
1759        path.pop();
1760        path.push_key("customData");
1761        if let Some(value) = &self.custom_data {
1762            Validate::validate_at(value, path, out);
1763        }
1764        path.pop();
1765    }
1766}
1767
1768/// 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'. +
1769/// 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.
1770///
1771/// image::images/ChargingSchedule-Simple.png\[\]
1772///
1773/// The OCPP 2.1 `ChargingSchedule` data type.
1774#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1775pub struct ChargingSchedule {
1776    /// The `id` member.
1777    #[serde(deserialize_with = "crate::types::integer::one")]
1778    pub id: i32,
1779    /// The `chargingRateUnit` member.
1780    #[serde(rename = "chargingRateUnit")]
1781    pub charging_rate_unit: ChargingRateUnit,
1782    /// The `chargingSchedulePeriod` member.
1783    #[serde(rename = "chargingSchedulePeriod")]
1784    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
1785    /// The `limitAtSoC` member.
1786    #[serde(rename = "limitAtSoC")]
1787    #[serde(default, skip_serializing_if = "Option::is_none")]
1788    pub limit_at_so_c: Option<LimitAtSoC>,
1789    /// Starting point of an absolute schedule or recurring schedule.
1790    #[serde(rename = "startSchedule")]
1791    #[serde(default, skip_serializing_if = "Option::is_none")]
1792    pub start_schedule: Option<crate::types::DateTime>,
1793    /// 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.
1794    #[serde(default, skip_serializing_if = "Option::is_none")]
1795    #[serde(deserialize_with = "crate::types::integer::option")]
1796    pub duration: Option<i32>,
1797    /// 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.
1798    #[serde(rename = "minChargingRate")]
1799    #[serde(default, skip_serializing_if = "Option::is_none")]
1800    pub min_charging_rate: Option<crate::types::Decimal>,
1801    /// *(2.1)* Power tolerance when following EVPowerProfile.
1802    #[serde(rename = "powerTolerance")]
1803    #[serde(default, skip_serializing_if = "Option::is_none")]
1804    pub power_tolerance: Option<crate::types::Decimal>,
1805    /// *(2.1)* Id of this element for referencing in a signature.
1806    #[serde(rename = "signatureId")]
1807    #[serde(default, skip_serializing_if = "Option::is_none")]
1808    #[serde(deserialize_with = "crate::types::integer::option")]
1809    pub signature_id: Option<i32>,
1810    /// *(2.1)* Base64 encoded hash (SHA256 for ISO 15118-2, SHA512 for ISO 15118-20) of the EXI price schedule element. Used in signature.
1811    #[serde(rename = "digestValue")]
1812    #[serde(default, skip_serializing_if = "Option::is_none")]
1813    pub digest_value: Option<String>,
1814    /// *(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.
1815    ///  This allows the same `Absolute` or `Recurring` charging profile to be used in both summer and winter time.
1816    #[serde(rename = "useLocalTime")]
1817    #[serde(default, skip_serializing_if = "Option::is_none")]
1818    pub use_local_time: Option<bool>,
1819    /// *(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.
1820    #[serde(rename = "randomizedDelay")]
1821    #[serde(default, skip_serializing_if = "Option::is_none")]
1822    #[serde(deserialize_with = "crate::types::integer::option")]
1823    pub randomized_delay: Option<i32>,
1824    /// The `salesTariff` member.
1825    #[serde(rename = "salesTariff")]
1826    #[serde(default, skip_serializing_if = "Option::is_none")]
1827    pub sales_tariff: Option<SalesTariff>,
1828    /// The `absolutePriceSchedule` member.
1829    #[serde(rename = "absolutePriceSchedule")]
1830    #[serde(default, skip_serializing_if = "Option::is_none")]
1831    pub absolute_price_schedule: Option<AbsolutePriceSchedule>,
1832    /// The `priceLevelSchedule` member.
1833    #[serde(rename = "priceLevelSchedule")]
1834    #[serde(default, skip_serializing_if = "Option::is_none")]
1835    pub price_level_schedule: Option<PriceLevelSchedule>,
1836    /// The `customData` member.
1837    #[serde(rename = "customData")]
1838    #[serde(default, skip_serializing_if = "Option::is_none")]
1839    pub custom_data: Option<crate::types::CustomData>,
1840}
1841
1842impl ChargingSchedule {
1843    /// Creates a `ChargingSchedule` from its required fields.
1844    #[must_use]
1845    pub fn new(
1846        id: i32,
1847        charging_rate_unit: ChargingRateUnit,
1848        charging_schedule_period: Vec<ChargingSchedulePeriod>,
1849    ) -> Self {
1850        Self {
1851            id,
1852            charging_rate_unit,
1853            charging_schedule_period,
1854            limit_at_so_c: None,
1855            start_schedule: None,
1856            duration: None,
1857            min_charging_rate: None,
1858            power_tolerance: None,
1859            signature_id: None,
1860            digest_value: None,
1861            use_local_time: None,
1862            randomized_delay: None,
1863            sales_tariff: None,
1864            absolute_price_schedule: None,
1865            price_level_schedule: None,
1866            custom_data: None,
1867        }
1868    }
1869
1870    /// Sets the optional `limitAtSoC` field.
1871    #[must_use]
1872    pub fn with_limit_at_so_c(mut self, value: LimitAtSoC) -> Self {
1873        self.limit_at_so_c = Some(value);
1874        self
1875    }
1876
1877    /// Sets the optional `startSchedule` field.
1878    #[must_use]
1879    pub fn with_start_schedule(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1880        self.start_schedule = Some(value.into());
1881        self
1882    }
1883
1884    /// Sets the optional `duration` field.
1885    #[must_use]
1886    pub fn with_duration(mut self, value: i32) -> Self {
1887        self.duration = Some(value);
1888        self
1889    }
1890
1891    /// Sets the optional `minChargingRate` field.
1892    #[must_use]
1893    pub fn with_min_charging_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1894        self.min_charging_rate = Some(value.into());
1895        self
1896    }
1897
1898    /// Sets the optional `powerTolerance` field.
1899    #[must_use]
1900    pub fn with_power_tolerance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1901        self.power_tolerance = Some(value.into());
1902        self
1903    }
1904
1905    /// Sets the optional `signatureId` field.
1906    #[must_use]
1907    pub fn with_signature_id(mut self, value: i32) -> Self {
1908        self.signature_id = Some(value);
1909        self
1910    }
1911
1912    /// Sets the optional `digestValue` field.
1913    #[must_use]
1914    pub fn with_digest_value(mut self, value: impl Into<String>) -> Self {
1915        self.digest_value = Some(value.into());
1916        self
1917    }
1918
1919    /// Sets the optional `useLocalTime` field.
1920    #[must_use]
1921    pub fn with_use_local_time(mut self, value: bool) -> Self {
1922        self.use_local_time = Some(value);
1923        self
1924    }
1925
1926    /// Sets the optional `randomizedDelay` field.
1927    #[must_use]
1928    pub fn with_randomized_delay(mut self, value: i32) -> Self {
1929        self.randomized_delay = Some(value);
1930        self
1931    }
1932
1933    /// Sets the optional `salesTariff` field.
1934    #[must_use]
1935    pub fn with_sales_tariff(mut self, value: SalesTariff) -> Self {
1936        self.sales_tariff = Some(value);
1937        self
1938    }
1939
1940    /// Sets the optional `absolutePriceSchedule` field.
1941    #[must_use]
1942    pub fn with_absolute_price_schedule(mut self, value: AbsolutePriceSchedule) -> Self {
1943        self.absolute_price_schedule = Some(value);
1944        self
1945    }
1946
1947    /// Sets the optional `priceLevelSchedule` field.
1948    #[must_use]
1949    pub fn with_price_level_schedule(mut self, value: PriceLevelSchedule) -> Self {
1950        self.price_level_schedule = Some(value);
1951        self
1952    }
1953
1954    /// Sets the optional `customData` field.
1955    #[must_use]
1956    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1957        self.custom_data = Some(value);
1958        self
1959    }
1960}
1961
1962impl Validate for ChargingSchedule {
1963    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1964        path.push_key("chargingRateUnit");
1965        Validate::validate_at(&self.charging_rate_unit, path, out);
1966        path.pop();
1967        path.push_key("chargingSchedulePeriod");
1968        validate::list_len(
1969            self.charging_schedule_period.len(),
1970            Some(1),
1971            Some(1024),
1972            path,
1973            out,
1974        );
1975        for (index, item) in self.charging_schedule_period.iter().enumerate() {
1976            path.push_index(index);
1977            Validate::validate_at(item, path, out);
1978            path.pop();
1979        }
1980        path.pop();
1981        path.push_key("limitAtSoC");
1982        if let Some(value) = &self.limit_at_so_c {
1983            Validate::validate_at(value, path, out);
1984        }
1985        path.pop();
1986        path.push_key("signatureId");
1987        if let Some(value) = &self.signature_id {
1988            validate::int_range(i64::from(*value), Some(0), None, path, out);
1989        }
1990        path.pop();
1991        path.push_key("digestValue");
1992        if let Some(value) = &self.digest_value {
1993            validate::string(value.as_str(), None, Some(88), path, out);
1994        }
1995        path.pop();
1996        path.push_key("randomizedDelay");
1997        if let Some(value) = &self.randomized_delay {
1998            validate::int_range(i64::from(*value), Some(0), None, path, out);
1999        }
2000        path.pop();
2001        path.push_key("salesTariff");
2002        if let Some(value) = &self.sales_tariff {
2003            Validate::validate_at(value, path, out);
2004        }
2005        path.pop();
2006        path.push_key("absolutePriceSchedule");
2007        if let Some(value) = &self.absolute_price_schedule {
2008            Validate::validate_at(value, path, out);
2009        }
2010        path.pop();
2011        path.push_key("priceLevelSchedule");
2012        if let Some(value) = &self.price_level_schedule {
2013            Validate::validate_at(value, path, out);
2014        }
2015        path.pop();
2016        path.push_key("customData");
2017        if let Some(value) = &self.custom_data {
2018            Validate::validate_at(value, path, out);
2019        }
2020        path.pop();
2021    }
2022}
2023
2024/// 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.
2025///
2026/// The OCPP 2.1 `ChargingSchedulePeriod` data type.
2027#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2028pub struct ChargingSchedulePeriod {
2029    /// Start of the period, in seconds from the start of schedule. The value of StartPeriod also defines the stop time of the previous period.
2030    #[serde(rename = "startPeriod")]
2031    #[serde(deserialize_with = "crate::types::integer::one")]
2032    pub start_period: i32,
2033    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2034    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2035    /// 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.
2036    /// 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.
2037    #[serde(default, skip_serializing_if = "Option::is_none")]
2038    pub limit: Option<crate::types::Decimal>,
2039    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2040    #[serde(rename = "limit_L2")]
2041    #[serde(default, skip_serializing_if = "Option::is_none")]
2042    pub limit_l2: Option<crate::types::Decimal>,
2043    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2044    #[serde(rename = "limit_L3")]
2045    #[serde(default, skip_serializing_if = "Option::is_none")]
2046    pub limit_l3: Option<crate::types::Decimal>,
2047    /// The number of phases that can be used for charging. +
2048    /// For a DC EVSE this field should be omitted. +
2049    /// For an AC EVSE a default value of _numberPhases_ = 3 will be assumed if the field is absent.
2050    #[serde(rename = "numberPhases")]
2051    #[serde(default, skip_serializing_if = "Option::is_none")]
2052    #[serde(deserialize_with = "crate::types::integer::option")]
2053    pub number_phases: Option<i32>,
2054    /// 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.
2055    #[serde(rename = "phaseToUse")]
2056    #[serde(default, skip_serializing_if = "Option::is_none")]
2057    #[serde(deserialize_with = "crate::types::integer::option")]
2058    pub phase_to_use: Option<i32>,
2059    /// *(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.  +
2060    /// 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.
2061    #[serde(rename = "dischargeLimit")]
2062    #[serde(default, skip_serializing_if = "Option::is_none")]
2063    pub discharge_limit: Option<crate::types::Decimal>,
2064    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2065    #[serde(rename = "dischargeLimit_L2")]
2066    #[serde(default, skip_serializing_if = "Option::is_none")]
2067    pub discharge_limit_l2: Option<crate::types::Decimal>,
2068    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2069    #[serde(rename = "dischargeLimit_L3")]
2070    #[serde(default, skip_serializing_if = "Option::is_none")]
2071    pub discharge_limit_l3: Option<crate::types::Decimal>,
2072    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2073    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2074    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2075    #[serde(default, skip_serializing_if = "Option::is_none")]
2076    pub setpoint: Option<crate::types::Decimal>,
2077    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2078    #[serde(rename = "setpoint_L2")]
2079    #[serde(default, skip_serializing_if = "Option::is_none")]
2080    pub setpoint_l2: Option<crate::types::Decimal>,
2081    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2082    #[serde(rename = "setpoint_L3")]
2083    #[serde(default, skip_serializing_if = "Option::is_none")]
2084    pub setpoint_l3: Option<crate::types::Decimal>,
2085    /// *(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.  +
2086    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2087    #[serde(rename = "setpointReactive")]
2088    #[serde(default, skip_serializing_if = "Option::is_none")]
2089    pub setpoint_reactive: Option<crate::types::Decimal>,
2090    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2091    #[serde(rename = "setpointReactive_L2")]
2092    #[serde(default, skip_serializing_if = "Option::is_none")]
2093    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2094    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2095    #[serde(rename = "setpointReactive_L3")]
2096    #[serde(default, skip_serializing_if = "Option::is_none")]
2097    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2098    /// *(2.1)* If  true, the EV should attempt to keep the BMS preconditioned for this time interval.
2099    #[serde(rename = "preconditioningRequest")]
2100    #[serde(default, skip_serializing_if = "Option::is_none")]
2101    pub preconditioning_request: Option<bool>,
2102    /// *(2.1)* If true, the EVSE must turn off power electronics/modules associated with this transaction. Default value when absent is false.
2103    #[serde(rename = "evseSleep")]
2104    #[serde(default, skip_serializing_if = "Option::is_none")]
2105    pub evse_sleep: Option<bool>,
2106    /// *(2.1)* Power value that, when present, is used as a baseline on top of which values from _v2xFreqWattCurve_ and _v2xSignalWattCurve_ are added.
2107    #[serde(rename = "v2xBaseline")]
2108    #[serde(default, skip_serializing_if = "Option::is_none")]
2109    pub v2x_baseline: Option<crate::types::Decimal>,
2110    /// The `operationMode` member.
2111    #[serde(rename = "operationMode")]
2112    #[serde(default, skip_serializing_if = "Option::is_none")]
2113    pub operation_mode: Option<OperationMode>,
2114    /// The `v2xFreqWattCurve` member.
2115    #[serde(rename = "v2xFreqWattCurve")]
2116    #[serde(default, skip_serializing_if = "Option::is_none")]
2117    pub v2x_freq_watt_curve: Option<Vec<V2XFreqWattPoint>>,
2118    /// The `v2xSignalWattCurve` member.
2119    #[serde(rename = "v2xSignalWattCurve")]
2120    #[serde(default, skip_serializing_if = "Option::is_none")]
2121    pub v2x_signal_watt_curve: Option<Vec<V2XSignalWattPoint>>,
2122    /// The `customData` member.
2123    #[serde(rename = "customData")]
2124    #[serde(default, skip_serializing_if = "Option::is_none")]
2125    pub custom_data: Option<crate::types::CustomData>,
2126}
2127
2128impl ChargingSchedulePeriod {
2129    /// Creates a `ChargingSchedulePeriod` from its required fields.
2130    #[must_use]
2131    pub fn new(start_period: i32) -> Self {
2132        Self {
2133            start_period,
2134            limit: None,
2135            limit_l2: None,
2136            limit_l3: None,
2137            number_phases: None,
2138            phase_to_use: None,
2139            discharge_limit: None,
2140            discharge_limit_l2: None,
2141            discharge_limit_l3: None,
2142            setpoint: None,
2143            setpoint_l2: None,
2144            setpoint_l3: None,
2145            setpoint_reactive: None,
2146            setpoint_reactive_l2: None,
2147            setpoint_reactive_l3: None,
2148            preconditioning_request: None,
2149            evse_sleep: None,
2150            v2x_baseline: None,
2151            operation_mode: None,
2152            v2x_freq_watt_curve: None,
2153            v2x_signal_watt_curve: None,
2154            custom_data: None,
2155        }
2156    }
2157
2158    /// Sets the optional `limit` field.
2159    #[must_use]
2160    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2161        self.limit = Some(value.into());
2162        self
2163    }
2164
2165    /// Sets the optional `limit_L2` field.
2166    #[must_use]
2167    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2168        self.limit_l2 = Some(value.into());
2169        self
2170    }
2171
2172    /// Sets the optional `limit_L3` field.
2173    #[must_use]
2174    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2175        self.limit_l3 = Some(value.into());
2176        self
2177    }
2178
2179    /// Sets the optional `numberPhases` field.
2180    #[must_use]
2181    pub fn with_number_phases(mut self, value: i32) -> Self {
2182        self.number_phases = Some(value);
2183        self
2184    }
2185
2186    /// Sets the optional `phaseToUse` field.
2187    #[must_use]
2188    pub fn with_phase_to_use(mut self, value: i32) -> Self {
2189        self.phase_to_use = Some(value);
2190        self
2191    }
2192
2193    /// Sets the optional `dischargeLimit` field.
2194    #[must_use]
2195    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2196        self.discharge_limit = Some(value.into());
2197        self
2198    }
2199
2200    /// Sets the optional `dischargeLimit_L2` field.
2201    #[must_use]
2202    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2203        self.discharge_limit_l2 = Some(value.into());
2204        self
2205    }
2206
2207    /// Sets the optional `dischargeLimit_L3` field.
2208    #[must_use]
2209    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2210        self.discharge_limit_l3 = Some(value.into());
2211        self
2212    }
2213
2214    /// Sets the optional `setpoint` field.
2215    #[must_use]
2216    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2217        self.setpoint = Some(value.into());
2218        self
2219    }
2220
2221    /// Sets the optional `setpoint_L2` field.
2222    #[must_use]
2223    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2224        self.setpoint_l2 = Some(value.into());
2225        self
2226    }
2227
2228    /// Sets the optional `setpoint_L3` field.
2229    #[must_use]
2230    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2231        self.setpoint_l3 = Some(value.into());
2232        self
2233    }
2234
2235    /// Sets the optional `setpointReactive` field.
2236    #[must_use]
2237    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2238        self.setpoint_reactive = Some(value.into());
2239        self
2240    }
2241
2242    /// Sets the optional `setpointReactive_L2` field.
2243    #[must_use]
2244    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2245        self.setpoint_reactive_l2 = Some(value.into());
2246        self
2247    }
2248
2249    /// Sets the optional `setpointReactive_L3` field.
2250    #[must_use]
2251    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2252        self.setpoint_reactive_l3 = Some(value.into());
2253        self
2254    }
2255
2256    /// Sets the optional `preconditioningRequest` field.
2257    #[must_use]
2258    pub fn with_preconditioning_request(mut self, value: bool) -> Self {
2259        self.preconditioning_request = Some(value);
2260        self
2261    }
2262
2263    /// Sets the optional `evseSleep` field.
2264    #[must_use]
2265    pub fn with_evse_sleep(mut self, value: bool) -> Self {
2266        self.evse_sleep = Some(value);
2267        self
2268    }
2269
2270    /// Sets the optional `v2xBaseline` field.
2271    #[must_use]
2272    pub fn with_v2x_baseline(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2273        self.v2x_baseline = Some(value.into());
2274        self
2275    }
2276
2277    /// Sets the optional `operationMode` field.
2278    #[must_use]
2279    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
2280        self.operation_mode = Some(value);
2281        self
2282    }
2283
2284    /// Sets the optional `v2xFreqWattCurve` field.
2285    #[must_use]
2286    pub fn with_v2x_freq_watt_curve(mut self, value: Vec<V2XFreqWattPoint>) -> Self {
2287        self.v2x_freq_watt_curve = Some(value);
2288        self
2289    }
2290
2291    /// Sets the optional `v2xSignalWattCurve` field.
2292    #[must_use]
2293    pub fn with_v2x_signal_watt_curve(mut self, value: Vec<V2XSignalWattPoint>) -> Self {
2294        self.v2x_signal_watt_curve = Some(value);
2295        self
2296    }
2297
2298    /// Sets the optional `customData` field.
2299    #[must_use]
2300    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2301        self.custom_data = Some(value);
2302        self
2303    }
2304}
2305
2306impl Validate for ChargingSchedulePeriod {
2307    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2308        path.push_key("numberPhases");
2309        if let Some(value) = &self.number_phases {
2310            validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
2311        }
2312        path.pop();
2313        path.push_key("phaseToUse");
2314        if let Some(value) = &self.phase_to_use {
2315            validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
2316        }
2317        path.pop();
2318        path.push_key("dischargeLimit");
2319        if let Some(value) = &self.discharge_limit {
2320            validate::range(
2321                *value,
2322                None,
2323                Some(crate::types::Decimal::new(0, 0)),
2324                path,
2325                out,
2326            );
2327        }
2328        path.pop();
2329        path.push_key("dischargeLimit_L2");
2330        if let Some(value) = &self.discharge_limit_l2 {
2331            validate::range(
2332                *value,
2333                None,
2334                Some(crate::types::Decimal::new(0, 0)),
2335                path,
2336                out,
2337            );
2338        }
2339        path.pop();
2340        path.push_key("dischargeLimit_L3");
2341        if let Some(value) = &self.discharge_limit_l3 {
2342            validate::range(
2343                *value,
2344                None,
2345                Some(crate::types::Decimal::new(0, 0)),
2346                path,
2347                out,
2348            );
2349        }
2350        path.pop();
2351        path.push_key("operationMode");
2352        if let Some(value) = &self.operation_mode {
2353            Validate::validate_at(value, path, out);
2354        }
2355        path.pop();
2356        path.push_key("v2xFreqWattCurve");
2357        if let Some(value) = &self.v2x_freq_watt_curve {
2358            validate::list_len(value.len(), Some(1), Some(20), path, out);
2359            for (index, item) in value.iter().enumerate() {
2360                path.push_index(index);
2361                Validate::validate_at(item, path, out);
2362                path.pop();
2363            }
2364        }
2365        path.pop();
2366        path.push_key("v2xSignalWattCurve");
2367        if let Some(value) = &self.v2x_signal_watt_curve {
2368            validate::list_len(value.len(), Some(1), Some(20), path, out);
2369            for (index, item) in value.iter().enumerate() {
2370                path.push_index(index);
2371                Validate::validate_at(item, path, out);
2372                path.pop();
2373            }
2374        }
2375        path.pop();
2376        path.push_key("customData");
2377        if let Some(value) = &self.custom_data {
2378            Validate::validate_at(value, path, out);
2379        }
2380        path.pop();
2381    }
2382}
2383
2384/// Updates to a ChargingSchedulePeriodType for dynamic charging profiles.
2385///
2386/// The OCPP 2.1 `ChargingScheduleUpdate` data type.
2387#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2388pub struct ChargingScheduleUpdate {
2389    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2390    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2391    /// 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.
2392    /// 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.
2393    #[serde(default, skip_serializing_if = "Option::is_none")]
2394    pub limit: Option<crate::types::Decimal>,
2395    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2396    #[serde(rename = "limit_L2")]
2397    #[serde(default, skip_serializing_if = "Option::is_none")]
2398    pub limit_l2: Option<crate::types::Decimal>,
2399    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2400    #[serde(rename = "limit_L3")]
2401    #[serde(default, skip_serializing_if = "Option::is_none")]
2402    pub limit_l3: Option<crate::types::Decimal>,
2403    /// *(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.  +
2404    /// 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.
2405    #[serde(rename = "dischargeLimit")]
2406    #[serde(default, skip_serializing_if = "Option::is_none")]
2407    pub discharge_limit: Option<crate::types::Decimal>,
2408    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2409    #[serde(rename = "dischargeLimit_L2")]
2410    #[serde(default, skip_serializing_if = "Option::is_none")]
2411    pub discharge_limit_l2: Option<crate::types::Decimal>,
2412    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2413    #[serde(rename = "dischargeLimit_L3")]
2414    #[serde(default, skip_serializing_if = "Option::is_none")]
2415    pub discharge_limit_l3: Option<crate::types::Decimal>,
2416    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2417    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2418    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2419    #[serde(default, skip_serializing_if = "Option::is_none")]
2420    pub setpoint: Option<crate::types::Decimal>,
2421    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2422    #[serde(rename = "setpoint_L2")]
2423    #[serde(default, skip_serializing_if = "Option::is_none")]
2424    pub setpoint_l2: Option<crate::types::Decimal>,
2425    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2426    #[serde(rename = "setpoint_L3")]
2427    #[serde(default, skip_serializing_if = "Option::is_none")]
2428    pub setpoint_l3: Option<crate::types::Decimal>,
2429    /// *(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.  +
2430    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2431    #[serde(rename = "setpointReactive")]
2432    #[serde(default, skip_serializing_if = "Option::is_none")]
2433    pub setpoint_reactive: Option<crate::types::Decimal>,
2434    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2435    #[serde(rename = "setpointReactive_L2")]
2436    #[serde(default, skip_serializing_if = "Option::is_none")]
2437    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2438    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2439    #[serde(rename = "setpointReactive_L3")]
2440    #[serde(default, skip_serializing_if = "Option::is_none")]
2441    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2442    /// The `customData` member.
2443    #[serde(rename = "customData")]
2444    #[serde(default, skip_serializing_if = "Option::is_none")]
2445    pub custom_data: Option<crate::types::CustomData>,
2446}
2447
2448impl ChargingScheduleUpdate {
2449    /// Creates an empty `ChargingScheduleUpdate`. Every field of this type is optional.
2450    #[must_use]
2451    pub fn new() -> Self {
2452        Self::default()
2453    }
2454
2455    /// Sets the optional `limit` field.
2456    #[must_use]
2457    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2458        self.limit = Some(value.into());
2459        self
2460    }
2461
2462    /// Sets the optional `limit_L2` field.
2463    #[must_use]
2464    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2465        self.limit_l2 = Some(value.into());
2466        self
2467    }
2468
2469    /// Sets the optional `limit_L3` field.
2470    #[must_use]
2471    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2472        self.limit_l3 = Some(value.into());
2473        self
2474    }
2475
2476    /// Sets the optional `dischargeLimit` field.
2477    #[must_use]
2478    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2479        self.discharge_limit = Some(value.into());
2480        self
2481    }
2482
2483    /// Sets the optional `dischargeLimit_L2` field.
2484    #[must_use]
2485    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2486        self.discharge_limit_l2 = Some(value.into());
2487        self
2488    }
2489
2490    /// Sets the optional `dischargeLimit_L3` field.
2491    #[must_use]
2492    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2493        self.discharge_limit_l3 = Some(value.into());
2494        self
2495    }
2496
2497    /// Sets the optional `setpoint` field.
2498    #[must_use]
2499    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2500        self.setpoint = Some(value.into());
2501        self
2502    }
2503
2504    /// Sets the optional `setpoint_L2` field.
2505    #[must_use]
2506    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2507        self.setpoint_l2 = Some(value.into());
2508        self
2509    }
2510
2511    /// Sets the optional `setpoint_L3` field.
2512    #[must_use]
2513    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2514        self.setpoint_l3 = Some(value.into());
2515        self
2516    }
2517
2518    /// Sets the optional `setpointReactive` field.
2519    #[must_use]
2520    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2521        self.setpoint_reactive = Some(value.into());
2522        self
2523    }
2524
2525    /// Sets the optional `setpointReactive_L2` field.
2526    #[must_use]
2527    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2528        self.setpoint_reactive_l2 = Some(value.into());
2529        self
2530    }
2531
2532    /// Sets the optional `setpointReactive_L3` field.
2533    #[must_use]
2534    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2535        self.setpoint_reactive_l3 = Some(value.into());
2536        self
2537    }
2538
2539    /// Sets the optional `customData` field.
2540    #[must_use]
2541    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2542        self.custom_data = Some(value);
2543        self
2544    }
2545}
2546
2547impl Validate for ChargingScheduleUpdate {
2548    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2549        path.push_key("dischargeLimit");
2550        if let Some(value) = &self.discharge_limit {
2551            validate::range(
2552                *value,
2553                None,
2554                Some(crate::types::Decimal::new(0, 0)),
2555                path,
2556                out,
2557            );
2558        }
2559        path.pop();
2560        path.push_key("dischargeLimit_L2");
2561        if let Some(value) = &self.discharge_limit_l2 {
2562            validate::range(
2563                *value,
2564                None,
2565                Some(crate::types::Decimal::new(0, 0)),
2566                path,
2567                out,
2568            );
2569        }
2570        path.pop();
2571        path.push_key("dischargeLimit_L3");
2572        if let Some(value) = &self.discharge_limit_l3 {
2573            validate::range(
2574                *value,
2575                None,
2576                Some(crate::types::Decimal::new(0, 0)),
2577                path,
2578                out,
2579            );
2580        }
2581        path.pop();
2582        path.push_key("customData");
2583        if let Some(value) = &self.custom_data {
2584            Validate::validate_at(value, path, out);
2585        }
2586        path.pop();
2587    }
2588}
2589
2590/// The physical system where an Electrical Vehicle (EV) can be charged.
2591///
2592/// The OCPP 2.1 `ChargingStation` data type.
2593#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2594pub struct ChargingStation {
2595    /// Defines the model of the device.
2596    pub model: String,
2597    /// Identifies the vendor (not necessarily in a unique manner).
2598    #[serde(rename = "vendorName")]
2599    pub vendor_name: String,
2600    /// Vendor-specific device identifier.
2601    #[serde(rename = "serialNumber")]
2602    #[serde(default, skip_serializing_if = "Option::is_none")]
2603    pub serial_number: Option<String>,
2604    /// The `modem` member.
2605    #[serde(default, skip_serializing_if = "Option::is_none")]
2606    pub modem: Option<Modem>,
2607    /// This contains the firmware version of the Charging Station.
2608    #[serde(rename = "firmwareVersion")]
2609    #[serde(default, skip_serializing_if = "Option::is_none")]
2610    pub firmware_version: Option<String>,
2611    /// The `customData` member.
2612    #[serde(rename = "customData")]
2613    #[serde(default, skip_serializing_if = "Option::is_none")]
2614    pub custom_data: Option<crate::types::CustomData>,
2615}
2616
2617impl ChargingStation {
2618    /// Creates a `ChargingStation` from its required fields.
2619    #[must_use]
2620    pub fn new(model: impl Into<String>, vendor_name: impl Into<String>) -> Self {
2621        Self {
2622            model: model.into(),
2623            vendor_name: vendor_name.into(),
2624            serial_number: None,
2625            modem: None,
2626            firmware_version: None,
2627            custom_data: None,
2628        }
2629    }
2630
2631    /// Sets the optional `serialNumber` field.
2632    #[must_use]
2633    pub fn with_serial_number(mut self, value: impl Into<String>) -> Self {
2634        self.serial_number = Some(value.into());
2635        self
2636    }
2637
2638    /// Sets the optional `modem` field.
2639    #[must_use]
2640    pub fn with_modem(mut self, value: Modem) -> Self {
2641        self.modem = Some(value);
2642        self
2643    }
2644
2645    /// Sets the optional `firmwareVersion` field.
2646    #[must_use]
2647    pub fn with_firmware_version(mut self, value: impl Into<String>) -> Self {
2648        self.firmware_version = Some(value.into());
2649        self
2650    }
2651
2652    /// Sets the optional `customData` field.
2653    #[must_use]
2654    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2655        self.custom_data = Some(value);
2656        self
2657    }
2658}
2659
2660impl Validate for ChargingStation {
2661    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2662        path.push_key("model");
2663        validate::string(self.model.as_str(), None, Some(20), path, out);
2664        path.pop();
2665        path.push_key("vendorName");
2666        validate::string(self.vendor_name.as_str(), None, Some(50), path, out);
2667        path.pop();
2668        path.push_key("serialNumber");
2669        if let Some(value) = &self.serial_number {
2670            validate::string(value.as_str(), None, Some(25), path, out);
2671        }
2672        path.pop();
2673        path.push_key("modem");
2674        if let Some(value) = &self.modem {
2675            Validate::validate_at(value, path, out);
2676        }
2677        path.pop();
2678        path.push_key("firmwareVersion");
2679        if let Some(value) = &self.firmware_version {
2680            validate::string(value.as_str(), None, Some(50), path, out);
2681        }
2682        path.pop();
2683        path.push_key("customData");
2684        if let Some(value) = &self.custom_data {
2685            Validate::validate_at(value, path, out);
2686        }
2687        path.pop();
2688    }
2689}
2690
2691/// A ClearChargingProfileType is a filter for charging profiles to be cleared by ClearChargingProfileRequest.
2692///
2693/// The OCPP 2.1 `ClearChargingProfile` data type.
2694#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2695pub struct ClearChargingProfile {
2696    /// 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.
2697    #[serde(rename = "evseId")]
2698    #[serde(default, skip_serializing_if = "Option::is_none")]
2699    #[serde(deserialize_with = "crate::types::integer::option")]
2700    pub evse_id: Option<i32>,
2701    /// The `chargingProfilePurpose` member.
2702    #[serde(rename = "chargingProfilePurpose")]
2703    #[serde(default, skip_serializing_if = "Option::is_none")]
2704    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
2705    /// Specifies the stackLevel for which charging profiles will be cleared, if they meet the other criteria in the request.
2706    #[serde(rename = "stackLevel")]
2707    #[serde(default, skip_serializing_if = "Option::is_none")]
2708    #[serde(deserialize_with = "crate::types::integer::option")]
2709    pub stack_level: Option<i32>,
2710    /// The `customData` member.
2711    #[serde(rename = "customData")]
2712    #[serde(default, skip_serializing_if = "Option::is_none")]
2713    pub custom_data: Option<crate::types::CustomData>,
2714}
2715
2716impl ClearChargingProfile {
2717    /// Creates an empty `ClearChargingProfile`. Every field of this type is optional.
2718    #[must_use]
2719    pub fn new() -> Self {
2720        Self::default()
2721    }
2722
2723    /// Sets the optional `evseId` field.
2724    #[must_use]
2725    pub fn with_evse_id(mut self, value: i32) -> Self {
2726        self.evse_id = Some(value);
2727        self
2728    }
2729
2730    /// Sets the optional `chargingProfilePurpose` field.
2731    #[must_use]
2732    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
2733        self.charging_profile_purpose = Some(value);
2734        self
2735    }
2736
2737    /// Sets the optional `stackLevel` field.
2738    #[must_use]
2739    pub fn with_stack_level(mut self, value: i32) -> Self {
2740        self.stack_level = Some(value);
2741        self
2742    }
2743
2744    /// Sets the optional `customData` field.
2745    #[must_use]
2746    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2747        self.custom_data = Some(value);
2748        self
2749    }
2750}
2751
2752impl Validate for ClearChargingProfile {
2753    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2754        path.push_key("evseId");
2755        if let Some(value) = &self.evse_id {
2756            validate::int_range(i64::from(*value), Some(0), None, path, out);
2757        }
2758        path.pop();
2759        path.push_key("chargingProfilePurpose");
2760        if let Some(value) = &self.charging_profile_purpose {
2761            Validate::validate_at(value, path, out);
2762        }
2763        path.pop();
2764        path.push_key("stackLevel");
2765        if let Some(value) = &self.stack_level {
2766            validate::int_range(i64::from(*value), Some(0), None, path, out);
2767        }
2768        path.pop();
2769        path.push_key("customData");
2770        if let Some(value) = &self.custom_data {
2771            Validate::validate_at(value, path, out);
2772        }
2773        path.pop();
2774    }
2775}
2776
2777/// The OCPP 2.1 `ClearMonitoringResult` data type.
2778#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2779pub struct ClearMonitoringResult {
2780    /// The `status` member.
2781    pub status: ClearMonitoringStatus,
2782    /// Id of the monitor of which a clear was requested.
2783    #[serde(deserialize_with = "crate::types::integer::one")]
2784    pub id: i32,
2785    /// The `statusInfo` member.
2786    #[serde(rename = "statusInfo")]
2787    #[serde(default, skip_serializing_if = "Option::is_none")]
2788    pub status_info: Option<StatusInfo>,
2789    /// The `customData` member.
2790    #[serde(rename = "customData")]
2791    #[serde(default, skip_serializing_if = "Option::is_none")]
2792    pub custom_data: Option<crate::types::CustomData>,
2793}
2794
2795impl ClearMonitoringResult {
2796    /// Creates a `ClearMonitoringResult` from its required fields.
2797    #[must_use]
2798    pub fn new(status: ClearMonitoringStatus, id: i32) -> Self {
2799        Self {
2800            status,
2801            id,
2802            status_info: None,
2803            custom_data: None,
2804        }
2805    }
2806
2807    /// Sets the optional `statusInfo` field.
2808    #[must_use]
2809    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2810        self.status_info = Some(value);
2811        self
2812    }
2813
2814    /// Sets the optional `customData` field.
2815    #[must_use]
2816    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2817        self.custom_data = Some(value);
2818        self
2819    }
2820}
2821
2822impl Validate for ClearMonitoringResult {
2823    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2824        path.push_key("status");
2825        Validate::validate_at(&self.status, path, out);
2826        path.pop();
2827        path.push_key("id");
2828        validate::int_range(i64::from(self.id), Some(0), None, path, out);
2829        path.pop();
2830        path.push_key("statusInfo");
2831        if let Some(value) = &self.status_info {
2832            Validate::validate_at(value, path, out);
2833        }
2834        path.pop();
2835        path.push_key("customData");
2836        if let Some(value) = &self.custom_data {
2837            Validate::validate_at(value, path, out);
2838        }
2839        path.pop();
2840    }
2841}
2842
2843/// The OCPP 2.1 `ClearTariffsResult` data type.
2844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2845pub struct ClearTariffsResult {
2846    /// The `status` member.
2847    pub status: TariffClearStatus,
2848    /// The `statusInfo` member.
2849    #[serde(rename = "statusInfo")]
2850    #[serde(default, skip_serializing_if = "Option::is_none")]
2851    pub status_info: Option<StatusInfo>,
2852    /// Id of tariff for which _status_ is reported. If no tariffs were found, then this field is absent, and _status_ will be `NoTariff`.
2853    #[serde(rename = "tariffId")]
2854    #[serde(default, skip_serializing_if = "Option::is_none")]
2855    pub tariff_id: Option<String>,
2856    /// The `customData` member.
2857    #[serde(rename = "customData")]
2858    #[serde(default, skip_serializing_if = "Option::is_none")]
2859    pub custom_data: Option<crate::types::CustomData>,
2860}
2861
2862impl ClearTariffsResult {
2863    /// Creates a `ClearTariffsResult` from its required fields.
2864    #[must_use]
2865    pub fn new(status: TariffClearStatus) -> Self {
2866        Self {
2867            status,
2868            status_info: None,
2869            tariff_id: None,
2870            custom_data: None,
2871        }
2872    }
2873
2874    /// Sets the optional `statusInfo` field.
2875    #[must_use]
2876    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2877        self.status_info = Some(value);
2878        self
2879    }
2880
2881    /// Sets the optional `tariffId` field.
2882    #[must_use]
2883    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
2884        self.tariff_id = Some(value.into());
2885        self
2886    }
2887
2888    /// Sets the optional `customData` field.
2889    #[must_use]
2890    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2891        self.custom_data = Some(value);
2892        self
2893    }
2894}
2895
2896impl Validate for ClearTariffsResult {
2897    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2898        path.push_key("status");
2899        Validate::validate_at(&self.status, path, out);
2900        path.pop();
2901        path.push_key("statusInfo");
2902        if let Some(value) = &self.status_info {
2903            Validate::validate_at(value, path, out);
2904        }
2905        path.pop();
2906        path.push_key("tariffId");
2907        if let Some(value) = &self.tariff_id {
2908            validate::string(value.as_str(), None, Some(60), path, out);
2909        }
2910        path.pop();
2911        path.push_key("customData");
2912        if let Some(value) = &self.custom_data {
2913            Validate::validate_at(value, path, out);
2914        }
2915        path.pop();
2916    }
2917}
2918
2919/// A physical or logical component
2920///
2921/// The OCPP 2.1 `Component` data type.
2922#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2923pub struct Component {
2924    /// 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.
2925    pub name: String,
2926    /// The `evse` member.
2927    #[serde(default, skip_serializing_if = "Option::is_none")]
2928    pub evse: Option<EVSE>,
2929    /// Name of instance in case the component exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
2930    #[serde(default, skip_serializing_if = "Option::is_none")]
2931    pub instance: Option<String>,
2932    /// The `customData` member.
2933    #[serde(rename = "customData")]
2934    #[serde(default, skip_serializing_if = "Option::is_none")]
2935    pub custom_data: Option<crate::types::CustomData>,
2936}
2937
2938impl Component {
2939    /// Creates a `Component` from its required fields.
2940    #[must_use]
2941    pub fn new(name: impl Into<String>) -> Self {
2942        Self {
2943            name: name.into(),
2944            evse: None,
2945            instance: None,
2946            custom_data: None,
2947        }
2948    }
2949
2950    /// Sets the optional `evse` field.
2951    #[must_use]
2952    pub fn with_evse(mut self, value: EVSE) -> Self {
2953        self.evse = Some(value);
2954        self
2955    }
2956
2957    /// Sets the optional `instance` field.
2958    #[must_use]
2959    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
2960        self.instance = Some(value.into());
2961        self
2962    }
2963
2964    /// Sets the optional `customData` field.
2965    #[must_use]
2966    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2967        self.custom_data = Some(value);
2968        self
2969    }
2970}
2971
2972impl Validate for Component {
2973    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2974        path.push_key("name");
2975        validate::string(self.name.as_str(), None, Some(50), path, out);
2976        path.pop();
2977        path.push_key("evse");
2978        if let Some(value) = &self.evse {
2979            Validate::validate_at(value, path, out);
2980        }
2981        path.pop();
2982        path.push_key("instance");
2983        if let Some(value) = &self.instance {
2984            validate::string(value.as_str(), None, Some(50), path, out);
2985        }
2986        path.pop();
2987        path.push_key("customData");
2988        if let Some(value) = &self.custom_data {
2989            Validate::validate_at(value, path, out);
2990        }
2991        path.pop();
2992    }
2993}
2994
2995/// Class to report components, variables and variable attributes and characteristics.
2996///
2997/// The OCPP 2.1 `ComponentVariable` data type.
2998#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2999pub struct ComponentVariable {
3000    /// The `component` member.
3001    pub component: Component,
3002    /// The `variable` member.
3003    #[serde(default, skip_serializing_if = "Option::is_none")]
3004    pub variable: Option<Variable>,
3005    /// The `customData` member.
3006    #[serde(rename = "customData")]
3007    #[serde(default, skip_serializing_if = "Option::is_none")]
3008    pub custom_data: Option<crate::types::CustomData>,
3009}
3010
3011impl ComponentVariable {
3012    /// Creates a `ComponentVariable` from its required fields.
3013    #[must_use]
3014    pub fn new(component: Component) -> Self {
3015        Self {
3016            component,
3017            variable: None,
3018            custom_data: None,
3019        }
3020    }
3021
3022    /// Sets the optional `variable` field.
3023    #[must_use]
3024    pub fn with_variable(mut self, value: Variable) -> Self {
3025        self.variable = Some(value);
3026        self
3027    }
3028
3029    /// Sets the optional `customData` field.
3030    #[must_use]
3031    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3032        self.custom_data = Some(value);
3033        self
3034    }
3035}
3036
3037impl Validate for ComponentVariable {
3038    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3039        path.push_key("component");
3040        Validate::validate_at(&self.component, path, out);
3041        path.pop();
3042        path.push_key("variable");
3043        if let Some(value) = &self.variable {
3044            Validate::validate_at(value, path, out);
3045        }
3046        path.pop();
3047        path.push_key("customData");
3048        if let Some(value) = &self.custom_data {
3049            Validate::validate_at(value, path, out);
3050        }
3051        path.pop();
3052    }
3053}
3054
3055/// The OCPP 2.1 `CompositeSchedule` data type.
3056#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3057pub struct CompositeSchedule {
3058    /// The `evseId` member.
3059    #[serde(rename = "evseId")]
3060    #[serde(deserialize_with = "crate::types::integer::one")]
3061    pub evse_id: i32,
3062    /// The `duration` member.
3063    #[serde(deserialize_with = "crate::types::integer::one")]
3064    pub duration: i32,
3065    /// The `scheduleStart` member.
3066    #[serde(rename = "scheduleStart")]
3067    pub schedule_start: crate::types::DateTime,
3068    /// The `chargingRateUnit` member.
3069    #[serde(rename = "chargingRateUnit")]
3070    pub charging_rate_unit: ChargingRateUnit,
3071    /// The `chargingSchedulePeriod` member.
3072    #[serde(rename = "chargingSchedulePeriod")]
3073    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
3074    /// The `customData` member.
3075    #[serde(rename = "customData")]
3076    #[serde(default, skip_serializing_if = "Option::is_none")]
3077    pub custom_data: Option<crate::types::CustomData>,
3078}
3079
3080impl CompositeSchedule {
3081    /// Creates a `CompositeSchedule` from its required fields.
3082    #[must_use]
3083    pub fn new(
3084        evse_id: i32,
3085        duration: i32,
3086        schedule_start: impl Into<crate::types::DateTime>,
3087        charging_rate_unit: ChargingRateUnit,
3088        charging_schedule_period: Vec<ChargingSchedulePeriod>,
3089    ) -> Self {
3090        Self {
3091            evse_id,
3092            duration,
3093            schedule_start: schedule_start.into(),
3094            charging_rate_unit,
3095            charging_schedule_period,
3096            custom_data: None,
3097        }
3098    }
3099
3100    /// Sets the optional `customData` field.
3101    #[must_use]
3102    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3103        self.custom_data = Some(value);
3104        self
3105    }
3106}
3107
3108impl Validate for CompositeSchedule {
3109    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3110        path.push_key("evseId");
3111        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
3112        path.pop();
3113        path.push_key("chargingRateUnit");
3114        Validate::validate_at(&self.charging_rate_unit, path, out);
3115        path.pop();
3116        path.push_key("chargingSchedulePeriod");
3117        validate::list_len(
3118            self.charging_schedule_period.len(),
3119            Some(1),
3120            None,
3121            path,
3122            out,
3123        );
3124        for (index, item) in self.charging_schedule_period.iter().enumerate() {
3125            path.push_index(index);
3126            Validate::validate_at(item, path, out);
3127            path.pop();
3128        }
3129        path.pop();
3130        path.push_key("customData");
3131        if let Some(value) = &self.custom_data {
3132            Validate::validate_at(value, path, out);
3133        }
3134        path.pop();
3135    }
3136}
3137
3138/// The OCPP 2.1 `ConstantStreamData` data type.
3139#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3140pub struct ConstantStreamData {
3141    /// Uniquely identifies the stream
3142    #[serde(deserialize_with = "crate::types::integer::one")]
3143    pub id: i32,
3144    /// The `params` member.
3145    pub params: PeriodicEventStreamParams,
3146    /// Id of monitor used to report his event. It can be a preconfigured or hardwired monitor.
3147    #[serde(rename = "variableMonitoringId")]
3148    #[serde(deserialize_with = "crate::types::integer::one")]
3149    pub variable_monitoring_id: i32,
3150    /// The `customData` member.
3151    #[serde(rename = "customData")]
3152    #[serde(default, skip_serializing_if = "Option::is_none")]
3153    pub custom_data: Option<crate::types::CustomData>,
3154}
3155
3156impl ConstantStreamData {
3157    /// Creates a `ConstantStreamData` from its required fields.
3158    #[must_use]
3159    pub fn new(id: i32, params: PeriodicEventStreamParams, variable_monitoring_id: i32) -> Self {
3160        Self {
3161            id,
3162            params,
3163            variable_monitoring_id,
3164            custom_data: None,
3165        }
3166    }
3167
3168    /// Sets the optional `customData` field.
3169    #[must_use]
3170    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3171        self.custom_data = Some(value);
3172        self
3173    }
3174}
3175
3176impl Validate for ConstantStreamData {
3177    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3178        path.push_key("id");
3179        validate::int_range(i64::from(self.id), Some(0), None, path, out);
3180        path.pop();
3181        path.push_key("params");
3182        Validate::validate_at(&self.params, path, out);
3183        path.pop();
3184        path.push_key("variableMonitoringId");
3185        validate::int_range(
3186            i64::from(self.variable_monitoring_id),
3187            Some(0),
3188            None,
3189            path,
3190            out,
3191        );
3192        path.pop();
3193        path.push_key("customData");
3194        if let Some(value) = &self.custom_data {
3195            Validate::validate_at(value, path, out);
3196        }
3197        path.pop();
3198    }
3199}
3200
3201/// The OCPP 2.1 `ConsumptionCost` data type.
3202#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3203pub struct ConsumptionCost {
3204    /// 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.
3205    #[serde(rename = "startValue")]
3206    pub start_value: crate::types::Decimal,
3207    /// The `cost` member.
3208    pub cost: Vec<Cost>,
3209    /// The `customData` member.
3210    #[serde(rename = "customData")]
3211    #[serde(default, skip_serializing_if = "Option::is_none")]
3212    pub custom_data: Option<crate::types::CustomData>,
3213}
3214
3215impl ConsumptionCost {
3216    /// Creates a `ConsumptionCost` from its required fields.
3217    #[must_use]
3218    pub fn new(start_value: impl Into<crate::types::Decimal>, cost: Vec<Cost>) -> Self {
3219        Self {
3220            start_value: start_value.into(),
3221            cost,
3222            custom_data: None,
3223        }
3224    }
3225
3226    /// Sets the optional `customData` field.
3227    #[must_use]
3228    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3229        self.custom_data = Some(value);
3230        self
3231    }
3232}
3233
3234impl Validate for ConsumptionCost {
3235    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3236        path.push_key("cost");
3237        validate::list_len(self.cost.len(), Some(1), Some(3), path, out);
3238        for (index, item) in self.cost.iter().enumerate() {
3239            path.push_index(index);
3240            Validate::validate_at(item, path, out);
3241            path.pop();
3242        }
3243        path.pop();
3244        path.push_key("customData");
3245        if let Some(value) = &self.custom_data {
3246            Validate::validate_at(value, path, out);
3247        }
3248        path.pop();
3249    }
3250}
3251
3252/// The OCPP 2.1 `Cost` data type.
3253#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3254pub struct Cost {
3255    /// The `costKind` member.
3256    #[serde(rename = "costKind")]
3257    pub cost_kind: CostKind,
3258    /// The estimated or actual cost per kWh
3259    #[serde(deserialize_with = "crate::types::integer::one")]
3260    pub amount: i32,
3261    /// Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value is determined by: amount * 10 ^ amountMultiplier
3262    #[serde(rename = "amountMultiplier")]
3263    #[serde(default, skip_serializing_if = "Option::is_none")]
3264    #[serde(deserialize_with = "crate::types::integer::option")]
3265    pub amount_multiplier: Option<i32>,
3266    /// The `customData` member.
3267    #[serde(rename = "customData")]
3268    #[serde(default, skip_serializing_if = "Option::is_none")]
3269    pub custom_data: Option<crate::types::CustomData>,
3270}
3271
3272impl Cost {
3273    /// Creates a `Cost` from its required fields.
3274    #[must_use]
3275    pub fn new(cost_kind: CostKind, amount: i32) -> Self {
3276        Self {
3277            cost_kind,
3278            amount,
3279            amount_multiplier: None,
3280            custom_data: None,
3281        }
3282    }
3283
3284    /// Sets the optional `amountMultiplier` field.
3285    #[must_use]
3286    pub fn with_amount_multiplier(mut self, value: i32) -> Self {
3287        self.amount_multiplier = Some(value);
3288        self
3289    }
3290
3291    /// Sets the optional `customData` field.
3292    #[must_use]
3293    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3294        self.custom_data = Some(value);
3295        self
3296    }
3297}
3298
3299impl Validate for Cost {
3300    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3301        path.push_key("costKind");
3302        Validate::validate_at(&self.cost_kind, path, out);
3303        path.pop();
3304        path.push_key("customData");
3305        if let Some(value) = &self.custom_data {
3306            Validate::validate_at(value, path, out);
3307        }
3308        path.pop();
3309    }
3310}
3311
3312/// CostDetailsType contains the cost as calculated by Charging Station based on provided TariffType.
3313///
3314/// NOTE: Reservation is not shown as a _chargingPeriod_, because it took place outside of the transaction.
3315///
3316/// The OCPP 2.1 `CostDetails` data type.
3317#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3318pub struct CostDetails {
3319    /// The `totalCost` member.
3320    #[serde(rename = "totalCost")]
3321    pub total_cost: TotalCost,
3322    /// The `totalUsage` member.
3323    #[serde(rename = "totalUsage")]
3324    pub total_usage: TotalUsage,
3325    /// The `chargingPeriods` member.
3326    #[serde(rename = "chargingPeriods")]
3327    #[serde(default, skip_serializing_if = "Option::is_none")]
3328    pub charging_periods: Option<Vec<ChargingPeriod>>,
3329    /// If set to true, then Charging Station has failed to calculate the cost.
3330    #[serde(rename = "failureToCalculate")]
3331    #[serde(default, skip_serializing_if = "Option::is_none")]
3332    pub failure_to_calculate: Option<bool>,
3333    /// Optional human-readable reason text in case of failure to calculate.
3334    #[serde(rename = "failureReason")]
3335    #[serde(default, skip_serializing_if = "Option::is_none")]
3336    pub failure_reason: Option<String>,
3337    /// The `customData` member.
3338    #[serde(rename = "customData")]
3339    #[serde(default, skip_serializing_if = "Option::is_none")]
3340    pub custom_data: Option<crate::types::CustomData>,
3341}
3342
3343impl CostDetails {
3344    /// Creates a `CostDetails` from its required fields.
3345    #[must_use]
3346    pub fn new(total_cost: TotalCost, total_usage: TotalUsage) -> Self {
3347        Self {
3348            total_cost,
3349            total_usage,
3350            charging_periods: None,
3351            failure_to_calculate: None,
3352            failure_reason: None,
3353            custom_data: None,
3354        }
3355    }
3356
3357    /// Sets the optional `chargingPeriods` field.
3358    #[must_use]
3359    pub fn with_charging_periods(mut self, value: Vec<ChargingPeriod>) -> Self {
3360        self.charging_periods = Some(value);
3361        self
3362    }
3363
3364    /// Sets the optional `failureToCalculate` field.
3365    #[must_use]
3366    pub fn with_failure_to_calculate(mut self, value: bool) -> Self {
3367        self.failure_to_calculate = Some(value);
3368        self
3369    }
3370
3371    /// Sets the optional `failureReason` field.
3372    #[must_use]
3373    pub fn with_failure_reason(mut self, value: impl Into<String>) -> Self {
3374        self.failure_reason = Some(value.into());
3375        self
3376    }
3377
3378    /// Sets the optional `customData` field.
3379    #[must_use]
3380    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3381        self.custom_data = Some(value);
3382        self
3383    }
3384}
3385
3386impl Validate for CostDetails {
3387    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3388        path.push_key("totalCost");
3389        Validate::validate_at(&self.total_cost, path, out);
3390        path.pop();
3391        path.push_key("totalUsage");
3392        Validate::validate_at(&self.total_usage, path, out);
3393        path.pop();
3394        path.push_key("chargingPeriods");
3395        if let Some(value) = &self.charging_periods {
3396            validate::list_len(value.len(), Some(1), None, path, out);
3397            for (index, item) in value.iter().enumerate() {
3398                path.push_index(index);
3399                Validate::validate_at(item, path, out);
3400                path.pop();
3401            }
3402        }
3403        path.pop();
3404        path.push_key("failureReason");
3405        if let Some(value) = &self.failure_reason {
3406            validate::string(value.as_str(), None, Some(500), path, out);
3407        }
3408        path.pop();
3409        path.push_key("customData");
3410        if let Some(value) = &self.custom_data {
3411            Validate::validate_at(value, path, out);
3412        }
3413        path.pop();
3414    }
3415}
3416
3417/// Volume consumed of cost dimension.
3418///
3419/// The OCPP 2.1 `CostDimension` data type.
3420#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3421pub struct CostDimension {
3422    /// The `type` member.
3423    pub r#type: CostDimensionEnum,
3424    /// Volume of the dimension consumed, measured according to the dimension type.
3425    pub volume: crate::types::Decimal,
3426    /// The `customData` member.
3427    #[serde(rename = "customData")]
3428    #[serde(default, skip_serializing_if = "Option::is_none")]
3429    pub custom_data: Option<crate::types::CustomData>,
3430}
3431
3432impl CostDimension {
3433    /// Creates a `CostDimension` from its required fields.
3434    #[must_use]
3435    pub fn new(r#type: CostDimensionEnum, volume: impl Into<crate::types::Decimal>) -> Self {
3436        Self {
3437            r#type,
3438            volume: volume.into(),
3439            custom_data: None,
3440        }
3441    }
3442
3443    /// Sets the optional `customData` field.
3444    #[must_use]
3445    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3446        self.custom_data = Some(value);
3447        self
3448    }
3449}
3450
3451impl Validate for CostDimension {
3452    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3453        path.push_key("type");
3454        Validate::validate_at(&self.r#type, path, out);
3455        path.pop();
3456        path.push_key("customData");
3457        if let Some(value) = &self.custom_data {
3458            Validate::validate_at(value, path, out);
3459        }
3460        path.pop();
3461    }
3462}
3463
3464/// EV DC charging parameters for ISO 15118-2
3465///
3466/// The OCPP 2.1 `DCChargingParameters` data type.
3467#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3468pub struct DCChargingParameters {
3469    /// Maximum current (in A) supported by the electric vehicle. Includes cable capacity.
3470    /// Relates to: +
3471    /// *ISO 15118-2*: DC_EVChargeParameterType:EVMaximumCurrentLimit
3472    #[serde(rename = "evMaxCurrent")]
3473    pub ev_max_current: crate::types::Decimal,
3474    /// Maximum voltage supported by the electric vehicle.
3475    /// Relates to: +
3476    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumVoltageLimit
3477    #[serde(rename = "evMaxVoltage")]
3478    pub ev_max_voltage: crate::types::Decimal,
3479    /// Maximum power (in W) supported by the electric vehicle. Required for DC charging.
3480    /// Relates to: +
3481    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumPowerLimit
3482    #[serde(rename = "evMaxPower")]
3483    #[serde(default, skip_serializing_if = "Option::is_none")]
3484    pub ev_max_power: Option<crate::types::Decimal>,
3485    /// Capacity of the electric vehicle battery (in Wh).
3486    /// Relates to: +
3487    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyCapacity
3488    #[serde(rename = "evEnergyCapacity")]
3489    #[serde(default, skip_serializing_if = "Option::is_none")]
3490    pub ev_energy_capacity: Option<crate::types::Decimal>,
3491    /// Amount of energy requested (in Wh). This inludes energy required for preconditioning.
3492    /// Relates to: +
3493    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyRequest
3494    #[serde(rename = "energyAmount")]
3495    #[serde(default, skip_serializing_if = "Option::is_none")]
3496    pub energy_amount: Option<crate::types::Decimal>,
3497    /// Energy available in the battery (in percent of the battery capacity)
3498    /// Relates to: +
3499    /// *ISO 15118-2*: DC_EVChargeParameterType: DC_EVStatus: EVRESSSOC
3500    #[serde(rename = "stateOfCharge")]
3501    #[serde(default, skip_serializing_if = "Option::is_none")]
3502    #[serde(deserialize_with = "crate::types::integer::option")]
3503    pub state_of_charge: Option<i32>,
3504    /// Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 - 100)
3505    /// Relates to: +
3506    /// *ISO 15118-2*: DC_EVChargeParameterType: FullSOC
3507    #[serde(rename = "fullSoC")]
3508    #[serde(default, skip_serializing_if = "Option::is_none")]
3509    #[serde(deserialize_with = "crate::types::integer::option")]
3510    pub full_so_c: Option<i32>,
3511    /// Percentage of SoC at which the EV considers a fast charging process to end. (possible values: 0 - 100)
3512    /// Relates to: +
3513    /// *ISO 15118-2*: DC_EVChargeParameterType: BulkSOC
3514    #[serde(rename = "bulkSoC")]
3515    #[serde(default, skip_serializing_if = "Option::is_none")]
3516    #[serde(deserialize_with = "crate::types::integer::option")]
3517    pub bulk_so_c: Option<i32>,
3518    /// The `customData` member.
3519    #[serde(rename = "customData")]
3520    #[serde(default, skip_serializing_if = "Option::is_none")]
3521    pub custom_data: Option<crate::types::CustomData>,
3522}
3523
3524impl DCChargingParameters {
3525    /// Creates a `DCChargingParameters` from its required fields.
3526    #[must_use]
3527    pub fn new(
3528        ev_max_current: impl Into<crate::types::Decimal>,
3529        ev_max_voltage: impl Into<crate::types::Decimal>,
3530    ) -> Self {
3531        Self {
3532            ev_max_current: ev_max_current.into(),
3533            ev_max_voltage: ev_max_voltage.into(),
3534            ev_max_power: None,
3535            ev_energy_capacity: None,
3536            energy_amount: None,
3537            state_of_charge: None,
3538            full_so_c: None,
3539            bulk_so_c: None,
3540            custom_data: None,
3541        }
3542    }
3543
3544    /// Sets the optional `evMaxPower` field.
3545    #[must_use]
3546    pub fn with_ev_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3547        self.ev_max_power = Some(value.into());
3548        self
3549    }
3550
3551    /// Sets the optional `evEnergyCapacity` field.
3552    #[must_use]
3553    pub fn with_ev_energy_capacity(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3554        self.ev_energy_capacity = Some(value.into());
3555        self
3556    }
3557
3558    /// Sets the optional `energyAmount` field.
3559    #[must_use]
3560    pub fn with_energy_amount(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3561        self.energy_amount = Some(value.into());
3562        self
3563    }
3564
3565    /// Sets the optional `stateOfCharge` field.
3566    #[must_use]
3567    pub fn with_state_of_charge(mut self, value: i32) -> Self {
3568        self.state_of_charge = Some(value);
3569        self
3570    }
3571
3572    /// Sets the optional `fullSoC` field.
3573    #[must_use]
3574    pub fn with_full_so_c(mut self, value: i32) -> Self {
3575        self.full_so_c = Some(value);
3576        self
3577    }
3578
3579    /// Sets the optional `bulkSoC` field.
3580    #[must_use]
3581    pub fn with_bulk_so_c(mut self, value: i32) -> Self {
3582        self.bulk_so_c = Some(value);
3583        self
3584    }
3585
3586    /// Sets the optional `customData` field.
3587    #[must_use]
3588    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3589        self.custom_data = Some(value);
3590        self
3591    }
3592}
3593
3594impl Validate for DCChargingParameters {
3595    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3596        path.push_key("stateOfCharge");
3597        if let Some(value) = &self.state_of_charge {
3598            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3599        }
3600        path.pop();
3601        path.push_key("fullSoC");
3602        if let Some(value) = &self.full_so_c {
3603            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3604        }
3605        path.pop();
3606        path.push_key("bulkSoC");
3607        if let Some(value) = &self.bulk_so_c {
3608            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3609        }
3610        path.pop();
3611        path.push_key("customData");
3612        if let Some(value) = &self.custom_data {
3613            Validate::validate_at(value, path, out);
3614        }
3615        path.pop();
3616    }
3617}
3618
3619/// *(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.
3620///
3621/// Fields starting with "ev" contain values from the EV.
3622/// Other fields contain a value that is supported by both EV and EVSE.
3623///
3624/// DERChargingParametersType type is only relevant in case of an ISO 15118-20 AC_BPT_DER/AC_DER charging session.
3625///
3626/// NOTE: All these fields have values greater or equal to zero (i.e. are non-negative)
3627///
3628/// The OCPP 2.1 `DERChargingParameters` data type.
3629#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3630pub struct DERChargingParameters {
3631    /// DER control functions supported by EV. +
3632    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType:DERControlFunctions (bitmap)
3633    #[serde(rename = "evSupportedDERControl")]
3634    #[serde(default, skip_serializing_if = "Option::is_none")]
3635    pub ev_supported_der_control: Option<Vec<DERControl>>,
3636    /// Rated maximum injected active power by EV, at specified over-excited power factor (overExcitedPowerFactor). +
3637    /// 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. +
3638    /// Corresponds to the WOvPF attribute in IEC 61850. +
3639    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedMaximumDischargePower
3640    #[serde(rename = "evOverExcitedMaxDischargePower")]
3641    #[serde(default, skip_serializing_if = "Option::is_none")]
3642    pub ev_over_excited_max_discharge_power: Option<crate::types::Decimal>,
3643    /// EV power factor when injecting (over excited) the minimum reactive power. +
3644    /// Corresponds to the OvPF attribute in IEC 61850. +
3645    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedPowerFactor
3646    #[serde(rename = "evOverExcitedPowerFactor")]
3647    #[serde(default, skip_serializing_if = "Option::is_none")]
3648    pub ev_over_excited_power_factor: Option<crate::types::Decimal>,
3649    /// Rated maximum injected active power by EV supported at specified under-excited power factor (EVUnderExcitedPowerFactor). +
3650    /// It can also be defined as the rated maximum dischargePower at the rated minimum absorbed reactive power value.
3651    /// 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. +
3652    /// This corresponds to the WUnPF attribute in the IEC 61850. +
3653    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedMaximumDischargePower
3654    #[serde(rename = "evUnderExcitedMaxDischargePower")]
3655    #[serde(default, skip_serializing_if = "Option::is_none")]
3656    pub ev_under_excited_max_discharge_power: Option<crate::types::Decimal>,
3657    /// EV power factor when injecting (under excited) the minimum reactive power. +
3658    /// Corresponds to the OvPF attribute in IEC 61850. +
3659    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedPowerFactor
3660    #[serde(rename = "evUnderExcitedPowerFactor")]
3661    #[serde(default, skip_serializing_if = "Option::is_none")]
3662    pub ev_under_excited_power_factor: Option<crate::types::Decimal>,
3663    /// Rated maximum total apparent power, defined by min(EV, EVSE) in va.
3664    /// Corresponds to the VAMaxRtg in IEC 61850. +
3665    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumApparentPower
3666    #[serde(rename = "maxApparentPower")]
3667    #[serde(default, skip_serializing_if = "Option::is_none")]
3668    pub max_apparent_power: Option<crate::types::Decimal>,
3669    /// Rated maximum absorbed apparent power, defined by min(EV, EVSE) in va. +
3670    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3671    ///     in which case this field represents phase L1. +
3672    ///     Corresponds to the ChaVAMaxRtg in IEC 61850. +
3673    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower
3674    #[serde(rename = "maxChargeApparentPower")]
3675    #[serde(default, skip_serializing_if = "Option::is_none")]
3676    pub max_charge_apparent_power: Option<crate::types::Decimal>,
3677    /// Rated maximum absorbed apparent power on phase L2, defined by min(EV, EVSE) in va.
3678    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3679    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L2
3680    #[serde(rename = "maxChargeApparentPower_L2")]
3681    #[serde(default, skip_serializing_if = "Option::is_none")]
3682    pub max_charge_apparent_power_l2: Option<crate::types::Decimal>,
3683    /// Rated maximum absorbed apparent power on phase L3, defined by min(EV, EVSE) in va.
3684    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3685    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L3
3686    #[serde(rename = "maxChargeApparentPower_L3")]
3687    #[serde(default, skip_serializing_if = "Option::is_none")]
3688    pub max_charge_apparent_power_l3: Option<crate::types::Decimal>,
3689    /// Rated maximum injected apparent power, defined by min(EV, EVSE) in va. +
3690    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3691    ///     in which case this field represents phase L1. +
3692    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3693    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower
3694    #[serde(rename = "maxDischargeApparentPower")]
3695    #[serde(default, skip_serializing_if = "Option::is_none")]
3696    pub max_discharge_apparent_power: Option<crate::types::Decimal>,
3697    /// Rated maximum injected apparent power on phase L2, defined by min(EV, EVSE) in va. +
3698    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3699    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L2
3700    #[serde(rename = "maxDischargeApparentPower_L2")]
3701    #[serde(default, skip_serializing_if = "Option::is_none")]
3702    pub max_discharge_apparent_power_l2: Option<crate::types::Decimal>,
3703    /// Rated maximum injected apparent power on phase L3, defined by min(EV, EVSE) in va. +
3704    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3705    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L3
3706    #[serde(rename = "maxDischargeApparentPower_L3")]
3707    #[serde(default, skip_serializing_if = "Option::is_none")]
3708    pub max_discharge_apparent_power_l3: Option<crate::types::Decimal>,
3709    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars. +
3710    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3711    ///     in which case this field represents phase L1. +
3712    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3713    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower
3714    #[serde(rename = "maxChargeReactivePower")]
3715    #[serde(default, skip_serializing_if = "Option::is_none")]
3716    pub max_charge_reactive_power: Option<crate::types::Decimal>,
3717    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3718    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3719    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L2
3720    #[serde(rename = "maxChargeReactivePower_L2")]
3721    #[serde(default, skip_serializing_if = "Option::is_none")]
3722    pub max_charge_reactive_power_l2: Option<crate::types::Decimal>,
3723    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3724    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3725    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L3
3726    #[serde(rename = "maxChargeReactivePower_L3")]
3727    #[serde(default, skip_serializing_if = "Option::is_none")]
3728    pub max_charge_reactive_power_l3: Option<crate::types::Decimal>,
3729    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars. +
3730    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3731    ///     in which case this field represents phase L1. +
3732    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower
3733    #[serde(rename = "minChargeReactivePower")]
3734    #[serde(default, skip_serializing_if = "Option::is_none")]
3735    pub min_charge_reactive_power: Option<crate::types::Decimal>,
3736    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L2. +
3737    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L2
3738    #[serde(rename = "minChargeReactivePower_L2")]
3739    #[serde(default, skip_serializing_if = "Option::is_none")]
3740    pub min_charge_reactive_power_l2: Option<crate::types::Decimal>,
3741    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L3. +
3742    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L3
3743    #[serde(rename = "minChargeReactivePower_L3")]
3744    #[serde(default, skip_serializing_if = "Option::is_none")]
3745    pub min_charge_reactive_power_l3: Option<crate::types::Decimal>,
3746    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars. +
3747    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3748    ///     in which case this field represents phase L1. +
3749    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3750    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower
3751    #[serde(rename = "maxDischargeReactivePower")]
3752    #[serde(default, skip_serializing_if = "Option::is_none")]
3753    pub max_discharge_reactive_power: Option<crate::types::Decimal>,
3754    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3755    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3756    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L2
3757    #[serde(rename = "maxDischargeReactivePower_L2")]
3758    #[serde(default, skip_serializing_if = "Option::is_none")]
3759    pub max_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3760    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3761    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3762    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L3
3763    #[serde(rename = "maxDischargeReactivePower_L3")]
3764    #[serde(default, skip_serializing_if = "Option::is_none")]
3765    pub max_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3766    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in vars. +
3767    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3768    ///     in which case this field represents phase L1. +
3769    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower
3770    #[serde(rename = "minDischargeReactivePower")]
3771    #[serde(default, skip_serializing_if = "Option::is_none")]
3772    pub min_discharge_reactive_power: Option<crate::types::Decimal>,
3773    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L2. +
3774    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L2
3775    #[serde(rename = "minDischargeReactivePower_L2")]
3776    #[serde(default, skip_serializing_if = "Option::is_none")]
3777    pub min_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3778    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L3. +
3779    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L3
3780    #[serde(rename = "minDischargeReactivePower_L3")]
3781    #[serde(default, skip_serializing_if = "Option::is_none")]
3782    pub min_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3783    /// Line voltage supported by EVSE and EV.
3784    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltage
3785    #[serde(rename = "nominalVoltage")]
3786    #[serde(default, skip_serializing_if = "Option::is_none")]
3787    pub nominal_voltage: Option<crate::types::Decimal>,
3788    /// The nominal AC voltage (rms) offset between the Charging Station's electrical connection point and the utility’s point of common coupling. +
3789    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltageOffset
3790    #[serde(rename = "nominalVoltageOffset")]
3791    #[serde(default, skip_serializing_if = "Option::is_none")]
3792    pub nominal_voltage_offset: Option<crate::types::Decimal>,
3793    /// Maximum AC rms voltage, as defined by min(EV, EVSE)  to operate with. +
3794    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumNominalVoltage
3795    #[serde(rename = "maxNominalVoltage")]
3796    #[serde(default, skip_serializing_if = "Option::is_none")]
3797    pub max_nominal_voltage: Option<crate::types::Decimal>,
3798    /// Minimum AC rms voltage, as defined by max(EV, EVSE)  to operate with. +
3799    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumNominalVoltage
3800    #[serde(rename = "minNominalVoltage")]
3801    #[serde(default, skip_serializing_if = "Option::is_none")]
3802    pub min_nominal_voltage: Option<crate::types::Decimal>,
3803    /// Manufacturer of the EV inverter. +
3804    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterManufacturer
3805    #[serde(rename = "evInverterManufacturer")]
3806    #[serde(default, skip_serializing_if = "Option::is_none")]
3807    pub ev_inverter_manufacturer: Option<String>,
3808    /// Model name of the EV inverter. +
3809    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterModel
3810    #[serde(rename = "evInverterModel")]
3811    #[serde(default, skip_serializing_if = "Option::is_none")]
3812    pub ev_inverter_model: Option<String>,
3813    /// Serial number of the EV inverter. +
3814    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSerialNumber
3815    #[serde(rename = "evInverterSerialNumber")]
3816    #[serde(default, skip_serializing_if = "Option::is_none")]
3817    pub ev_inverter_serial_number: Option<String>,
3818    /// Software version of EV inverter. +
3819    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSwVersion
3820    #[serde(rename = "evInverterSwVersion")]
3821    #[serde(default, skip_serializing_if = "Option::is_none")]
3822    pub ev_inverter_sw_version: Option<String>,
3823    /// Hardware version of EV inverter. +
3824    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterHwVersion
3825    #[serde(rename = "evInverterHwVersion")]
3826    #[serde(default, skip_serializing_if = "Option::is_none")]
3827    pub ev_inverter_hw_version: Option<String>,
3828    /// Type of islanding detection method. Only mandatory when islanding detection is required at the site, as set in the ISO 15118 Service Details configuration. +
3829    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingDetectionMethod
3830    #[serde(rename = "evIslandingDetectionMethod")]
3831    #[serde(default, skip_serializing_if = "Option::is_none")]
3832    pub ev_islanding_detection_method: Option<Vec<IslandingDetection>>,
3833    /// Time after which EV will trip if an island has been detected. +
3834    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingTripTime
3835    #[serde(rename = "evIslandingTripTime")]
3836    #[serde(default, skip_serializing_if = "Option::is_none")]
3837    pub ev_islanding_trip_time: Option<crate::types::Decimal>,
3838    /// Maximum injected DC current allowed at level 1 charging. +
3839    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel1DCInjection
3840    #[serde(rename = "evMaximumLevel1DCInjection")]
3841    #[serde(default, skip_serializing_if = "Option::is_none")]
3842    pub ev_maximum_level1_dc_injection: Option<crate::types::Decimal>,
3843    /// Maximum allowed duration of DC injection at level 1 charging. +
3844    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel1DCInjection
3845    #[serde(rename = "evDurationLevel1DCInjection")]
3846    #[serde(default, skip_serializing_if = "Option::is_none")]
3847    pub ev_duration_level1_dc_injection: Option<crate::types::Decimal>,
3848    /// Maximum injected DC current allowed at level 2 charging. +
3849    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel2DCInjection
3850    #[serde(rename = "evMaximumLevel2DCInjection")]
3851    #[serde(default, skip_serializing_if = "Option::is_none")]
3852    pub ev_maximum_level2_dc_injection: Option<crate::types::Decimal>,
3853    /// Maximum allowed duration of DC injection at level 2 charging. +
3854    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel2DCInjection
3855    #[serde(rename = "evDurationLevel2DCInjection")]
3856    #[serde(default, skip_serializing_if = "Option::is_none")]
3857    pub ev_duration_level2_dc_injection: Option<crate::types::Decimal>,
3858    ///     Measure of the susceptibility of the circuit to reactance, in Siemens (S). +
3859    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVReactiveSusceptance
3860    #[serde(rename = "evReactiveSusceptance")]
3861    #[serde(default, skip_serializing_if = "Option::is_none")]
3862    pub ev_reactive_susceptance: Option<crate::types::Decimal>,
3863    /// 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.
3864    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVSessionTotalDischargeEnergyAvailable
3865    #[serde(rename = "evSessionTotalDischargeEnergyAvailable")]
3866    #[serde(default, skip_serializing_if = "Option::is_none")]
3867    pub ev_session_total_discharge_energy_available: Option<crate::types::Decimal>,
3868    /// The `customData` member.
3869    #[serde(rename = "customData")]
3870    #[serde(default, skip_serializing_if = "Option::is_none")]
3871    pub custom_data: Option<crate::types::CustomData>,
3872}
3873
3874impl DERChargingParameters {
3875    /// Creates an empty `DERChargingParameters`. Every field of this type is optional.
3876    #[must_use]
3877    pub fn new() -> Self {
3878        Self::default()
3879    }
3880
3881    /// Sets the optional `evSupportedDERControl` field.
3882    #[must_use]
3883    pub fn with_ev_supported_der_control(mut self, value: Vec<DERControl>) -> Self {
3884        self.ev_supported_der_control = Some(value);
3885        self
3886    }
3887
3888    /// Sets the optional `evOverExcitedMaxDischargePower` field.
3889    #[must_use]
3890    pub fn with_ev_over_excited_max_discharge_power(
3891        mut self,
3892        value: impl Into<crate::types::Decimal>,
3893    ) -> Self {
3894        self.ev_over_excited_max_discharge_power = Some(value.into());
3895        self
3896    }
3897
3898    /// Sets the optional `evOverExcitedPowerFactor` field.
3899    #[must_use]
3900    pub fn with_ev_over_excited_power_factor(
3901        mut self,
3902        value: impl Into<crate::types::Decimal>,
3903    ) -> Self {
3904        self.ev_over_excited_power_factor = Some(value.into());
3905        self
3906    }
3907
3908    /// Sets the optional `evUnderExcitedMaxDischargePower` field.
3909    #[must_use]
3910    pub fn with_ev_under_excited_max_discharge_power(
3911        mut self,
3912        value: impl Into<crate::types::Decimal>,
3913    ) -> Self {
3914        self.ev_under_excited_max_discharge_power = Some(value.into());
3915        self
3916    }
3917
3918    /// Sets the optional `evUnderExcitedPowerFactor` field.
3919    #[must_use]
3920    pub fn with_ev_under_excited_power_factor(
3921        mut self,
3922        value: impl Into<crate::types::Decimal>,
3923    ) -> Self {
3924        self.ev_under_excited_power_factor = Some(value.into());
3925        self
3926    }
3927
3928    /// Sets the optional `maxApparentPower` field.
3929    #[must_use]
3930    pub fn with_max_apparent_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3931        self.max_apparent_power = Some(value.into());
3932        self
3933    }
3934
3935    /// Sets the optional `maxChargeApparentPower` field.
3936    #[must_use]
3937    pub fn with_max_charge_apparent_power(
3938        mut self,
3939        value: impl Into<crate::types::Decimal>,
3940    ) -> Self {
3941        self.max_charge_apparent_power = Some(value.into());
3942        self
3943    }
3944
3945    /// Sets the optional `maxChargeApparentPower_L2` field.
3946    #[must_use]
3947    pub fn with_max_charge_apparent_power_l2(
3948        mut self,
3949        value: impl Into<crate::types::Decimal>,
3950    ) -> Self {
3951        self.max_charge_apparent_power_l2 = Some(value.into());
3952        self
3953    }
3954
3955    /// Sets the optional `maxChargeApparentPower_L3` field.
3956    #[must_use]
3957    pub fn with_max_charge_apparent_power_l3(
3958        mut self,
3959        value: impl Into<crate::types::Decimal>,
3960    ) -> Self {
3961        self.max_charge_apparent_power_l3 = Some(value.into());
3962        self
3963    }
3964
3965    /// Sets the optional `maxDischargeApparentPower` field.
3966    #[must_use]
3967    pub fn with_max_discharge_apparent_power(
3968        mut self,
3969        value: impl Into<crate::types::Decimal>,
3970    ) -> Self {
3971        self.max_discharge_apparent_power = Some(value.into());
3972        self
3973    }
3974
3975    /// Sets the optional `maxDischargeApparentPower_L2` field.
3976    #[must_use]
3977    pub fn with_max_discharge_apparent_power_l2(
3978        mut self,
3979        value: impl Into<crate::types::Decimal>,
3980    ) -> Self {
3981        self.max_discharge_apparent_power_l2 = Some(value.into());
3982        self
3983    }
3984
3985    /// Sets the optional `maxDischargeApparentPower_L3` field.
3986    #[must_use]
3987    pub fn with_max_discharge_apparent_power_l3(
3988        mut self,
3989        value: impl Into<crate::types::Decimal>,
3990    ) -> Self {
3991        self.max_discharge_apparent_power_l3 = Some(value.into());
3992        self
3993    }
3994
3995    /// Sets the optional `maxChargeReactivePower` field.
3996    #[must_use]
3997    pub fn with_max_charge_reactive_power(
3998        mut self,
3999        value: impl Into<crate::types::Decimal>,
4000    ) -> Self {
4001        self.max_charge_reactive_power = Some(value.into());
4002        self
4003    }
4004
4005    /// Sets the optional `maxChargeReactivePower_L2` field.
4006    #[must_use]
4007    pub fn with_max_charge_reactive_power_l2(
4008        mut self,
4009        value: impl Into<crate::types::Decimal>,
4010    ) -> Self {
4011        self.max_charge_reactive_power_l2 = Some(value.into());
4012        self
4013    }
4014
4015    /// Sets the optional `maxChargeReactivePower_L3` field.
4016    #[must_use]
4017    pub fn with_max_charge_reactive_power_l3(
4018        mut self,
4019        value: impl Into<crate::types::Decimal>,
4020    ) -> Self {
4021        self.max_charge_reactive_power_l3 = Some(value.into());
4022        self
4023    }
4024
4025    /// Sets the optional `minChargeReactivePower` field.
4026    #[must_use]
4027    pub fn with_min_charge_reactive_power(
4028        mut self,
4029        value: impl Into<crate::types::Decimal>,
4030    ) -> Self {
4031        self.min_charge_reactive_power = Some(value.into());
4032        self
4033    }
4034
4035    /// Sets the optional `minChargeReactivePower_L2` field.
4036    #[must_use]
4037    pub fn with_min_charge_reactive_power_l2(
4038        mut self,
4039        value: impl Into<crate::types::Decimal>,
4040    ) -> Self {
4041        self.min_charge_reactive_power_l2 = Some(value.into());
4042        self
4043    }
4044
4045    /// Sets the optional `minChargeReactivePower_L3` field.
4046    #[must_use]
4047    pub fn with_min_charge_reactive_power_l3(
4048        mut self,
4049        value: impl Into<crate::types::Decimal>,
4050    ) -> Self {
4051        self.min_charge_reactive_power_l3 = Some(value.into());
4052        self
4053    }
4054
4055    /// Sets the optional `maxDischargeReactivePower` field.
4056    #[must_use]
4057    pub fn with_max_discharge_reactive_power(
4058        mut self,
4059        value: impl Into<crate::types::Decimal>,
4060    ) -> Self {
4061        self.max_discharge_reactive_power = Some(value.into());
4062        self
4063    }
4064
4065    /// Sets the optional `maxDischargeReactivePower_L2` field.
4066    #[must_use]
4067    pub fn with_max_discharge_reactive_power_l2(
4068        mut self,
4069        value: impl Into<crate::types::Decimal>,
4070    ) -> Self {
4071        self.max_discharge_reactive_power_l2 = Some(value.into());
4072        self
4073    }
4074
4075    /// Sets the optional `maxDischargeReactivePower_L3` field.
4076    #[must_use]
4077    pub fn with_max_discharge_reactive_power_l3(
4078        mut self,
4079        value: impl Into<crate::types::Decimal>,
4080    ) -> Self {
4081        self.max_discharge_reactive_power_l3 = Some(value.into());
4082        self
4083    }
4084
4085    /// Sets the optional `minDischargeReactivePower` field.
4086    #[must_use]
4087    pub fn with_min_discharge_reactive_power(
4088        mut self,
4089        value: impl Into<crate::types::Decimal>,
4090    ) -> Self {
4091        self.min_discharge_reactive_power = Some(value.into());
4092        self
4093    }
4094
4095    /// Sets the optional `minDischargeReactivePower_L2` field.
4096    #[must_use]
4097    pub fn with_min_discharge_reactive_power_l2(
4098        mut self,
4099        value: impl Into<crate::types::Decimal>,
4100    ) -> Self {
4101        self.min_discharge_reactive_power_l2 = Some(value.into());
4102        self
4103    }
4104
4105    /// Sets the optional `minDischargeReactivePower_L3` field.
4106    #[must_use]
4107    pub fn with_min_discharge_reactive_power_l3(
4108        mut self,
4109        value: impl Into<crate::types::Decimal>,
4110    ) -> Self {
4111        self.min_discharge_reactive_power_l3 = Some(value.into());
4112        self
4113    }
4114
4115    /// Sets the optional `nominalVoltage` field.
4116    #[must_use]
4117    pub fn with_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4118        self.nominal_voltage = Some(value.into());
4119        self
4120    }
4121
4122    /// Sets the optional `nominalVoltageOffset` field.
4123    #[must_use]
4124    pub fn with_nominal_voltage_offset(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4125        self.nominal_voltage_offset = Some(value.into());
4126        self
4127    }
4128
4129    /// Sets the optional `maxNominalVoltage` field.
4130    #[must_use]
4131    pub fn with_max_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4132        self.max_nominal_voltage = Some(value.into());
4133        self
4134    }
4135
4136    /// Sets the optional `minNominalVoltage` field.
4137    #[must_use]
4138    pub fn with_min_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4139        self.min_nominal_voltage = Some(value.into());
4140        self
4141    }
4142
4143    /// Sets the optional `evInverterManufacturer` field.
4144    #[must_use]
4145    pub fn with_ev_inverter_manufacturer(mut self, value: impl Into<String>) -> Self {
4146        self.ev_inverter_manufacturer = Some(value.into());
4147        self
4148    }
4149
4150    /// Sets the optional `evInverterModel` field.
4151    #[must_use]
4152    pub fn with_ev_inverter_model(mut self, value: impl Into<String>) -> Self {
4153        self.ev_inverter_model = Some(value.into());
4154        self
4155    }
4156
4157    /// Sets the optional `evInverterSerialNumber` field.
4158    #[must_use]
4159    pub fn with_ev_inverter_serial_number(mut self, value: impl Into<String>) -> Self {
4160        self.ev_inverter_serial_number = Some(value.into());
4161        self
4162    }
4163
4164    /// Sets the optional `evInverterSwVersion` field.
4165    #[must_use]
4166    pub fn with_ev_inverter_sw_version(mut self, value: impl Into<String>) -> Self {
4167        self.ev_inverter_sw_version = Some(value.into());
4168        self
4169    }
4170
4171    /// Sets the optional `evInverterHwVersion` field.
4172    #[must_use]
4173    pub fn with_ev_inverter_hw_version(mut self, value: impl Into<String>) -> Self {
4174        self.ev_inverter_hw_version = Some(value.into());
4175        self
4176    }
4177
4178    /// Sets the optional `evIslandingDetectionMethod` field.
4179    #[must_use]
4180    pub fn with_ev_islanding_detection_method(mut self, value: Vec<IslandingDetection>) -> Self {
4181        self.ev_islanding_detection_method = Some(value);
4182        self
4183    }
4184
4185    /// Sets the optional `evIslandingTripTime` field.
4186    #[must_use]
4187    pub fn with_ev_islanding_trip_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4188        self.ev_islanding_trip_time = Some(value.into());
4189        self
4190    }
4191
4192    /// Sets the optional `evMaximumLevel1DCInjection` field.
4193    #[must_use]
4194    pub fn with_ev_maximum_level1_dc_injection(
4195        mut self,
4196        value: impl Into<crate::types::Decimal>,
4197    ) -> Self {
4198        self.ev_maximum_level1_dc_injection = Some(value.into());
4199        self
4200    }
4201
4202    /// Sets the optional `evDurationLevel1DCInjection` field.
4203    #[must_use]
4204    pub fn with_ev_duration_level1_dc_injection(
4205        mut self,
4206        value: impl Into<crate::types::Decimal>,
4207    ) -> Self {
4208        self.ev_duration_level1_dc_injection = Some(value.into());
4209        self
4210    }
4211
4212    /// Sets the optional `evMaximumLevel2DCInjection` field.
4213    #[must_use]
4214    pub fn with_ev_maximum_level2_dc_injection(
4215        mut self,
4216        value: impl Into<crate::types::Decimal>,
4217    ) -> Self {
4218        self.ev_maximum_level2_dc_injection = Some(value.into());
4219        self
4220    }
4221
4222    /// Sets the optional `evDurationLevel2DCInjection` field.
4223    #[must_use]
4224    pub fn with_ev_duration_level2_dc_injection(
4225        mut self,
4226        value: impl Into<crate::types::Decimal>,
4227    ) -> Self {
4228        self.ev_duration_level2_dc_injection = Some(value.into());
4229        self
4230    }
4231
4232    /// Sets the optional `evReactiveSusceptance` field.
4233    #[must_use]
4234    pub fn with_ev_reactive_susceptance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4235        self.ev_reactive_susceptance = Some(value.into());
4236        self
4237    }
4238
4239    /// Sets the optional `evSessionTotalDischargeEnergyAvailable` field.
4240    #[must_use]
4241    pub fn with_ev_session_total_discharge_energy_available(
4242        mut self,
4243        value: impl Into<crate::types::Decimal>,
4244    ) -> Self {
4245        self.ev_session_total_discharge_energy_available = Some(value.into());
4246        self
4247    }
4248
4249    /// Sets the optional `customData` field.
4250    #[must_use]
4251    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4252        self.custom_data = Some(value);
4253        self
4254    }
4255}
4256
4257impl Validate for DERChargingParameters {
4258    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4259        path.push_key("evSupportedDERControl");
4260        if let Some(value) = &self.ev_supported_der_control {
4261            validate::list_len(value.len(), Some(1), None, path, out);
4262            for (index, item) in value.iter().enumerate() {
4263                path.push_index(index);
4264                Validate::validate_at(item, path, out);
4265                path.pop();
4266            }
4267        }
4268        path.pop();
4269        path.push_key("evInverterManufacturer");
4270        if let Some(value) = &self.ev_inverter_manufacturer {
4271            validate::string(value.as_str(), None, Some(50), path, out);
4272        }
4273        path.pop();
4274        path.push_key("evInverterModel");
4275        if let Some(value) = &self.ev_inverter_model {
4276            validate::string(value.as_str(), None, Some(50), path, out);
4277        }
4278        path.pop();
4279        path.push_key("evInverterSerialNumber");
4280        if let Some(value) = &self.ev_inverter_serial_number {
4281            validate::string(value.as_str(), None, Some(50), path, out);
4282        }
4283        path.pop();
4284        path.push_key("evInverterSwVersion");
4285        if let Some(value) = &self.ev_inverter_sw_version {
4286            validate::string(value.as_str(), None, Some(50), path, out);
4287        }
4288        path.pop();
4289        path.push_key("evInverterHwVersion");
4290        if let Some(value) = &self.ev_inverter_hw_version {
4291            validate::string(value.as_str(), None, Some(50), path, out);
4292        }
4293        path.pop();
4294        path.push_key("evIslandingDetectionMethod");
4295        if let Some(value) = &self.ev_islanding_detection_method {
4296            validate::list_len(value.len(), Some(1), None, path, out);
4297            for (index, item) in value.iter().enumerate() {
4298                path.push_index(index);
4299                Validate::validate_at(item, path, out);
4300                path.pop();
4301            }
4302        }
4303        path.pop();
4304        path.push_key("customData");
4305        if let Some(value) = &self.custom_data {
4306            Validate::validate_at(value, path, out);
4307        }
4308        path.pop();
4309    }
4310}
4311
4312/// The OCPP 2.1 `DERCurve` data type.
4313#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4314pub struct DERCurve {
4315    /// The `curveData` member.
4316    #[serde(rename = "curveData")]
4317    pub curve_data: Vec<DERCurvePoints>,
4318    /// Priority of curve (0=highest)
4319    #[serde(deserialize_with = "crate::types::integer::one")]
4320    pub priority: i32,
4321    /// The `yUnit` member.
4322    #[serde(rename = "yUnit")]
4323    pub y_unit: DERUnit,
4324    /// The `hysteresis` member.
4325    #[serde(default, skip_serializing_if = "Option::is_none")]
4326    pub hysteresis: Option<Hysteresis>,
4327    /// The `reactivePowerParams` member.
4328    #[serde(rename = "reactivePowerParams")]
4329    #[serde(default, skip_serializing_if = "Option::is_none")]
4330    pub reactive_power_params: Option<ReactivePowerParams>,
4331    /// The `voltageParams` member.
4332    #[serde(rename = "voltageParams")]
4333    #[serde(default, skip_serializing_if = "Option::is_none")]
4334    pub voltage_params: Option<VoltageParams>,
4335    /// 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.
4336    #[serde(rename = "responseTime")]
4337    #[serde(default, skip_serializing_if = "Option::is_none")]
4338    pub response_time: Option<crate::types::Decimal>,
4339    /// Point in time when this curve will become activated. Only absent when _default_ is true.
4340    #[serde(rename = "startTime")]
4341    #[serde(default, skip_serializing_if = "Option::is_none")]
4342    pub start_time: Option<crate::types::DateTime>,
4343    /// Duration in seconds that this curve will be active. Only absent when _default_ is true.
4344    #[serde(default, skip_serializing_if = "Option::is_none")]
4345    pub duration: Option<crate::types::Decimal>,
4346    /// The `customData` member.
4347    #[serde(rename = "customData")]
4348    #[serde(default, skip_serializing_if = "Option::is_none")]
4349    pub custom_data: Option<crate::types::CustomData>,
4350}
4351
4352impl DERCurve {
4353    /// Creates a `DERCurve` from its required fields.
4354    #[must_use]
4355    pub fn new(curve_data: Vec<DERCurvePoints>, priority: i32, y_unit: DERUnit) -> Self {
4356        Self {
4357            curve_data,
4358            priority,
4359            y_unit,
4360            hysteresis: None,
4361            reactive_power_params: None,
4362            voltage_params: None,
4363            response_time: None,
4364            start_time: None,
4365            duration: None,
4366            custom_data: None,
4367        }
4368    }
4369
4370    /// Sets the optional `hysteresis` field.
4371    #[must_use]
4372    pub fn with_hysteresis(mut self, value: Hysteresis) -> Self {
4373        self.hysteresis = Some(value);
4374        self
4375    }
4376
4377    /// Sets the optional `reactivePowerParams` field.
4378    #[must_use]
4379    pub fn with_reactive_power_params(mut self, value: ReactivePowerParams) -> Self {
4380        self.reactive_power_params = Some(value);
4381        self
4382    }
4383
4384    /// Sets the optional `voltageParams` field.
4385    #[must_use]
4386    pub fn with_voltage_params(mut self, value: VoltageParams) -> Self {
4387        self.voltage_params = Some(value);
4388        self
4389    }
4390
4391    /// Sets the optional `responseTime` field.
4392    #[must_use]
4393    pub fn with_response_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4394        self.response_time = Some(value.into());
4395        self
4396    }
4397
4398    /// Sets the optional `startTime` field.
4399    #[must_use]
4400    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
4401        self.start_time = Some(value.into());
4402        self
4403    }
4404
4405    /// Sets the optional `duration` field.
4406    #[must_use]
4407    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4408        self.duration = Some(value.into());
4409        self
4410    }
4411
4412    /// Sets the optional `customData` field.
4413    #[must_use]
4414    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4415        self.custom_data = Some(value);
4416        self
4417    }
4418}
4419
4420impl Validate for DERCurve {
4421    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4422        path.push_key("curveData");
4423        validate::list_len(self.curve_data.len(), Some(1), Some(10), path, out);
4424        for (index, item) in self.curve_data.iter().enumerate() {
4425            path.push_index(index);
4426            Validate::validate_at(item, path, out);
4427            path.pop();
4428        }
4429        path.pop();
4430        path.push_key("priority");
4431        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
4432        path.pop();
4433        path.push_key("yUnit");
4434        Validate::validate_at(&self.y_unit, path, out);
4435        path.pop();
4436        path.push_key("hysteresis");
4437        if let Some(value) = &self.hysteresis {
4438            Validate::validate_at(value, path, out);
4439        }
4440        path.pop();
4441        path.push_key("reactivePowerParams");
4442        if let Some(value) = &self.reactive_power_params {
4443            Validate::validate_at(value, path, out);
4444        }
4445        path.pop();
4446        path.push_key("voltageParams");
4447        if let Some(value) = &self.voltage_params {
4448            Validate::validate_at(value, path, out);
4449        }
4450        path.pop();
4451        path.push_key("customData");
4452        if let Some(value) = &self.custom_data {
4453            Validate::validate_at(value, path, out);
4454        }
4455        path.pop();
4456    }
4457}
4458
4459/// The OCPP 2.1 `DERCurveGet` data type.
4460#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4461pub struct DERCurveGet {
4462    /// The `curve` member.
4463    pub curve: DERCurve,
4464    /// Id of DER curve
4465    pub id: String,
4466    /// The `curveType` member.
4467    #[serde(rename = "curveType")]
4468    pub curve_type: DERControl,
4469    /// True if this is a default curve
4470    #[serde(rename = "isDefault")]
4471    pub is_default: bool,
4472    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
4473    #[serde(rename = "isSuperseded")]
4474    pub is_superseded: bool,
4475    /// The `customData` member.
4476    #[serde(rename = "customData")]
4477    #[serde(default, skip_serializing_if = "Option::is_none")]
4478    pub custom_data: Option<crate::types::CustomData>,
4479}
4480
4481impl DERCurveGet {
4482    /// Creates a `DERCurveGet` from its required fields.
4483    #[must_use]
4484    pub fn new(
4485        curve: DERCurve,
4486        id: impl Into<String>,
4487        curve_type: DERControl,
4488        is_default: bool,
4489        is_superseded: bool,
4490    ) -> Self {
4491        Self {
4492            curve,
4493            id: id.into(),
4494            curve_type,
4495            is_default,
4496            is_superseded,
4497            custom_data: None,
4498        }
4499    }
4500
4501    /// Sets the optional `customData` field.
4502    #[must_use]
4503    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4504        self.custom_data = Some(value);
4505        self
4506    }
4507}
4508
4509impl Validate for DERCurveGet {
4510    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4511        path.push_key("curve");
4512        Validate::validate_at(&self.curve, path, out);
4513        path.pop();
4514        path.push_key("id");
4515        validate::string(self.id.as_str(), None, Some(36), path, out);
4516        path.pop();
4517        path.push_key("curveType");
4518        Validate::validate_at(&self.curve_type, path, out);
4519        path.pop();
4520        path.push_key("customData");
4521        if let Some(value) = &self.custom_data {
4522            Validate::validate_at(value, path, out);
4523        }
4524        path.pop();
4525    }
4526}
4527
4528/// The OCPP 2.1 `DERCurvePoints` data type.
4529#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4530pub struct DERCurvePoints {
4531    /// The data value of the X-axis (independent) variable, depending on the curve type.
4532    pub x: crate::types::Decimal,
4533    /// 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).
4534    pub y: crate::types::Decimal,
4535    /// The `customData` member.
4536    #[serde(rename = "customData")]
4537    #[serde(default, skip_serializing_if = "Option::is_none")]
4538    pub custom_data: Option<crate::types::CustomData>,
4539}
4540
4541impl DERCurvePoints {
4542    /// Creates a `DERCurvePoints` from its required fields.
4543    #[must_use]
4544    pub fn new(x: impl Into<crate::types::Decimal>, y: impl Into<crate::types::Decimal>) -> Self {
4545        Self {
4546            x: x.into(),
4547            y: y.into(),
4548            custom_data: None,
4549        }
4550    }
4551
4552    /// Sets the optional `customData` field.
4553    #[must_use]
4554    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4555        self.custom_data = Some(value);
4556        self
4557    }
4558}
4559
4560impl Validate for DERCurvePoints {
4561    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4562        path.push_key("customData");
4563        if let Some(value) = &self.custom_data {
4564            Validate::validate_at(value, path, out);
4565        }
4566        path.pop();
4567    }
4568}
4569
4570/// *(2.1)* Price schedule of EV energy offer.
4571///
4572/// The OCPP 2.1 `EVAbsolutePriceSchedule` data type.
4573#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4574pub struct EVAbsolutePriceSchedule {
4575    /// Starting point in time of the EVEnergyOffer.
4576    #[serde(rename = "timeAnchor")]
4577    pub time_anchor: crate::types::DateTime,
4578    /// Currency code according to ISO 4217.
4579    pub currency: String,
4580    /// The `evAbsolutePriceScheduleEntries` member.
4581    #[serde(rename = "evAbsolutePriceScheduleEntries")]
4582    pub ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4583    /// ISO 15118-20 URN of price algorithm: Power, PeakPower, StackedEnergy.
4584    #[serde(rename = "priceAlgorithm")]
4585    pub price_algorithm: String,
4586    /// The `customData` member.
4587    #[serde(rename = "customData")]
4588    #[serde(default, skip_serializing_if = "Option::is_none")]
4589    pub custom_data: Option<crate::types::CustomData>,
4590}
4591
4592impl EVAbsolutePriceSchedule {
4593    /// Creates a `EVAbsolutePriceSchedule` from its required fields.
4594    #[must_use]
4595    pub fn new(
4596        time_anchor: impl Into<crate::types::DateTime>,
4597        currency: impl Into<String>,
4598        ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4599        price_algorithm: impl Into<String>,
4600    ) -> Self {
4601        Self {
4602            time_anchor: time_anchor.into(),
4603            currency: currency.into(),
4604            ev_absolute_price_schedule_entries,
4605            price_algorithm: price_algorithm.into(),
4606            custom_data: None,
4607        }
4608    }
4609
4610    /// Sets the optional `customData` field.
4611    #[must_use]
4612    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4613        self.custom_data = Some(value);
4614        self
4615    }
4616}
4617
4618impl Validate for EVAbsolutePriceSchedule {
4619    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4620        path.push_key("currency");
4621        validate::string(self.currency.as_str(), None, Some(3), path, out);
4622        path.pop();
4623        path.push_key("evAbsolutePriceScheduleEntries");
4624        validate::list_len(
4625            self.ev_absolute_price_schedule_entries.len(),
4626            Some(1),
4627            Some(1024),
4628            path,
4629            out,
4630        );
4631        for (index, item) in self.ev_absolute_price_schedule_entries.iter().enumerate() {
4632            path.push_index(index);
4633            Validate::validate_at(item, path, out);
4634            path.pop();
4635        }
4636        path.pop();
4637        path.push_key("priceAlgorithm");
4638        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
4639        path.pop();
4640        path.push_key("customData");
4641        if let Some(value) = &self.custom_data {
4642            Validate::validate_at(value, path, out);
4643        }
4644        path.pop();
4645    }
4646}
4647
4648/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4649///
4650/// The OCPP 2.1 `EVAbsolutePriceScheduleEntry` data type.
4651#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4652pub struct EVAbsolutePriceScheduleEntry {
4653    /// The amount of seconds of this entry.
4654    #[serde(deserialize_with = "crate::types::integer::one")]
4655    pub duration: i32,
4656    /// The `evPriceRule` member.
4657    #[serde(rename = "evPriceRule")]
4658    pub ev_price_rule: Vec<EVPriceRule>,
4659    /// The `customData` member.
4660    #[serde(rename = "customData")]
4661    #[serde(default, skip_serializing_if = "Option::is_none")]
4662    pub custom_data: Option<crate::types::CustomData>,
4663}
4664
4665impl EVAbsolutePriceScheduleEntry {
4666    /// Creates a `EVAbsolutePriceScheduleEntry` from its required fields.
4667    #[must_use]
4668    pub fn new(duration: i32, ev_price_rule: Vec<EVPriceRule>) -> Self {
4669        Self {
4670            duration,
4671            ev_price_rule,
4672            custom_data: None,
4673        }
4674    }
4675
4676    /// Sets the optional `customData` field.
4677    #[must_use]
4678    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4679        self.custom_data = Some(value);
4680        self
4681    }
4682}
4683
4684impl Validate for EVAbsolutePriceScheduleEntry {
4685    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4686        path.push_key("evPriceRule");
4687        validate::list_len(self.ev_price_rule.len(), Some(1), Some(8), path, out);
4688        for (index, item) in self.ev_price_rule.iter().enumerate() {
4689            path.push_index(index);
4690            Validate::validate_at(item, path, out);
4691            path.pop();
4692        }
4693        path.pop();
4694        path.push_key("customData");
4695        if let Some(value) = &self.custom_data {
4696            Validate::validate_at(value, path, out);
4697        }
4698        path.pop();
4699    }
4700}
4701
4702/// *(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.
4703///
4704/// The OCPP 2.1 `EVEnergyOffer` data type.
4705#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4706pub struct EVEnergyOffer {
4707    /// The `evPowerSchedule` member.
4708    #[serde(rename = "evPowerSchedule")]
4709    pub ev_power_schedule: EVPowerSchedule,
4710    /// The `evAbsolutePriceSchedule` member.
4711    #[serde(rename = "evAbsolutePriceSchedule")]
4712    #[serde(default, skip_serializing_if = "Option::is_none")]
4713    pub ev_absolute_price_schedule: Option<EVAbsolutePriceSchedule>,
4714    /// The `customData` member.
4715    #[serde(rename = "customData")]
4716    #[serde(default, skip_serializing_if = "Option::is_none")]
4717    pub custom_data: Option<crate::types::CustomData>,
4718}
4719
4720impl EVEnergyOffer {
4721    /// Creates a `EVEnergyOffer` from its required fields.
4722    #[must_use]
4723    pub fn new(ev_power_schedule: EVPowerSchedule) -> Self {
4724        Self {
4725            ev_power_schedule,
4726            ev_absolute_price_schedule: None,
4727            custom_data: None,
4728        }
4729    }
4730
4731    /// Sets the optional `evAbsolutePriceSchedule` field.
4732    #[must_use]
4733    pub fn with_ev_absolute_price_schedule(mut self, value: EVAbsolutePriceSchedule) -> Self {
4734        self.ev_absolute_price_schedule = Some(value);
4735        self
4736    }
4737
4738    /// Sets the optional `customData` field.
4739    #[must_use]
4740    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4741        self.custom_data = Some(value);
4742        self
4743    }
4744}
4745
4746impl Validate for EVEnergyOffer {
4747    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4748        path.push_key("evPowerSchedule");
4749        Validate::validate_at(&self.ev_power_schedule, path, out);
4750        path.pop();
4751        path.push_key("evAbsolutePriceSchedule");
4752        if let Some(value) = &self.ev_absolute_price_schedule {
4753            Validate::validate_at(value, path, out);
4754        }
4755        path.pop();
4756        path.push_key("customData");
4757        if let Some(value) = &self.custom_data {
4758            Validate::validate_at(value, path, out);
4759        }
4760        path.pop();
4761    }
4762}
4763
4764/// *(2.1)* Schedule of EV energy offer.
4765///
4766/// The OCPP 2.1 `EVPowerSchedule` data type.
4767#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4768pub struct EVPowerSchedule {
4769    /// The `evPowerScheduleEntries` member.
4770    #[serde(rename = "evPowerScheduleEntries")]
4771    pub ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4772    /// The time that defines the starting point for the EVEnergyOffer.
4773    #[serde(rename = "timeAnchor")]
4774    pub time_anchor: crate::types::DateTime,
4775    /// The `customData` member.
4776    #[serde(rename = "customData")]
4777    #[serde(default, skip_serializing_if = "Option::is_none")]
4778    pub custom_data: Option<crate::types::CustomData>,
4779}
4780
4781impl EVPowerSchedule {
4782    /// Creates a `EVPowerSchedule` from its required fields.
4783    #[must_use]
4784    pub fn new(
4785        ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4786        time_anchor: impl Into<crate::types::DateTime>,
4787    ) -> Self {
4788        Self {
4789            ev_power_schedule_entries,
4790            time_anchor: time_anchor.into(),
4791            custom_data: None,
4792        }
4793    }
4794
4795    /// Sets the optional `customData` field.
4796    #[must_use]
4797    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4798        self.custom_data = Some(value);
4799        self
4800    }
4801}
4802
4803impl Validate for EVPowerSchedule {
4804    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4805        path.push_key("evPowerScheduleEntries");
4806        validate::list_len(
4807            self.ev_power_schedule_entries.len(),
4808            Some(1),
4809            Some(1024),
4810            path,
4811            out,
4812        );
4813        for (index, item) in self.ev_power_schedule_entries.iter().enumerate() {
4814            path.push_index(index);
4815            Validate::validate_at(item, path, out);
4816            path.pop();
4817        }
4818        path.pop();
4819        path.push_key("customData");
4820        if let Some(value) = &self.custom_data {
4821            Validate::validate_at(value, path, out);
4822        }
4823        path.pop();
4824    }
4825}
4826
4827/// *(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.
4828///
4829/// The OCPP 2.1 `EVPowerScheduleEntry` data type.
4830#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4831pub struct EVPowerScheduleEntry {
4832    /// The duration of this entry.
4833    #[serde(deserialize_with = "crate::types::integer::one")]
4834    pub duration: i32,
4835    /// 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.
4836    pub power: crate::types::Decimal,
4837    /// The `customData` member.
4838    #[serde(rename = "customData")]
4839    #[serde(default, skip_serializing_if = "Option::is_none")]
4840    pub custom_data: Option<crate::types::CustomData>,
4841}
4842
4843impl EVPowerScheduleEntry {
4844    /// Creates a `EVPowerScheduleEntry` from its required fields.
4845    #[must_use]
4846    pub fn new(duration: i32, power: impl Into<crate::types::Decimal>) -> Self {
4847        Self {
4848            duration,
4849            power: power.into(),
4850            custom_data: None,
4851        }
4852    }
4853
4854    /// Sets the optional `customData` field.
4855    #[must_use]
4856    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4857        self.custom_data = Some(value);
4858        self
4859    }
4860}
4861
4862impl Validate for EVPowerScheduleEntry {
4863    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4864        path.push_key("customData");
4865        if let Some(value) = &self.custom_data {
4866            Validate::validate_at(value, path, out);
4867        }
4868        path.pop();
4869    }
4870}
4871
4872/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4873///
4874/// The OCPP 2.1 `EVPriceRule` data type.
4875#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4876pub struct EVPriceRule {
4877    /// Cost per kWh.
4878    #[serde(rename = "energyFee")]
4879    pub energy_fee: crate::types::Decimal,
4880    /// 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.
4881    #[serde(rename = "powerRangeStart")]
4882    pub power_range_start: crate::types::Decimal,
4883    /// The `customData` member.
4884    #[serde(rename = "customData")]
4885    #[serde(default, skip_serializing_if = "Option::is_none")]
4886    pub custom_data: Option<crate::types::CustomData>,
4887}
4888
4889impl EVPriceRule {
4890    /// Creates a `EVPriceRule` from its required fields.
4891    #[must_use]
4892    pub fn new(
4893        energy_fee: impl Into<crate::types::Decimal>,
4894        power_range_start: impl Into<crate::types::Decimal>,
4895    ) -> Self {
4896        Self {
4897            energy_fee: energy_fee.into(),
4898            power_range_start: power_range_start.into(),
4899            custom_data: None,
4900        }
4901    }
4902
4903    /// Sets the optional `customData` field.
4904    #[must_use]
4905    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4906        self.custom_data = Some(value);
4907        self
4908    }
4909}
4910
4911impl Validate for EVPriceRule {
4912    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4913        path.push_key("customData");
4914        if let Some(value) = &self.custom_data {
4915            Validate::validate_at(value, path, out);
4916        }
4917        path.pop();
4918    }
4919}
4920
4921/// Electric Vehicle Supply Equipment
4922///
4923/// The OCPP 2.1 `EVSE` data type.
4924#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4925pub struct EVSE {
4926    /// EVSE Identifier. This contains a number (&gt; 0) designating an EVSE of the Charging Station.
4927    #[serde(deserialize_with = "crate::types::integer::one")]
4928    pub id: i32,
4929    /// An id to designate a specific connector (on an EVSE) by connector index number.
4930    #[serde(rename = "connectorId")]
4931    #[serde(default, skip_serializing_if = "Option::is_none")]
4932    #[serde(deserialize_with = "crate::types::integer::option")]
4933    pub connector_id: Option<i32>,
4934    /// The `customData` member.
4935    #[serde(rename = "customData")]
4936    #[serde(default, skip_serializing_if = "Option::is_none")]
4937    pub custom_data: Option<crate::types::CustomData>,
4938}
4939
4940impl EVSE {
4941    /// Creates a `EVSE` from its required fields.
4942    #[must_use]
4943    pub fn new(id: i32) -> Self {
4944        Self {
4945            id,
4946            connector_id: None,
4947            custom_data: None,
4948        }
4949    }
4950
4951    /// Sets the optional `connectorId` field.
4952    #[must_use]
4953    pub fn with_connector_id(mut self, value: i32) -> Self {
4954        self.connector_id = Some(value);
4955        self
4956    }
4957
4958    /// Sets the optional `customData` field.
4959    #[must_use]
4960    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4961        self.custom_data = Some(value);
4962        self
4963    }
4964}
4965
4966impl Validate for EVSE {
4967    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4968        path.push_key("id");
4969        validate::int_range(i64::from(self.id), Some(0), None, path, out);
4970        path.pop();
4971        path.push_key("connectorId");
4972        if let Some(value) = &self.connector_id {
4973            validate::int_range(i64::from(*value), Some(0), None, path, out);
4974        }
4975        path.pop();
4976        path.push_key("customData");
4977        if let Some(value) = &self.custom_data {
4978            Validate::validate_at(value, path, out);
4979        }
4980        path.pop();
4981    }
4982}
4983
4984/// The OCPP 2.1 `EnterService` data type.
4985#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4986pub struct EnterService {
4987    /// Priority of setting (0=highest)
4988    #[serde(deserialize_with = "crate::types::integer::one")]
4989    pub priority: i32,
4990    /// Enter service voltage high
4991    #[serde(rename = "highVoltage")]
4992    pub high_voltage: crate::types::Decimal,
4993    /// Enter service voltage low
4994    #[serde(rename = "lowVoltage")]
4995    pub low_voltage: crate::types::Decimal,
4996    /// Enter service frequency high
4997    #[serde(rename = "highFreq")]
4998    pub high_freq: crate::types::Decimal,
4999    /// Enter service frequency low
5000    #[serde(rename = "lowFreq")]
5001    pub low_freq: crate::types::Decimal,
5002    /// Enter service delay
5003    #[serde(default, skip_serializing_if = "Option::is_none")]
5004    pub delay: Option<crate::types::Decimal>,
5005    /// Enter service randomized delay
5006    #[serde(rename = "randomDelay")]
5007    #[serde(default, skip_serializing_if = "Option::is_none")]
5008    pub random_delay: Option<crate::types::Decimal>,
5009    /// Enter service ramp rate in seconds
5010    #[serde(rename = "rampRate")]
5011    #[serde(default, skip_serializing_if = "Option::is_none")]
5012    pub ramp_rate: Option<crate::types::Decimal>,
5013    /// The `customData` member.
5014    #[serde(rename = "customData")]
5015    #[serde(default, skip_serializing_if = "Option::is_none")]
5016    pub custom_data: Option<crate::types::CustomData>,
5017}
5018
5019impl EnterService {
5020    /// Creates a `EnterService` from its required fields.
5021    #[must_use]
5022    pub fn new(
5023        priority: i32,
5024        high_voltage: impl Into<crate::types::Decimal>,
5025        low_voltage: impl Into<crate::types::Decimal>,
5026        high_freq: impl Into<crate::types::Decimal>,
5027        low_freq: impl Into<crate::types::Decimal>,
5028    ) -> Self {
5029        Self {
5030            priority,
5031            high_voltage: high_voltage.into(),
5032            low_voltage: low_voltage.into(),
5033            high_freq: high_freq.into(),
5034            low_freq: low_freq.into(),
5035            delay: None,
5036            random_delay: None,
5037            ramp_rate: None,
5038            custom_data: None,
5039        }
5040    }
5041
5042    /// Sets the optional `delay` field.
5043    #[must_use]
5044    pub fn with_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5045        self.delay = Some(value.into());
5046        self
5047    }
5048
5049    /// Sets the optional `randomDelay` field.
5050    #[must_use]
5051    pub fn with_random_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5052        self.random_delay = Some(value.into());
5053        self
5054    }
5055
5056    /// Sets the optional `rampRate` field.
5057    #[must_use]
5058    pub fn with_ramp_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5059        self.ramp_rate = Some(value.into());
5060        self
5061    }
5062
5063    /// Sets the optional `customData` field.
5064    #[must_use]
5065    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5066        self.custom_data = Some(value);
5067        self
5068    }
5069}
5070
5071impl Validate for EnterService {
5072    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5073        path.push_key("priority");
5074        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5075        path.pop();
5076        path.push_key("customData");
5077        if let Some(value) = &self.custom_data {
5078            Validate::validate_at(value, path, out);
5079        }
5080        path.pop();
5081    }
5082}
5083
5084/// The OCPP 2.1 `EnterServiceGet` data type.
5085#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5086pub struct EnterServiceGet {
5087    /// The `enterService` member.
5088    #[serde(rename = "enterService")]
5089    pub enter_service: EnterService,
5090    /// Id of setting
5091    pub id: String,
5092    /// The `customData` member.
5093    #[serde(rename = "customData")]
5094    #[serde(default, skip_serializing_if = "Option::is_none")]
5095    pub custom_data: Option<crate::types::CustomData>,
5096}
5097
5098impl EnterServiceGet {
5099    /// Creates a `EnterServiceGet` from its required fields.
5100    #[must_use]
5101    pub fn new(enter_service: EnterService, id: impl Into<String>) -> Self {
5102        Self {
5103            enter_service,
5104            id: id.into(),
5105            custom_data: None,
5106        }
5107    }
5108
5109    /// Sets the optional `customData` field.
5110    #[must_use]
5111    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5112        self.custom_data = Some(value);
5113        self
5114    }
5115}
5116
5117impl Validate for EnterServiceGet {
5118    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5119        path.push_key("enterService");
5120        Validate::validate_at(&self.enter_service, path, out);
5121        path.pop();
5122        path.push_key("id");
5123        validate::string(self.id.as_str(), None, Some(36), path, out);
5124        path.pop();
5125        path.push_key("customData");
5126        if let Some(value) = &self.custom_data {
5127            Validate::validate_at(value, path, out);
5128        }
5129        path.pop();
5130    }
5131}
5132
5133/// Class to report an event notification for a component-variable.
5134///
5135/// The OCPP 2.1 `EventData` data type.
5136#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5137pub struct EventData {
5138    /// Identifies the event. This field can be referred to as a cause by other events.
5139    #[serde(rename = "eventId")]
5140    #[serde(deserialize_with = "crate::types::integer::one")]
5141    pub event_id: i32,
5142    /// Timestamp of the moment the report was generated.
5143    pub timestamp: crate::types::DateTime,
5144    /// The `trigger` member.
5145    pub trigger: EventTrigger,
5146    /// Actual value (_attributeType_ Actual) of the variable.
5147    ///
5148    /// 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.
5149    #[serde(rename = "actualValue")]
5150    pub actual_value: String,
5151    /// The `component` member.
5152    pub component: Component,
5153    /// The `eventNotificationType` member.
5154    #[serde(rename = "eventNotificationType")]
5155    pub event_notification_type: EventNotification,
5156    /// The `variable` member.
5157    pub variable: Variable,
5158    /// Refers to the Id of an event that is considered to be the cause for this event.
5159    #[serde(default, skip_serializing_if = "Option::is_none")]
5160    #[serde(deserialize_with = "crate::types::integer::option")]
5161    pub cause: Option<i32>,
5162    /// Technical (error) code as reported by component.
5163    #[serde(rename = "techCode")]
5164    #[serde(default, skip_serializing_if = "Option::is_none")]
5165    pub tech_code: Option<String>,
5166    /// Technical detail information as reported by component.
5167    #[serde(rename = "techInfo")]
5168    #[serde(default, skip_serializing_if = "Option::is_none")]
5169    pub tech_info: Option<String>,
5170    /// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
5171    #[serde(default, skip_serializing_if = "Option::is_none")]
5172    pub cleared: Option<bool>,
5173    /// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
5174    #[serde(rename = "transactionId")]
5175    #[serde(default, skip_serializing_if = "Option::is_none")]
5176    pub transaction_id: Option<String>,
5177    /// Identifies the VariableMonitoring which triggered the event.
5178    #[serde(rename = "variableMonitoringId")]
5179    #[serde(default, skip_serializing_if = "Option::is_none")]
5180    #[serde(deserialize_with = "crate::types::integer::option")]
5181    pub variable_monitoring_id: Option<i32>,
5182    /// *(2.1)* Severity associated with the monitor in _variableMonitoringId_ or with the hardwired notification.
5183    #[serde(default, skip_serializing_if = "Option::is_none")]
5184    #[serde(deserialize_with = "crate::types::integer::option")]
5185    pub severity: Option<i32>,
5186    /// The `customData` member.
5187    #[serde(rename = "customData")]
5188    #[serde(default, skip_serializing_if = "Option::is_none")]
5189    pub custom_data: Option<crate::types::CustomData>,
5190}
5191
5192impl EventData {
5193    /// Creates a `EventData` from its required fields.
5194    #[must_use]
5195    pub fn new(
5196        event_id: i32,
5197        timestamp: impl Into<crate::types::DateTime>,
5198        trigger: EventTrigger,
5199        actual_value: impl Into<String>,
5200        component: Component,
5201        event_notification_type: EventNotification,
5202        variable: Variable,
5203    ) -> Self {
5204        Self {
5205            event_id,
5206            timestamp: timestamp.into(),
5207            trigger,
5208            actual_value: actual_value.into(),
5209            component,
5210            event_notification_type,
5211            variable,
5212            cause: None,
5213            tech_code: None,
5214            tech_info: None,
5215            cleared: None,
5216            transaction_id: None,
5217            variable_monitoring_id: None,
5218            severity: None,
5219            custom_data: None,
5220        }
5221    }
5222
5223    /// Sets the optional `cause` field.
5224    #[must_use]
5225    pub fn with_cause(mut self, value: i32) -> Self {
5226        self.cause = Some(value);
5227        self
5228    }
5229
5230    /// Sets the optional `techCode` field.
5231    #[must_use]
5232    pub fn with_tech_code(mut self, value: impl Into<String>) -> Self {
5233        self.tech_code = Some(value.into());
5234        self
5235    }
5236
5237    /// Sets the optional `techInfo` field.
5238    #[must_use]
5239    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
5240        self.tech_info = Some(value.into());
5241        self
5242    }
5243
5244    /// Sets the optional `cleared` field.
5245    #[must_use]
5246    pub fn with_cleared(mut self, value: bool) -> Self {
5247        self.cleared = Some(value);
5248        self
5249    }
5250
5251    /// Sets the optional `transactionId` field.
5252    #[must_use]
5253    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5254        self.transaction_id = Some(value.into());
5255        self
5256    }
5257
5258    /// Sets the optional `variableMonitoringId` field.
5259    #[must_use]
5260    pub fn with_variable_monitoring_id(mut self, value: i32) -> Self {
5261        self.variable_monitoring_id = Some(value);
5262        self
5263    }
5264
5265    /// Sets the optional `severity` field.
5266    #[must_use]
5267    pub fn with_severity(mut self, value: i32) -> Self {
5268        self.severity = Some(value);
5269        self
5270    }
5271
5272    /// Sets the optional `customData` field.
5273    #[must_use]
5274    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5275        self.custom_data = Some(value);
5276        self
5277    }
5278}
5279
5280impl Validate for EventData {
5281    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5282        path.push_key("eventId");
5283        validate::int_range(i64::from(self.event_id), Some(0), None, path, out);
5284        path.pop();
5285        path.push_key("trigger");
5286        Validate::validate_at(&self.trigger, path, out);
5287        path.pop();
5288        path.push_key("actualValue");
5289        validate::string(self.actual_value.as_str(), None, Some(2500), path, out);
5290        path.pop();
5291        path.push_key("component");
5292        Validate::validate_at(&self.component, path, out);
5293        path.pop();
5294        path.push_key("eventNotificationType");
5295        Validate::validate_at(&self.event_notification_type, path, out);
5296        path.pop();
5297        path.push_key("variable");
5298        Validate::validate_at(&self.variable, path, out);
5299        path.pop();
5300        path.push_key("cause");
5301        if let Some(value) = &self.cause {
5302            validate::int_range(i64::from(*value), Some(0), None, path, out);
5303        }
5304        path.pop();
5305        path.push_key("techCode");
5306        if let Some(value) = &self.tech_code {
5307            validate::string(value.as_str(), None, Some(50), path, out);
5308        }
5309        path.pop();
5310        path.push_key("techInfo");
5311        if let Some(value) = &self.tech_info {
5312            validate::string(value.as_str(), None, Some(500), path, out);
5313        }
5314        path.pop();
5315        path.push_key("transactionId");
5316        if let Some(value) = &self.transaction_id {
5317            validate::string(value.as_str(), None, Some(36), path, out);
5318        }
5319        path.pop();
5320        path.push_key("variableMonitoringId");
5321        if let Some(value) = &self.variable_monitoring_id {
5322            validate::int_range(i64::from(*value), Some(0), None, path, out);
5323        }
5324        path.pop();
5325        path.push_key("severity");
5326        if let Some(value) = &self.severity {
5327            validate::int_range(i64::from(*value), Some(0), None, path, out);
5328        }
5329        path.pop();
5330        path.push_key("customData");
5331        if let Some(value) = &self.custom_data {
5332            Validate::validate_at(value, path, out);
5333        }
5334        path.pop();
5335    }
5336}
5337
5338/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
5339///
5340/// The OCPP 2.1 `Firmware` data type.
5341#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5342pub struct Firmware {
5343    /// URI defining the origin of the firmware.
5344    pub location: String,
5345    /// Date and time at which the firmware shall be retrieved.
5346    #[serde(rename = "retrieveDateTime")]
5347    pub retrieve_date_time: crate::types::DateTime,
5348    /// Date and time at which the firmware shall be installed.
5349    #[serde(rename = "installDateTime")]
5350    #[serde(default, skip_serializing_if = "Option::is_none")]
5351    pub install_date_time: Option<crate::types::DateTime>,
5352    /// Certificate with which the firmware was signed.
5353    /// PEM encoded X.509 certificate.
5354    #[serde(rename = "signingCertificate")]
5355    #[serde(default, skip_serializing_if = "Option::is_none")]
5356    pub signing_certificate: Option<String>,
5357    /// Base64 encoded firmware signature.
5358    #[serde(default, skip_serializing_if = "Option::is_none")]
5359    pub signature: Option<String>,
5360    /// The `customData` member.
5361    #[serde(rename = "customData")]
5362    #[serde(default, skip_serializing_if = "Option::is_none")]
5363    pub custom_data: Option<crate::types::CustomData>,
5364}
5365
5366impl Firmware {
5367    /// Creates a `Firmware` from its required fields.
5368    #[must_use]
5369    pub fn new(
5370        location: impl Into<String>,
5371        retrieve_date_time: impl Into<crate::types::DateTime>,
5372    ) -> Self {
5373        Self {
5374            location: location.into(),
5375            retrieve_date_time: retrieve_date_time.into(),
5376            install_date_time: None,
5377            signing_certificate: None,
5378            signature: None,
5379            custom_data: None,
5380        }
5381    }
5382
5383    /// Sets the optional `installDateTime` field.
5384    #[must_use]
5385    pub fn with_install_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5386        self.install_date_time = Some(value.into());
5387        self
5388    }
5389
5390    /// Sets the optional `signingCertificate` field.
5391    #[must_use]
5392    pub fn with_signing_certificate(mut self, value: impl Into<String>) -> Self {
5393        self.signing_certificate = Some(value.into());
5394        self
5395    }
5396
5397    /// Sets the optional `signature` field.
5398    #[must_use]
5399    pub fn with_signature(mut self, value: impl Into<String>) -> Self {
5400        self.signature = Some(value.into());
5401        self
5402    }
5403
5404    /// Sets the optional `customData` field.
5405    #[must_use]
5406    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5407        self.custom_data = Some(value);
5408        self
5409    }
5410}
5411
5412impl Validate for Firmware {
5413    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5414        path.push_key("location");
5415        validate::string(self.location.as_str(), None, Some(2000), path, out);
5416        path.pop();
5417        path.push_key("signingCertificate");
5418        if let Some(value) = &self.signing_certificate {
5419            validate::string(value.as_str(), None, Some(5500), path, out);
5420        }
5421        path.pop();
5422        path.push_key("signature");
5423        if let Some(value) = &self.signature {
5424            validate::string(value.as_str(), None, Some(800), path, out);
5425        }
5426        path.pop();
5427        path.push_key("customData");
5428        if let Some(value) = &self.custom_data {
5429            Validate::validate_at(value, path, out);
5430        }
5431        path.pop();
5432    }
5433}
5434
5435/// The OCPP 2.1 `FixedPF` data type.
5436#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5437pub struct FixedPF {
5438    /// Priority of setting (0=highest)
5439    #[serde(deserialize_with = "crate::types::integer::one")]
5440    pub priority: i32,
5441    /// Power factor, cos(phi), as value between 0..1.
5442    pub displacement: crate::types::Decimal,
5443    /// True when absorbing reactive power (under-excited), false when injecting reactive power (over-excited).
5444    pub excitation: bool,
5445    /// Time when this setting becomes active
5446    #[serde(rename = "startTime")]
5447    #[serde(default, skip_serializing_if = "Option::is_none")]
5448    pub start_time: Option<crate::types::DateTime>,
5449    /// Duration in seconds that this setting is active.
5450    #[serde(default, skip_serializing_if = "Option::is_none")]
5451    pub duration: Option<crate::types::Decimal>,
5452    /// The `customData` member.
5453    #[serde(rename = "customData")]
5454    #[serde(default, skip_serializing_if = "Option::is_none")]
5455    pub custom_data: Option<crate::types::CustomData>,
5456}
5457
5458impl FixedPF {
5459    /// Creates a `FixedPF` from its required fields.
5460    #[must_use]
5461    pub fn new(
5462        priority: i32,
5463        displacement: impl Into<crate::types::Decimal>,
5464        excitation: bool,
5465    ) -> Self {
5466        Self {
5467            priority,
5468            displacement: displacement.into(),
5469            excitation,
5470            start_time: None,
5471            duration: None,
5472            custom_data: None,
5473        }
5474    }
5475
5476    /// Sets the optional `startTime` field.
5477    #[must_use]
5478    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5479        self.start_time = Some(value.into());
5480        self
5481    }
5482
5483    /// Sets the optional `duration` field.
5484    #[must_use]
5485    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5486        self.duration = Some(value.into());
5487        self
5488    }
5489
5490    /// Sets the optional `customData` field.
5491    #[must_use]
5492    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5493        self.custom_data = Some(value);
5494        self
5495    }
5496}
5497
5498impl Validate for FixedPF {
5499    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5500        path.push_key("priority");
5501        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5502        path.pop();
5503        path.push_key("customData");
5504        if let Some(value) = &self.custom_data {
5505            Validate::validate_at(value, path, out);
5506        }
5507        path.pop();
5508    }
5509}
5510
5511/// The OCPP 2.1 `FixedPFGet` data type.
5512#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5513pub struct FixedPFGet {
5514    /// The `fixedPF` member.
5515    #[serde(rename = "fixedPF")]
5516    pub fixed_pf: FixedPF,
5517    /// Id of setting.
5518    pub id: String,
5519    /// True if setting is a default control.
5520    #[serde(rename = "isDefault")]
5521    pub is_default: bool,
5522    /// True if this setting is superseded by a lower priority setting.
5523    #[serde(rename = "isSuperseded")]
5524    pub is_superseded: bool,
5525    /// The `customData` member.
5526    #[serde(rename = "customData")]
5527    #[serde(default, skip_serializing_if = "Option::is_none")]
5528    pub custom_data: Option<crate::types::CustomData>,
5529}
5530
5531impl FixedPFGet {
5532    /// Creates a `FixedPFGet` from its required fields.
5533    #[must_use]
5534    pub fn new(
5535        fixed_pf: FixedPF,
5536        id: impl Into<String>,
5537        is_default: bool,
5538        is_superseded: bool,
5539    ) -> Self {
5540        Self {
5541            fixed_pf,
5542            id: id.into(),
5543            is_default,
5544            is_superseded,
5545            custom_data: None,
5546        }
5547    }
5548
5549    /// Sets the optional `customData` field.
5550    #[must_use]
5551    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5552        self.custom_data = Some(value);
5553        self
5554    }
5555}
5556
5557impl Validate for FixedPFGet {
5558    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5559        path.push_key("fixedPF");
5560        Validate::validate_at(&self.fixed_pf, path, out);
5561        path.pop();
5562        path.push_key("id");
5563        validate::string(self.id.as_str(), None, Some(36), path, out);
5564        path.pop();
5565        path.push_key("customData");
5566        if let Some(value) = &self.custom_data {
5567            Validate::validate_at(value, path, out);
5568        }
5569        path.pop();
5570    }
5571}
5572
5573/// The OCPP 2.1 `FixedVar` data type.
5574#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5575pub struct FixedVar {
5576    /// Priority of setting (0=highest)
5577    #[serde(deserialize_with = "crate::types::integer::one")]
5578    pub priority: i32,
5579    /// The value specifies a target var output interpreted as a signed percentage (-100 to 100).
5580    ///     A negative value refers to charging, whereas a positive one refers to discharging.
5581    ///     The value type is determined by the unit field.
5582    pub setpoint: crate::types::Decimal,
5583    /// The `unit` member.
5584    pub unit: DERUnit,
5585    /// Time when this setting becomes active.
5586    #[serde(rename = "startTime")]
5587    #[serde(default, skip_serializing_if = "Option::is_none")]
5588    pub start_time: Option<crate::types::DateTime>,
5589    /// Duration in seconds that this setting is active.
5590    #[serde(default, skip_serializing_if = "Option::is_none")]
5591    pub duration: Option<crate::types::Decimal>,
5592    /// The `customData` member.
5593    #[serde(rename = "customData")]
5594    #[serde(default, skip_serializing_if = "Option::is_none")]
5595    pub custom_data: Option<crate::types::CustomData>,
5596}
5597
5598impl FixedVar {
5599    /// Creates a `FixedVar` from its required fields.
5600    #[must_use]
5601    pub fn new(priority: i32, setpoint: impl Into<crate::types::Decimal>, unit: DERUnit) -> Self {
5602        Self {
5603            priority,
5604            setpoint: setpoint.into(),
5605            unit,
5606            start_time: None,
5607            duration: None,
5608            custom_data: None,
5609        }
5610    }
5611
5612    /// Sets the optional `startTime` field.
5613    #[must_use]
5614    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5615        self.start_time = Some(value.into());
5616        self
5617    }
5618
5619    /// Sets the optional `duration` field.
5620    #[must_use]
5621    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5622        self.duration = Some(value.into());
5623        self
5624    }
5625
5626    /// Sets the optional `customData` field.
5627    #[must_use]
5628    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5629        self.custom_data = Some(value);
5630        self
5631    }
5632}
5633
5634impl Validate for FixedVar {
5635    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5636        path.push_key("priority");
5637        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5638        path.pop();
5639        path.push_key("unit");
5640        Validate::validate_at(&self.unit, path, out);
5641        path.pop();
5642        path.push_key("customData");
5643        if let Some(value) = &self.custom_data {
5644            Validate::validate_at(value, path, out);
5645        }
5646        path.pop();
5647    }
5648}
5649
5650/// The OCPP 2.1 `FixedVarGet` data type.
5651#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5652pub struct FixedVarGet {
5653    /// The `fixedVar` member.
5654    #[serde(rename = "fixedVar")]
5655    pub fixed_var: FixedVar,
5656    /// Id of setting
5657    pub id: String,
5658    /// True if setting is a default control.
5659    #[serde(rename = "isDefault")]
5660    pub is_default: bool,
5661    /// True if this setting is superseded by a lower priority setting
5662    #[serde(rename = "isSuperseded")]
5663    pub is_superseded: bool,
5664    /// The `customData` member.
5665    #[serde(rename = "customData")]
5666    #[serde(default, skip_serializing_if = "Option::is_none")]
5667    pub custom_data: Option<crate::types::CustomData>,
5668}
5669
5670impl FixedVarGet {
5671    /// Creates a `FixedVarGet` from its required fields.
5672    #[must_use]
5673    pub fn new(
5674        fixed_var: FixedVar,
5675        id: impl Into<String>,
5676        is_default: bool,
5677        is_superseded: bool,
5678    ) -> Self {
5679        Self {
5680            fixed_var,
5681            id: id.into(),
5682            is_default,
5683            is_superseded,
5684            custom_data: None,
5685        }
5686    }
5687
5688    /// Sets the optional `customData` field.
5689    #[must_use]
5690    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5691        self.custom_data = Some(value);
5692        self
5693    }
5694}
5695
5696impl Validate for FixedVarGet {
5697    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5698        path.push_key("fixedVar");
5699        Validate::validate_at(&self.fixed_var, path, out);
5700        path.pop();
5701        path.push_key("id");
5702        validate::string(self.id.as_str(), None, Some(36), path, out);
5703        path.pop();
5704        path.push_key("customData");
5705        if let Some(value) = &self.custom_data {
5706            Validate::validate_at(value, path, out);
5707        }
5708        path.pop();
5709    }
5710}
5711
5712/// The OCPP 2.1 `FreqDroop` data type.
5713#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5714pub struct FreqDroop {
5715    /// Priority of setting (0=highest)
5716    #[serde(deserialize_with = "crate::types::integer::one")]
5717    pub priority: i32,
5718    /// Over-frequency start of droop
5719    #[serde(rename = "overFreq")]
5720    pub over_freq: crate::types::Decimal,
5721    /// Under-frequency start of droop
5722    #[serde(rename = "underFreq")]
5723    pub under_freq: crate::types::Decimal,
5724    /// Over-frequency droop per unit, oFDroop
5725    #[serde(rename = "overDroop")]
5726    pub over_droop: crate::types::Decimal,
5727    /// Under-frequency droop per unit, uFDroop
5728    #[serde(rename = "underDroop")]
5729    pub under_droop: crate::types::Decimal,
5730    /// Open loop response time in seconds
5731    #[serde(rename = "responseTime")]
5732    pub response_time: crate::types::Decimal,
5733    /// Time when this setting becomes active
5734    #[serde(rename = "startTime")]
5735    #[serde(default, skip_serializing_if = "Option::is_none")]
5736    pub start_time: Option<crate::types::DateTime>,
5737    /// Duration in seconds that this setting is active
5738    #[serde(default, skip_serializing_if = "Option::is_none")]
5739    pub duration: Option<crate::types::Decimal>,
5740    /// The `customData` member.
5741    #[serde(rename = "customData")]
5742    #[serde(default, skip_serializing_if = "Option::is_none")]
5743    pub custom_data: Option<crate::types::CustomData>,
5744}
5745
5746impl FreqDroop {
5747    /// Creates a `FreqDroop` from its required fields.
5748    #[must_use]
5749    pub fn new(
5750        priority: i32,
5751        over_freq: impl Into<crate::types::Decimal>,
5752        under_freq: impl Into<crate::types::Decimal>,
5753        over_droop: impl Into<crate::types::Decimal>,
5754        under_droop: impl Into<crate::types::Decimal>,
5755        response_time: impl Into<crate::types::Decimal>,
5756    ) -> Self {
5757        Self {
5758            priority,
5759            over_freq: over_freq.into(),
5760            under_freq: under_freq.into(),
5761            over_droop: over_droop.into(),
5762            under_droop: under_droop.into(),
5763            response_time: response_time.into(),
5764            start_time: None,
5765            duration: None,
5766            custom_data: None,
5767        }
5768    }
5769
5770    /// Sets the optional `startTime` field.
5771    #[must_use]
5772    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5773        self.start_time = Some(value.into());
5774        self
5775    }
5776
5777    /// Sets the optional `duration` field.
5778    #[must_use]
5779    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5780        self.duration = Some(value.into());
5781        self
5782    }
5783
5784    /// Sets the optional `customData` field.
5785    #[must_use]
5786    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5787        self.custom_data = Some(value);
5788        self
5789    }
5790}
5791
5792impl Validate for FreqDroop {
5793    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5794        path.push_key("priority");
5795        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5796        path.pop();
5797        path.push_key("customData");
5798        if let Some(value) = &self.custom_data {
5799            Validate::validate_at(value, path, out);
5800        }
5801        path.pop();
5802    }
5803}
5804
5805/// The OCPP 2.1 `FreqDroopGet` data type.
5806#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5807pub struct FreqDroopGet {
5808    /// The `freqDroop` member.
5809    #[serde(rename = "freqDroop")]
5810    pub freq_droop: FreqDroop,
5811    /// Id of setting
5812    pub id: String,
5813    /// True if setting is a default control.
5814    #[serde(rename = "isDefault")]
5815    pub is_default: bool,
5816    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
5817    #[serde(rename = "isSuperseded")]
5818    pub is_superseded: bool,
5819    /// The `customData` member.
5820    #[serde(rename = "customData")]
5821    #[serde(default, skip_serializing_if = "Option::is_none")]
5822    pub custom_data: Option<crate::types::CustomData>,
5823}
5824
5825impl FreqDroopGet {
5826    /// Creates a `FreqDroopGet` from its required fields.
5827    #[must_use]
5828    pub fn new(
5829        freq_droop: FreqDroop,
5830        id: impl Into<String>,
5831        is_default: bool,
5832        is_superseded: bool,
5833    ) -> Self {
5834        Self {
5835            freq_droop,
5836            id: id.into(),
5837            is_default,
5838            is_superseded,
5839            custom_data: None,
5840        }
5841    }
5842
5843    /// Sets the optional `customData` field.
5844    #[must_use]
5845    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5846        self.custom_data = Some(value);
5847        self
5848    }
5849}
5850
5851impl Validate for FreqDroopGet {
5852    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5853        path.push_key("freqDroop");
5854        Validate::validate_at(&self.freq_droop, path, out);
5855        path.pop();
5856        path.push_key("id");
5857        validate::string(self.id.as_str(), None, Some(36), path, out);
5858        path.pop();
5859        path.push_key("customData");
5860        if let Some(value) = &self.custom_data {
5861            Validate::validate_at(value, path, out);
5862        }
5863        path.pop();
5864    }
5865}
5866
5867/// Class to hold parameters for GetVariables request.
5868///
5869/// The OCPP 2.1 `GetVariableData` data type.
5870#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5871pub struct GetVariableData {
5872    /// The `component` member.
5873    pub component: Component,
5874    /// The `variable` member.
5875    pub variable: Variable,
5876    /// The `attributeType` member.
5877    #[serde(rename = "attributeType")]
5878    #[serde(default, skip_serializing_if = "Option::is_none")]
5879    pub attribute_type: Option<Attribute>,
5880    /// The `customData` member.
5881    #[serde(rename = "customData")]
5882    #[serde(default, skip_serializing_if = "Option::is_none")]
5883    pub custom_data: Option<crate::types::CustomData>,
5884}
5885
5886impl GetVariableData {
5887    /// Creates a `GetVariableData` from its required fields.
5888    #[must_use]
5889    pub fn new(component: Component, variable: Variable) -> Self {
5890        Self {
5891            component,
5892            variable,
5893            attribute_type: None,
5894            custom_data: None,
5895        }
5896    }
5897
5898    /// Sets the optional `attributeType` field.
5899    #[must_use]
5900    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5901        self.attribute_type = Some(value);
5902        self
5903    }
5904
5905    /// Sets the optional `customData` field.
5906    #[must_use]
5907    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5908        self.custom_data = Some(value);
5909        self
5910    }
5911}
5912
5913impl Validate for GetVariableData {
5914    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5915        path.push_key("component");
5916        Validate::validate_at(&self.component, path, out);
5917        path.pop();
5918        path.push_key("variable");
5919        Validate::validate_at(&self.variable, path, out);
5920        path.pop();
5921        path.push_key("attributeType");
5922        if let Some(value) = &self.attribute_type {
5923            Validate::validate_at(value, path, out);
5924        }
5925        path.pop();
5926        path.push_key("customData");
5927        if let Some(value) = &self.custom_data {
5928            Validate::validate_at(value, path, out);
5929        }
5930        path.pop();
5931    }
5932}
5933
5934/// Class to hold results of GetVariables request.
5935///
5936/// The OCPP 2.1 `GetVariableResult` data type.
5937#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5938pub struct GetVariableResult {
5939    /// The `attributeStatus` member.
5940    #[serde(rename = "attributeStatus")]
5941    pub attribute_status: GetVariableStatus,
5942    /// The `component` member.
5943    pub component: Component,
5944    /// The `variable` member.
5945    pub variable: Variable,
5946    /// The `attributeStatusInfo` member.
5947    #[serde(rename = "attributeStatusInfo")]
5948    #[serde(default, skip_serializing_if = "Option::is_none")]
5949    pub attribute_status_info: Option<StatusInfo>,
5950    /// The `attributeType` member.
5951    #[serde(rename = "attributeType")]
5952    #[serde(default, skip_serializing_if = "Option::is_none")]
5953    pub attribute_type: Option<Attribute>,
5954    /// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
5955    ///
5956    /// 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.
5957    #[serde(rename = "attributeValue")]
5958    #[serde(default, skip_serializing_if = "Option::is_none")]
5959    pub attribute_value: Option<String>,
5960    /// The `customData` member.
5961    #[serde(rename = "customData")]
5962    #[serde(default, skip_serializing_if = "Option::is_none")]
5963    pub custom_data: Option<crate::types::CustomData>,
5964}
5965
5966impl GetVariableResult {
5967    /// Creates a `GetVariableResult` from its required fields.
5968    #[must_use]
5969    pub fn new(
5970        attribute_status: GetVariableStatus,
5971        component: Component,
5972        variable: Variable,
5973    ) -> Self {
5974        Self {
5975            attribute_status,
5976            component,
5977            variable,
5978            attribute_status_info: None,
5979            attribute_type: None,
5980            attribute_value: None,
5981            custom_data: None,
5982        }
5983    }
5984
5985    /// Sets the optional `attributeStatusInfo` field.
5986    #[must_use]
5987    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
5988        self.attribute_status_info = Some(value);
5989        self
5990    }
5991
5992    /// Sets the optional `attributeType` field.
5993    #[must_use]
5994    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5995        self.attribute_type = Some(value);
5996        self
5997    }
5998
5999    /// Sets the optional `attributeValue` field.
6000    #[must_use]
6001    pub fn with_attribute_value(mut self, value: impl Into<String>) -> Self {
6002        self.attribute_value = Some(value.into());
6003        self
6004    }
6005
6006    /// Sets the optional `customData` field.
6007    #[must_use]
6008    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6009        self.custom_data = Some(value);
6010        self
6011    }
6012}
6013
6014impl Validate for GetVariableResult {
6015    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6016        path.push_key("attributeStatus");
6017        Validate::validate_at(&self.attribute_status, path, out);
6018        path.pop();
6019        path.push_key("component");
6020        Validate::validate_at(&self.component, path, out);
6021        path.pop();
6022        path.push_key("variable");
6023        Validate::validate_at(&self.variable, path, out);
6024        path.pop();
6025        path.push_key("attributeStatusInfo");
6026        if let Some(value) = &self.attribute_status_info {
6027            Validate::validate_at(value, path, out);
6028        }
6029        path.pop();
6030        path.push_key("attributeType");
6031        if let Some(value) = &self.attribute_type {
6032            Validate::validate_at(value, path, out);
6033        }
6034        path.pop();
6035        path.push_key("attributeValue");
6036        if let Some(value) = &self.attribute_value {
6037            validate::string(value.as_str(), None, Some(2500), path, out);
6038        }
6039        path.pop();
6040        path.push_key("customData");
6041        if let Some(value) = &self.custom_data {
6042            Validate::validate_at(value, path, out);
6043        }
6044        path.pop();
6045    }
6046}
6047
6048/// The OCPP 2.1 `Gradient` data type.
6049#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6050pub struct Gradient {
6051    /// Id of setting
6052    #[serde(deserialize_with = "crate::types::integer::one")]
6053    pub priority: i32,
6054    /// Default ramp rate in seconds (0 if not applicable)
6055    pub gradient: crate::types::Decimal,
6056    /// Soft-start ramp rate in seconds (0 if not applicable)
6057    #[serde(rename = "softGradient")]
6058    pub soft_gradient: crate::types::Decimal,
6059    /// The `customData` member.
6060    #[serde(rename = "customData")]
6061    #[serde(default, skip_serializing_if = "Option::is_none")]
6062    pub custom_data: Option<crate::types::CustomData>,
6063}
6064
6065impl Gradient {
6066    /// Creates a `Gradient` from its required fields.
6067    #[must_use]
6068    pub fn new(
6069        priority: i32,
6070        gradient: impl Into<crate::types::Decimal>,
6071        soft_gradient: impl Into<crate::types::Decimal>,
6072    ) -> Self {
6073        Self {
6074            priority,
6075            gradient: gradient.into(),
6076            soft_gradient: soft_gradient.into(),
6077            custom_data: None,
6078        }
6079    }
6080
6081    /// Sets the optional `customData` field.
6082    #[must_use]
6083    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6084        self.custom_data = Some(value);
6085        self
6086    }
6087}
6088
6089impl Validate for Gradient {
6090    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6091        path.push_key("priority");
6092        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
6093        path.pop();
6094        path.push_key("customData");
6095        if let Some(value) = &self.custom_data {
6096            Validate::validate_at(value, path, out);
6097        }
6098        path.pop();
6099    }
6100}
6101
6102/// The OCPP 2.1 `GradientGet` data type.
6103#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6104pub struct GradientGet {
6105    /// The `gradient` member.
6106    pub gradient: Gradient,
6107    /// Id of setting
6108    pub id: String,
6109    /// The `customData` member.
6110    #[serde(rename = "customData")]
6111    #[serde(default, skip_serializing_if = "Option::is_none")]
6112    pub custom_data: Option<crate::types::CustomData>,
6113}
6114
6115impl GradientGet {
6116    /// Creates a `GradientGet` from its required fields.
6117    #[must_use]
6118    pub fn new(gradient: Gradient, id: impl Into<String>) -> Self {
6119        Self {
6120            gradient,
6121            id: id.into(),
6122            custom_data: None,
6123        }
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 GradientGet {
6135    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6136        path.push_key("gradient");
6137        Validate::validate_at(&self.gradient, path, out);
6138        path.pop();
6139        path.push_key("id");
6140        validate::string(self.id.as_str(), None, Some(36), path, out);
6141        path.pop();
6142        path.push_key("customData");
6143        if let Some(value) = &self.custom_data {
6144            Validate::validate_at(value, path, out);
6145        }
6146        path.pop();
6147    }
6148}
6149
6150/// The OCPP 2.1 `Hysteresis` data type.
6151#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6152pub struct Hysteresis {
6153    /// High value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6154    #[serde(rename = "hysteresisHigh")]
6155    #[serde(default, skip_serializing_if = "Option::is_none")]
6156    pub hysteresis_high: Option<crate::types::Decimal>,
6157    /// Low value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6158    #[serde(rename = "hysteresisLow")]
6159    #[serde(default, skip_serializing_if = "Option::is_none")]
6160    pub hysteresis_low: Option<crate::types::Decimal>,
6161    /// Delay in seconds, once grid parameter within HysteresisLow and HysteresisHigh, for the EV to return to normal operation after a grid event.
6162    #[serde(rename = "hysteresisDelay")]
6163    #[serde(default, skip_serializing_if = "Option::is_none")]
6164    pub hysteresis_delay: Option<crate::types::Decimal>,
6165    /// Set default rate of change (ramp rate %/s) for the EV to return to normal operation after a grid event
6166    #[serde(rename = "hysteresisGradient")]
6167    #[serde(default, skip_serializing_if = "Option::is_none")]
6168    pub hysteresis_gradient: Option<crate::types::Decimal>,
6169    /// The `customData` member.
6170    #[serde(rename = "customData")]
6171    #[serde(default, skip_serializing_if = "Option::is_none")]
6172    pub custom_data: Option<crate::types::CustomData>,
6173}
6174
6175impl Hysteresis {
6176    /// Creates an empty `Hysteresis`. Every field of this type is optional.
6177    #[must_use]
6178    pub fn new() -> Self {
6179        Self::default()
6180    }
6181
6182    /// Sets the optional `hysteresisHigh` field.
6183    #[must_use]
6184    pub fn with_hysteresis_high(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6185        self.hysteresis_high = Some(value.into());
6186        self
6187    }
6188
6189    /// Sets the optional `hysteresisLow` field.
6190    #[must_use]
6191    pub fn with_hysteresis_low(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6192        self.hysteresis_low = Some(value.into());
6193        self
6194    }
6195
6196    /// Sets the optional `hysteresisDelay` field.
6197    #[must_use]
6198    pub fn with_hysteresis_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6199        self.hysteresis_delay = Some(value.into());
6200        self
6201    }
6202
6203    /// Sets the optional `hysteresisGradient` field.
6204    #[must_use]
6205    pub fn with_hysteresis_gradient(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6206        self.hysteresis_gradient = Some(value.into());
6207        self
6208    }
6209
6210    /// Sets the optional `customData` field.
6211    #[must_use]
6212    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6213        self.custom_data = Some(value);
6214        self
6215    }
6216}
6217
6218impl Validate for Hysteresis {
6219    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6220        path.push_key("customData");
6221        if let Some(value) = &self.custom_data {
6222            Validate::validate_at(value, path, out);
6223        }
6224        path.pop();
6225    }
6226}
6227
6228/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
6229///
6230/// The OCPP 2.1 `IdToken` data type.
6231#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6232pub struct IdToken {
6233    /// *(2.1)* IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
6234    #[serde(rename = "idToken")]
6235    pub id_token: String,
6236    /// *(2.1)* Enumeration of possible idToken types. Values defined in Appendix as IdTokenEnumStringType.
6237    pub r#type: String,
6238    /// The `additionalInfo` member.
6239    #[serde(rename = "additionalInfo")]
6240    #[serde(default, skip_serializing_if = "Option::is_none")]
6241    pub additional_info: Option<Vec<AdditionalInfo>>,
6242    /// The `customData` member.
6243    #[serde(rename = "customData")]
6244    #[serde(default, skip_serializing_if = "Option::is_none")]
6245    pub custom_data: Option<crate::types::CustomData>,
6246}
6247
6248impl IdToken {
6249    /// Creates a `IdToken` from its required fields.
6250    #[must_use]
6251    pub fn new(id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
6252        Self {
6253            id_token: id_token.into(),
6254            r#type: r#type.into(),
6255            additional_info: None,
6256            custom_data: None,
6257        }
6258    }
6259
6260    /// Sets the optional `additionalInfo` field.
6261    #[must_use]
6262    pub fn with_additional_info(mut self, value: Vec<AdditionalInfo>) -> Self {
6263        self.additional_info = Some(value);
6264        self
6265    }
6266
6267    /// Sets the optional `customData` field.
6268    #[must_use]
6269    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6270        self.custom_data = Some(value);
6271        self
6272    }
6273}
6274
6275impl Validate for IdToken {
6276    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6277        path.push_key("idToken");
6278        validate::string(self.id_token.as_str(), None, Some(255), path, out);
6279        path.pop();
6280        path.push_key("type");
6281        validate::string(self.r#type.as_str(), None, Some(20), path, out);
6282        path.pop();
6283        path.push_key("additionalInfo");
6284        if let Some(value) = &self.additional_info {
6285            validate::list_len(value.len(), Some(1), None, path, out);
6286            for (index, item) in value.iter().enumerate() {
6287                path.push_index(index);
6288                Validate::validate_at(item, path, out);
6289                path.pop();
6290            }
6291        }
6292        path.pop();
6293        path.push_key("customData");
6294        if let Some(value) = &self.custom_data {
6295            Validate::validate_at(value, path, out);
6296        }
6297        path.pop();
6298    }
6299}
6300
6301/// Contains status information about an identifier.
6302/// 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.
6303///
6304/// The OCPP 2.1 `IdTokenInfo` data type.
6305#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6306pub struct IdTokenInfo {
6307    /// The `status` member.
6308    pub status: AuthorizationStatus,
6309    /// Date and Time after which the token must be considered invalid.
6310    #[serde(rename = "cacheExpiryDateTime")]
6311    #[serde(default, skip_serializing_if = "Option::is_none")]
6312    pub cache_expiry_date_time: Option<crate::types::DateTime>,
6313    /// 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.
6314    #[serde(rename = "chargingPriority")]
6315    #[serde(default, skip_serializing_if = "Option::is_none")]
6316    #[serde(deserialize_with = "crate::types::integer::option")]
6317    pub charging_priority: Option<i32>,
6318    /// The `groupIdToken` member.
6319    #[serde(rename = "groupIdToken")]
6320    #[serde(default, skip_serializing_if = "Option::is_none")]
6321    pub group_id_token: Option<IdToken>,
6322    /// Preferred user interface language of identifier user. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6323    #[serde(default, skip_serializing_if = "Option::is_none")]
6324    pub language1: Option<String>,
6325    /// 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;.
6326    #[serde(default, skip_serializing_if = "Option::is_none")]
6327    pub language2: Option<String>,
6328    /// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
6329    #[serde(rename = "evseId")]
6330    #[serde(default, skip_serializing_if = "Option::is_none")]
6331    #[serde(deserialize_with = "crate::types::integer::option_list")]
6332    pub evse_id: Option<Vec<i32>>,
6333    /// The `personalMessage` member.
6334    #[serde(rename = "personalMessage")]
6335    #[serde(default, skip_serializing_if = "Option::is_none")]
6336    pub personal_message: Option<MessageContent>,
6337    /// The `customData` member.
6338    #[serde(rename = "customData")]
6339    #[serde(default, skip_serializing_if = "Option::is_none")]
6340    pub custom_data: Option<crate::types::CustomData>,
6341}
6342
6343impl IdTokenInfo {
6344    /// Creates a `IdTokenInfo` from its required fields.
6345    #[must_use]
6346    pub fn new(status: AuthorizationStatus) -> Self {
6347        Self {
6348            status,
6349            cache_expiry_date_time: None,
6350            charging_priority: None,
6351            group_id_token: None,
6352            language1: None,
6353            language2: None,
6354            evse_id: None,
6355            personal_message: None,
6356            custom_data: None,
6357        }
6358    }
6359
6360    /// Sets the optional `cacheExpiryDateTime` field.
6361    #[must_use]
6362    pub fn with_cache_expiry_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6363        self.cache_expiry_date_time = Some(value.into());
6364        self
6365    }
6366
6367    /// Sets the optional `chargingPriority` field.
6368    #[must_use]
6369    pub fn with_charging_priority(mut self, value: i32) -> Self {
6370        self.charging_priority = Some(value);
6371        self
6372    }
6373
6374    /// Sets the optional `groupIdToken` field.
6375    #[must_use]
6376    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
6377        self.group_id_token = Some(value);
6378        self
6379    }
6380
6381    /// Sets the optional `language1` field.
6382    #[must_use]
6383    pub fn with_language1(mut self, value: impl Into<String>) -> Self {
6384        self.language1 = Some(value.into());
6385        self
6386    }
6387
6388    /// Sets the optional `language2` field.
6389    #[must_use]
6390    pub fn with_language2(mut self, value: impl Into<String>) -> Self {
6391        self.language2 = Some(value.into());
6392        self
6393    }
6394
6395    /// Sets the optional `evseId` field.
6396    #[must_use]
6397    pub fn with_evse_id(mut self, value: Vec<i32>) -> Self {
6398        self.evse_id = Some(value);
6399        self
6400    }
6401
6402    /// Sets the optional `personalMessage` field.
6403    #[must_use]
6404    pub fn with_personal_message(mut self, value: MessageContent) -> Self {
6405        self.personal_message = Some(value);
6406        self
6407    }
6408
6409    /// Sets the optional `customData` field.
6410    #[must_use]
6411    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6412        self.custom_data = Some(value);
6413        self
6414    }
6415}
6416
6417impl Validate for IdTokenInfo {
6418    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6419        path.push_key("status");
6420        Validate::validate_at(&self.status, path, out);
6421        path.pop();
6422        path.push_key("groupIdToken");
6423        if let Some(value) = &self.group_id_token {
6424            Validate::validate_at(value, path, out);
6425        }
6426        path.pop();
6427        path.push_key("language1");
6428        if let Some(value) = &self.language1 {
6429            validate::string(value.as_str(), None, Some(8), path, out);
6430        }
6431        path.pop();
6432        path.push_key("language2");
6433        if let Some(value) = &self.language2 {
6434            validate::string(value.as_str(), None, Some(8), path, out);
6435        }
6436        path.pop();
6437        path.push_key("evseId");
6438        if let Some(value) = &self.evse_id {
6439            validate::list_len(value.len(), Some(1), None, path, out);
6440            for (index, item) in value.iter().enumerate() {
6441                path.push_index(index);
6442                validate::int_range(i64::from(*item), Some(0), None, path, out);
6443                path.pop();
6444            }
6445        }
6446        path.pop();
6447        path.push_key("personalMessage");
6448        if let Some(value) = &self.personal_message {
6449            Validate::validate_at(value, path, out);
6450        }
6451        path.pop();
6452        path.push_key("customData");
6453        if let Some(value) = &self.custom_data {
6454            Validate::validate_at(value, path, out);
6455        }
6456        path.pop();
6457    }
6458}
6459
6460/// The OCPP 2.1 `LimitAtSoC` data type.
6461#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6462pub struct LimitAtSoC {
6463    /// The SoC value beyond which the charging rate limit should be applied.
6464    #[serde(deserialize_with = "crate::types::integer::one")]
6465    pub soc: i32,
6466    /// Charging rate limit beyond the SoC value.
6467    /// The unit is defined by _chargingSchedule.chargingRateUnit_.
6468    pub limit: crate::types::Decimal,
6469    /// The `customData` member.
6470    #[serde(rename = "customData")]
6471    #[serde(default, skip_serializing_if = "Option::is_none")]
6472    pub custom_data: Option<crate::types::CustomData>,
6473}
6474
6475impl LimitAtSoC {
6476    /// Creates a `LimitAtSoC` from its required fields.
6477    #[must_use]
6478    pub fn new(soc: i32, limit: impl Into<crate::types::Decimal>) -> Self {
6479        Self {
6480            soc,
6481            limit: limit.into(),
6482            custom_data: None,
6483        }
6484    }
6485
6486    /// Sets the optional `customData` field.
6487    #[must_use]
6488    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6489        self.custom_data = Some(value);
6490        self
6491    }
6492}
6493
6494impl Validate for LimitAtSoC {
6495    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6496        path.push_key("soc");
6497        validate::int_range(i64::from(self.soc), Some(0), Some(100), path, out);
6498        path.pop();
6499        path.push_key("customData");
6500        if let Some(value) = &self.custom_data {
6501            Validate::validate_at(value, path, out);
6502        }
6503        path.pop();
6504    }
6505}
6506
6507/// The OCPP 2.1 `LimitMaxDischarge` data type.
6508#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6509pub struct LimitMaxDischarge {
6510    /// Priority of setting (0=highest)
6511    #[serde(deserialize_with = "crate::types::integer::one")]
6512    pub priority: i32,
6513    /// Only for PowerMonitoring. +
6514    ///     The value specifies a percentage (0 to 100) of the rated maximum discharge power of EV.
6515    ///     The PowerMonitoring curve becomes active when power exceeds this percentage.
6516    #[serde(rename = "pctMaxDischargePower")]
6517    #[serde(default, skip_serializing_if = "Option::is_none")]
6518    pub pct_max_discharge_power: Option<crate::types::Decimal>,
6519    /// The `powerMonitoringMustTrip` member.
6520    #[serde(rename = "powerMonitoringMustTrip")]
6521    #[serde(default, skip_serializing_if = "Option::is_none")]
6522    pub power_monitoring_must_trip: Option<DERCurve>,
6523    /// Time when this setting becomes active
6524    #[serde(rename = "startTime")]
6525    #[serde(default, skip_serializing_if = "Option::is_none")]
6526    pub start_time: Option<crate::types::DateTime>,
6527    /// Duration in seconds that this setting is active
6528    #[serde(default, skip_serializing_if = "Option::is_none")]
6529    pub duration: Option<crate::types::Decimal>,
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 LimitMaxDischarge {
6537    /// Creates a `LimitMaxDischarge` from its required fields.
6538    #[must_use]
6539    pub fn new(priority: i32) -> Self {
6540        Self {
6541            priority,
6542            pct_max_discharge_power: None,
6543            power_monitoring_must_trip: None,
6544            start_time: None,
6545            duration: None,
6546            custom_data: None,
6547        }
6548    }
6549
6550    /// Sets the optional `pctMaxDischargePower` field.
6551    #[must_use]
6552    pub fn with_pct_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6553        self.pct_max_discharge_power = Some(value.into());
6554        self
6555    }
6556
6557    /// Sets the optional `powerMonitoringMustTrip` field.
6558    #[must_use]
6559    pub fn with_power_monitoring_must_trip(mut self, value: DERCurve) -> Self {
6560        self.power_monitoring_must_trip = Some(value);
6561        self
6562    }
6563
6564    /// Sets the optional `startTime` field.
6565    #[must_use]
6566    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6567        self.start_time = Some(value.into());
6568        self
6569    }
6570
6571    /// Sets the optional `duration` field.
6572    #[must_use]
6573    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6574        self.duration = Some(value.into());
6575        self
6576    }
6577
6578    /// Sets the optional `customData` field.
6579    #[must_use]
6580    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6581        self.custom_data = Some(value);
6582        self
6583    }
6584}
6585
6586impl Validate for LimitMaxDischarge {
6587    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6588        path.push_key("priority");
6589        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
6590        path.pop();
6591        path.push_key("powerMonitoringMustTrip");
6592        if let Some(value) = &self.power_monitoring_must_trip {
6593            Validate::validate_at(value, path, out);
6594        }
6595        path.pop();
6596        path.push_key("customData");
6597        if let Some(value) = &self.custom_data {
6598            Validate::validate_at(value, path, out);
6599        }
6600        path.pop();
6601    }
6602}
6603
6604/// The OCPP 2.1 `LimitMaxDischargeGet` data type.
6605#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6606pub struct LimitMaxDischargeGet {
6607    /// Id of setting
6608    pub id: String,
6609    /// True if setting is a default control.
6610    #[serde(rename = "isDefault")]
6611    pub is_default: bool,
6612    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
6613    #[serde(rename = "isSuperseded")]
6614    pub is_superseded: bool,
6615    /// The `limitMaxDischarge` member.
6616    #[serde(rename = "limitMaxDischarge")]
6617    pub limit_max_discharge: LimitMaxDischarge,
6618    /// The `customData` member.
6619    #[serde(rename = "customData")]
6620    #[serde(default, skip_serializing_if = "Option::is_none")]
6621    pub custom_data: Option<crate::types::CustomData>,
6622}
6623
6624impl LimitMaxDischargeGet {
6625    /// Creates a `LimitMaxDischargeGet` from its required fields.
6626    #[must_use]
6627    pub fn new(
6628        id: impl Into<String>,
6629        is_default: bool,
6630        is_superseded: bool,
6631        limit_max_discharge: LimitMaxDischarge,
6632    ) -> Self {
6633        Self {
6634            id: id.into(),
6635            is_default,
6636            is_superseded,
6637            limit_max_discharge,
6638            custom_data: None,
6639        }
6640    }
6641
6642    /// Sets the optional `customData` field.
6643    #[must_use]
6644    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6645        self.custom_data = Some(value);
6646        self
6647    }
6648}
6649
6650impl Validate for LimitMaxDischargeGet {
6651    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6652        path.push_key("id");
6653        validate::string(self.id.as_str(), None, Some(36), path, out);
6654        path.pop();
6655        path.push_key("limitMaxDischarge");
6656        Validate::validate_at(&self.limit_max_discharge, path, out);
6657        path.pop();
6658        path.push_key("customData");
6659        if let Some(value) = &self.custom_data {
6660            Validate::validate_at(value, path, out);
6661        }
6662        path.pop();
6663    }
6664}
6665
6666/// Generic class for the configuration of logging entries.
6667///
6668/// The OCPP 2.1 `LogParameters` data type.
6669#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6670pub struct LogParameters {
6671    /// The URL of the location at the remote system where the log should be stored.
6672    #[serde(rename = "remoteLocation")]
6673    pub remote_location: String,
6674    /// This contains the date and time of the oldest logging information to include in the diagnostics.
6675    #[serde(rename = "oldestTimestamp")]
6676    #[serde(default, skip_serializing_if = "Option::is_none")]
6677    pub oldest_timestamp: Option<crate::types::DateTime>,
6678    /// This contains the date and time of the latest logging information to include in the diagnostics.
6679    #[serde(rename = "latestTimestamp")]
6680    #[serde(default, skip_serializing_if = "Option::is_none")]
6681    pub latest_timestamp: Option<crate::types::DateTime>,
6682    /// The `customData` member.
6683    #[serde(rename = "customData")]
6684    #[serde(default, skip_serializing_if = "Option::is_none")]
6685    pub custom_data: Option<crate::types::CustomData>,
6686}
6687
6688impl LogParameters {
6689    /// Creates a `LogParameters` from its required fields.
6690    #[must_use]
6691    pub fn new(remote_location: impl Into<String>) -> Self {
6692        Self {
6693            remote_location: remote_location.into(),
6694            oldest_timestamp: None,
6695            latest_timestamp: None,
6696            custom_data: None,
6697        }
6698    }
6699
6700    /// Sets the optional `oldestTimestamp` field.
6701    #[must_use]
6702    pub fn with_oldest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6703        self.oldest_timestamp = Some(value.into());
6704        self
6705    }
6706
6707    /// Sets the optional `latestTimestamp` field.
6708    #[must_use]
6709    pub fn with_latest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6710        self.latest_timestamp = Some(value.into());
6711        self
6712    }
6713
6714    /// Sets the optional `customData` field.
6715    #[must_use]
6716    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6717        self.custom_data = Some(value);
6718        self
6719    }
6720}
6721
6722impl Validate for LogParameters {
6723    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6724        path.push_key("remoteLocation");
6725        validate::string(self.remote_location.as_str(), None, Some(2000), path, out);
6726        path.pop();
6727        path.push_key("customData");
6728        if let Some(value) = &self.custom_data {
6729            Validate::validate_at(value, path, out);
6730        }
6731        path.pop();
6732    }
6733}
6734
6735/// Contains message details, for a message to be displayed on a Charging Station.
6736///
6737/// The OCPP 2.1 `MessageContent` data type.
6738#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6739pub struct MessageContent {
6740    /// The `format` member.
6741    pub format: MessageFormat,
6742    /// *(2.1)* Required. Message contents. +
6743    /// Maximum length supported by Charging Station is given in OCPPCommCtrlr.FieldLength\["MessageContentType.content"\].
6744    ///     Maximum length defaults to 1024.
6745    pub content: String,
6746    /// Message language identifier. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6747    #[serde(default, skip_serializing_if = "Option::is_none")]
6748    pub language: Option<String>,
6749    /// The `customData` member.
6750    #[serde(rename = "customData")]
6751    #[serde(default, skip_serializing_if = "Option::is_none")]
6752    pub custom_data: Option<crate::types::CustomData>,
6753}
6754
6755impl MessageContent {
6756    /// Creates a `MessageContent` from its required fields.
6757    #[must_use]
6758    pub fn new(format: MessageFormat, content: impl Into<String>) -> Self {
6759        Self {
6760            format,
6761            content: content.into(),
6762            language: None,
6763            custom_data: None,
6764        }
6765    }
6766
6767    /// Sets the optional `language` field.
6768    #[must_use]
6769    pub fn with_language(mut self, value: impl Into<String>) -> Self {
6770        self.language = Some(value.into());
6771        self
6772    }
6773
6774    /// Sets the optional `customData` field.
6775    #[must_use]
6776    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6777        self.custom_data = Some(value);
6778        self
6779    }
6780}
6781
6782impl Validate for MessageContent {
6783    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6784        path.push_key("format");
6785        Validate::validate_at(&self.format, path, out);
6786        path.pop();
6787        path.push_key("content");
6788        validate::string(self.content.as_str(), None, Some(1024), path, out);
6789        path.pop();
6790        path.push_key("language");
6791        if let Some(value) = &self.language {
6792            validate::string(value.as_str(), None, Some(8), path, out);
6793        }
6794        path.pop();
6795        path.push_key("customData");
6796        if let Some(value) = &self.custom_data {
6797            Validate::validate_at(value, path, out);
6798        }
6799        path.pop();
6800    }
6801}
6802
6803/// Contains message details, for a message to be displayed on a Charging Station.
6804///
6805/// The OCPP 2.1 `MessageInfo` data type.
6806#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6807pub struct MessageInfo {
6808    /// Unique id within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
6809    #[serde(deserialize_with = "crate::types::integer::one")]
6810    pub id: i32,
6811    /// The `priority` member.
6812    pub priority: MessagePriority,
6813    /// The `message` member.
6814    pub message: MessageContent,
6815    /// The `display` member.
6816    #[serde(default, skip_serializing_if = "Option::is_none")]
6817    pub display: Option<Component>,
6818    /// The `state` member.
6819    #[serde(default, skip_serializing_if = "Option::is_none")]
6820    pub state: Option<MessageState>,
6821    /// From what date-time should this message be shown. If omitted: directly.
6822    #[serde(rename = "startDateTime")]
6823    #[serde(default, skip_serializing_if = "Option::is_none")]
6824    pub start_date_time: Option<crate::types::DateTime>,
6825    /// Until what date-time should this message be shown, after this date/time this message SHALL be removed.
6826    #[serde(rename = "endDateTime")]
6827    #[serde(default, skip_serializing_if = "Option::is_none")]
6828    pub end_date_time: Option<crate::types::DateTime>,
6829    /// During which transaction shall this message be shown.
6830    /// Message SHALL be removed by the Charging Station after transaction has
6831    /// ended.
6832    #[serde(rename = "transactionId")]
6833    #[serde(default, skip_serializing_if = "Option::is_none")]
6834    pub transaction_id: Option<String>,
6835    /// The `messageExtra` member.
6836    #[serde(rename = "messageExtra")]
6837    #[serde(default, skip_serializing_if = "Option::is_none")]
6838    pub message_extra: Option<Vec<MessageContent>>,
6839    /// The `customData` member.
6840    #[serde(rename = "customData")]
6841    #[serde(default, skip_serializing_if = "Option::is_none")]
6842    pub custom_data: Option<crate::types::CustomData>,
6843}
6844
6845impl MessageInfo {
6846    /// Creates a `MessageInfo` from its required fields.
6847    #[must_use]
6848    pub fn new(id: i32, priority: MessagePriority, message: MessageContent) -> Self {
6849        Self {
6850            id,
6851            priority,
6852            message,
6853            display: None,
6854            state: None,
6855            start_date_time: None,
6856            end_date_time: None,
6857            transaction_id: None,
6858            message_extra: None,
6859            custom_data: None,
6860        }
6861    }
6862
6863    /// Sets the optional `display` field.
6864    #[must_use]
6865    pub fn with_display(mut self, value: Component) -> Self {
6866        self.display = Some(value);
6867        self
6868    }
6869
6870    /// Sets the optional `state` field.
6871    #[must_use]
6872    pub fn with_state(mut self, value: MessageState) -> Self {
6873        self.state = Some(value);
6874        self
6875    }
6876
6877    /// Sets the optional `startDateTime` field.
6878    #[must_use]
6879    pub fn with_start_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6880        self.start_date_time = Some(value.into());
6881        self
6882    }
6883
6884    /// Sets the optional `endDateTime` field.
6885    #[must_use]
6886    pub fn with_end_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6887        self.end_date_time = Some(value.into());
6888        self
6889    }
6890
6891    /// Sets the optional `transactionId` field.
6892    #[must_use]
6893    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
6894        self.transaction_id = Some(value.into());
6895        self
6896    }
6897
6898    /// Sets the optional `messageExtra` field.
6899    #[must_use]
6900    pub fn with_message_extra(mut self, value: Vec<MessageContent>) -> Self {
6901        self.message_extra = Some(value);
6902        self
6903    }
6904
6905    /// Sets the optional `customData` field.
6906    #[must_use]
6907    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6908        self.custom_data = Some(value);
6909        self
6910    }
6911}
6912
6913impl Validate for MessageInfo {
6914    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6915        path.push_key("id");
6916        validate::int_range(i64::from(self.id), Some(0), None, path, out);
6917        path.pop();
6918        path.push_key("priority");
6919        Validate::validate_at(&self.priority, path, out);
6920        path.pop();
6921        path.push_key("message");
6922        Validate::validate_at(&self.message, path, out);
6923        path.pop();
6924        path.push_key("display");
6925        if let Some(value) = &self.display {
6926            Validate::validate_at(value, path, out);
6927        }
6928        path.pop();
6929        path.push_key("state");
6930        if let Some(value) = &self.state {
6931            Validate::validate_at(value, path, out);
6932        }
6933        path.pop();
6934        path.push_key("transactionId");
6935        if let Some(value) = &self.transaction_id {
6936            validate::string(value.as_str(), None, Some(36), path, out);
6937        }
6938        path.pop();
6939        path.push_key("messageExtra");
6940        if let Some(value) = &self.message_extra {
6941            validate::list_len(value.len(), Some(1), Some(4), path, out);
6942            for (index, item) in value.iter().enumerate() {
6943                path.push_index(index);
6944                Validate::validate_at(item, path, out);
6945                path.pop();
6946            }
6947        }
6948        path.pop();
6949        path.push_key("customData");
6950        if let Some(value) = &self.custom_data {
6951            Validate::validate_at(value, path, out);
6952        }
6953        path.pop();
6954    }
6955}
6956
6957/// 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.
6958///
6959/// The OCPP 2.1 `MeterValue` data type.
6960#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6961pub struct MeterValue {
6962    /// The `sampledValue` member.
6963    #[serde(rename = "sampledValue")]
6964    pub sampled_value: Vec<SampledValue>,
6965    /// Timestamp for measured value(s).
6966    pub timestamp: crate::types::DateTime,
6967    /// The `customData` member.
6968    #[serde(rename = "customData")]
6969    #[serde(default, skip_serializing_if = "Option::is_none")]
6970    pub custom_data: Option<crate::types::CustomData>,
6971}
6972
6973impl MeterValue {
6974    /// Creates a `MeterValue` from its required fields.
6975    #[must_use]
6976    pub fn new(
6977        sampled_value: Vec<SampledValue>,
6978        timestamp: impl Into<crate::types::DateTime>,
6979    ) -> Self {
6980        Self {
6981            sampled_value,
6982            timestamp: timestamp.into(),
6983            custom_data: None,
6984        }
6985    }
6986
6987    /// Sets the optional `customData` field.
6988    #[must_use]
6989    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6990        self.custom_data = Some(value);
6991        self
6992    }
6993}
6994
6995impl Validate for MeterValue {
6996    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6997        path.push_key("sampledValue");
6998        validate::list_len(self.sampled_value.len(), Some(1), None, path, out);
6999        for (index, item) in self.sampled_value.iter().enumerate() {
7000            path.push_index(index);
7001            Validate::validate_at(item, path, out);
7002            path.pop();
7003        }
7004        path.pop();
7005        path.push_key("customData");
7006        if let Some(value) = &self.custom_data {
7007            Validate::validate_at(value, path, out);
7008        }
7009        path.pop();
7010    }
7011}
7012
7013/// Defines parameters required for initiating and maintaining wireless communication with other devices.
7014///
7015/// The OCPP 2.1 `Modem` data type.
7016#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7017pub struct Modem {
7018    /// This contains the ICCID of the modem’s SIM card.
7019    #[serde(default, skip_serializing_if = "Option::is_none")]
7020    pub iccid: Option<String>,
7021    /// This contains the IMSI of the modem’s SIM card.
7022    #[serde(default, skip_serializing_if = "Option::is_none")]
7023    pub imsi: Option<String>,
7024    /// The `customData` member.
7025    #[serde(rename = "customData")]
7026    #[serde(default, skip_serializing_if = "Option::is_none")]
7027    pub custom_data: Option<crate::types::CustomData>,
7028}
7029
7030impl Modem {
7031    /// Creates an empty `Modem`. Every field of this type is optional.
7032    #[must_use]
7033    pub fn new() -> Self {
7034        Self::default()
7035    }
7036
7037    /// Sets the optional `iccid` field.
7038    #[must_use]
7039    pub fn with_iccid(mut self, value: impl Into<String>) -> Self {
7040        self.iccid = Some(value.into());
7041        self
7042    }
7043
7044    /// Sets the optional `imsi` field.
7045    #[must_use]
7046    pub fn with_imsi(mut self, value: impl Into<String>) -> Self {
7047        self.imsi = Some(value.into());
7048        self
7049    }
7050
7051    /// Sets the optional `customData` field.
7052    #[must_use]
7053    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7054        self.custom_data = Some(value);
7055        self
7056    }
7057}
7058
7059impl Validate for Modem {
7060    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7061        path.push_key("iccid");
7062        if let Some(value) = &self.iccid {
7063            validate::string(value.as_str(), None, Some(20), path, out);
7064        }
7065        path.pop();
7066        path.push_key("imsi");
7067        if let Some(value) = &self.imsi {
7068            validate::string(value.as_str(), None, Some(20), path, out);
7069        }
7070        path.pop();
7071        path.push_key("customData");
7072        if let Some(value) = &self.custom_data {
7073            Validate::validate_at(value, path, out);
7074        }
7075        path.pop();
7076    }
7077}
7078
7079/// Class to hold parameters of SetVariableMonitoring request.
7080///
7081/// The OCPP 2.1 `MonitoringData` data type.
7082#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7083pub struct MonitoringData {
7084    /// The `component` member.
7085    pub component: Component,
7086    /// The `variable` member.
7087    pub variable: Variable,
7088    /// The `variableMonitoring` member.
7089    #[serde(rename = "variableMonitoring")]
7090    pub variable_monitoring: Vec<VariableMonitoring>,
7091    /// The `customData` member.
7092    #[serde(rename = "customData")]
7093    #[serde(default, skip_serializing_if = "Option::is_none")]
7094    pub custom_data: Option<crate::types::CustomData>,
7095}
7096
7097impl MonitoringData {
7098    /// Creates a `MonitoringData` from its required fields.
7099    #[must_use]
7100    pub fn new(
7101        component: Component,
7102        variable: Variable,
7103        variable_monitoring: Vec<VariableMonitoring>,
7104    ) -> Self {
7105        Self {
7106            component,
7107            variable,
7108            variable_monitoring,
7109            custom_data: None,
7110        }
7111    }
7112
7113    /// Sets the optional `customData` field.
7114    #[must_use]
7115    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7116        self.custom_data = Some(value);
7117        self
7118    }
7119}
7120
7121impl Validate for MonitoringData {
7122    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7123        path.push_key("component");
7124        Validate::validate_at(&self.component, path, out);
7125        path.pop();
7126        path.push_key("variable");
7127        Validate::validate_at(&self.variable, path, out);
7128        path.pop();
7129        path.push_key("variableMonitoring");
7130        validate::list_len(self.variable_monitoring.len(), Some(1), None, path, out);
7131        for (index, item) in self.variable_monitoring.iter().enumerate() {
7132            path.push_index(index);
7133            Validate::validate_at(item, path, out);
7134            path.pop();
7135        }
7136        path.pop();
7137        path.push_key("customData");
7138        if let Some(value) = &self.custom_data {
7139            Validate::validate_at(value, path, out);
7140        }
7141        path.pop();
7142    }
7143}
7144
7145/// The NetworkConnectionProfile defines the functional and technical parameters of a communication link.
7146///
7147/// The OCPP 2.1 `NetworkConnectionProfile` data type.
7148#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7149pub struct NetworkConnectionProfile {
7150    /// The `ocppInterface` member.
7151    #[serde(rename = "ocppInterface")]
7152    pub ocpp_interface: OCPPInterface,
7153    /// The `ocppTransport` member.
7154    #[serde(rename = "ocppTransport")]
7155    pub ocpp_transport: OCPPTransport,
7156    /// Duration in seconds before a message send by the Charging Station via this network connection times-out.
7157    /// The best setting depends on the underlying network and response times of the CSMS.
7158    /// If you are looking for a some guideline: use 30 seconds as a starting point.
7159    #[serde(rename = "messageTimeout")]
7160    #[serde(deserialize_with = "crate::types::integer::one")]
7161    pub message_timeout: i32,
7162    /// URL of the CSMS(s) that this Charging Station communicates with, without the Charging Station identity part. +
7163    /// The SecurityCtrlr.Identity field is appended to _ocppCsmsUrl_ to provide the full websocket URL.
7164    #[serde(rename = "ocppCsmsUrl")]
7165    pub ocpp_csms_url: String,
7166    /// This field specifies the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
7167    #[serde(rename = "securityProfile")]
7168    #[serde(deserialize_with = "crate::types::integer::one")]
7169    pub security_profile: i32,
7170    /// The `apn` member.
7171    #[serde(default, skip_serializing_if = "Option::is_none")]
7172    pub apn: Option<APN>,
7173    /// The `ocppVersion` member.
7174    #[serde(rename = "ocppVersion")]
7175    #[serde(default, skip_serializing_if = "Option::is_none")]
7176    pub ocpp_version: Option<OCPPVersion>,
7177    /// *(2.1)* Charging Station identity to be used as the basic authentication username.
7178    #[serde(default, skip_serializing_if = "Option::is_none")]
7179    pub identity: Option<String>,
7180    /// *(2.1)* BasicAuthPassword to use for security profile 1 or 2.
7181    #[serde(rename = "basicAuthPassword")]
7182    #[serde(default, skip_serializing_if = "Option::is_none")]
7183    pub basic_auth_password: Option<String>,
7184    /// The `vpn` member.
7185    #[serde(default, skip_serializing_if = "Option::is_none")]
7186    pub vpn: Option<VPN>,
7187    /// The `customData` member.
7188    #[serde(rename = "customData")]
7189    #[serde(default, skip_serializing_if = "Option::is_none")]
7190    pub custom_data: Option<crate::types::CustomData>,
7191}
7192
7193impl NetworkConnectionProfile {
7194    /// Creates a `NetworkConnectionProfile` from its required fields.
7195    #[must_use]
7196    pub fn new(
7197        ocpp_interface: OCPPInterface,
7198        ocpp_transport: OCPPTransport,
7199        message_timeout: i32,
7200        ocpp_csms_url: impl Into<String>,
7201        security_profile: i32,
7202    ) -> Self {
7203        Self {
7204            ocpp_interface,
7205            ocpp_transport,
7206            message_timeout,
7207            ocpp_csms_url: ocpp_csms_url.into(),
7208            security_profile,
7209            apn: None,
7210            ocpp_version: None,
7211            identity: None,
7212            basic_auth_password: None,
7213            vpn: None,
7214            custom_data: None,
7215        }
7216    }
7217
7218    /// Sets the optional `apn` field.
7219    #[must_use]
7220    pub fn with_apn(mut self, value: APN) -> Self {
7221        self.apn = Some(value);
7222        self
7223    }
7224
7225    /// Sets the optional `ocppVersion` field.
7226    #[must_use]
7227    pub fn with_ocpp_version(mut self, value: OCPPVersion) -> Self {
7228        self.ocpp_version = Some(value);
7229        self
7230    }
7231
7232    /// Sets the optional `identity` field.
7233    #[must_use]
7234    pub fn with_identity(mut self, value: impl Into<String>) -> Self {
7235        self.identity = Some(value.into());
7236        self
7237    }
7238
7239    /// Sets the optional `basicAuthPassword` field.
7240    #[must_use]
7241    pub fn with_basic_auth_password(mut self, value: impl Into<String>) -> Self {
7242        self.basic_auth_password = Some(value.into());
7243        self
7244    }
7245
7246    /// Sets the optional `vpn` field.
7247    #[must_use]
7248    pub fn with_vpn(mut self, value: VPN) -> Self {
7249        self.vpn = Some(value);
7250        self
7251    }
7252
7253    /// Sets the optional `customData` field.
7254    #[must_use]
7255    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7256        self.custom_data = Some(value);
7257        self
7258    }
7259}
7260
7261impl Validate for NetworkConnectionProfile {
7262    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7263        path.push_key("ocppInterface");
7264        Validate::validate_at(&self.ocpp_interface, path, out);
7265        path.pop();
7266        path.push_key("ocppTransport");
7267        Validate::validate_at(&self.ocpp_transport, path, out);
7268        path.pop();
7269        path.push_key("ocppCsmsUrl");
7270        validate::string(self.ocpp_csms_url.as_str(), None, Some(2000), path, out);
7271        path.pop();
7272        path.push_key("securityProfile");
7273        validate::int_range(i64::from(self.security_profile), Some(0), None, path, out);
7274        path.pop();
7275        path.push_key("apn");
7276        if let Some(value) = &self.apn {
7277            Validate::validate_at(value, path, out);
7278        }
7279        path.pop();
7280        path.push_key("ocppVersion");
7281        if let Some(value) = &self.ocpp_version {
7282            Validate::validate_at(value, path, out);
7283        }
7284        path.pop();
7285        path.push_key("identity");
7286        if let Some(value) = &self.identity {
7287            validate::string(value.as_str(), None, Some(48), path, out);
7288        }
7289        path.pop();
7290        path.push_key("basicAuthPassword");
7291        if let Some(value) = &self.basic_auth_password {
7292            validate::string(value.as_str(), None, Some(64), path, out);
7293        }
7294        path.pop();
7295        path.push_key("vpn");
7296        if let Some(value) = &self.vpn {
7297            Validate::validate_at(value, path, out);
7298        }
7299        path.pop();
7300        path.push_key("customData");
7301        if let Some(value) = &self.custom_data {
7302            Validate::validate_at(value, path, out);
7303        }
7304        path.pop();
7305    }
7306}
7307
7308/// Information about a certificate for an OCSP check.
7309///
7310/// The OCPP 2.1 `OCSPRequestData` data type.
7311#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7312pub struct OCSPRequestData {
7313    /// The `hashAlgorithm` member.
7314    #[serde(rename = "hashAlgorithm")]
7315    pub hash_algorithm: HashAlgorithm,
7316    /// The hash of the issuer’s distinguished
7317    /// name (DN), that must be calculated over the DER
7318    /// encoding of the issuer’s name field in the certificate
7319    /// being checked.
7320    #[serde(rename = "issuerNameHash")]
7321    pub issuer_name_hash: String,
7322    /// The hash of the DER encoded public key:
7323    /// the value (excluding tag and length) of the subject
7324    /// public key field in the issuer’s certificate.
7325    #[serde(rename = "issuerKeyHash")]
7326    pub issuer_key_hash: String,
7327    /// The string representation of the
7328    /// hexadecimal value of the serial number without the
7329    /// prefix "0x" and without leading zeroes.
7330    #[serde(rename = "serialNumber")]
7331    pub serial_number: String,
7332    /// This contains the responder URL (Case insensitive).
7333    #[serde(rename = "responderURL")]
7334    pub responder_url: String,
7335    /// The `customData` member.
7336    #[serde(rename = "customData")]
7337    #[serde(default, skip_serializing_if = "Option::is_none")]
7338    pub custom_data: Option<crate::types::CustomData>,
7339}
7340
7341impl OCSPRequestData {
7342    /// Creates a `OCSPRequestData` from its required fields.
7343    #[must_use]
7344    pub fn new(
7345        hash_algorithm: HashAlgorithm,
7346        issuer_name_hash: impl Into<String>,
7347        issuer_key_hash: impl Into<String>,
7348        serial_number: impl Into<String>,
7349        responder_url: impl Into<String>,
7350    ) -> Self {
7351        Self {
7352            hash_algorithm,
7353            issuer_name_hash: issuer_name_hash.into(),
7354            issuer_key_hash: issuer_key_hash.into(),
7355            serial_number: serial_number.into(),
7356            responder_url: responder_url.into(),
7357            custom_data: None,
7358        }
7359    }
7360
7361    /// Sets the optional `customData` field.
7362    #[must_use]
7363    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7364        self.custom_data = Some(value);
7365        self
7366    }
7367}
7368
7369impl Validate for OCSPRequestData {
7370    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7371        path.push_key("hashAlgorithm");
7372        Validate::validate_at(&self.hash_algorithm, path, out);
7373        path.pop();
7374        path.push_key("issuerNameHash");
7375        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
7376        path.pop();
7377        path.push_key("issuerKeyHash");
7378        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
7379        path.pop();
7380        path.push_key("serialNumber");
7381        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
7382        path.pop();
7383        path.push_key("responderURL");
7384        validate::string(self.responder_url.as_str(), None, Some(2000), path, out);
7385        path.pop();
7386        path.push_key("customData");
7387        if let Some(value) = &self.custom_data {
7388            Validate::validate_at(value, path, out);
7389        }
7390        path.pop();
7391    }
7392}
7393
7394/// Part of ISO 15118-20 price schedule.
7395///
7396/// The OCPP 2.1 `OverstayRule` data type.
7397#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7398pub struct OverstayRule {
7399    /// The `overstayFee` member.
7400    #[serde(rename = "overstayFee")]
7401    pub overstay_fee: RationalNumber,
7402    /// Time in seconds after trigger of the parent Overstay Rules for this particular fee to apply.
7403    #[serde(rename = "startTime")]
7404    #[serde(deserialize_with = "crate::types::integer::one")]
7405    pub start_time: i32,
7406    /// Time till overstay will be reapplied
7407    #[serde(rename = "overstayFeePeriod")]
7408    #[serde(deserialize_with = "crate::types::integer::one")]
7409    pub overstay_fee_period: i32,
7410    /// Human readable string to identify the overstay rule.
7411    #[serde(rename = "overstayRuleDescription")]
7412    #[serde(default, skip_serializing_if = "Option::is_none")]
7413    pub overstay_rule_description: Option<String>,
7414    /// The `customData` member.
7415    #[serde(rename = "customData")]
7416    #[serde(default, skip_serializing_if = "Option::is_none")]
7417    pub custom_data: Option<crate::types::CustomData>,
7418}
7419
7420impl OverstayRule {
7421    /// Creates a `OverstayRule` from its required fields.
7422    #[must_use]
7423    pub fn new(overstay_fee: RationalNumber, start_time: i32, overstay_fee_period: i32) -> Self {
7424        Self {
7425            overstay_fee,
7426            start_time,
7427            overstay_fee_period,
7428            overstay_rule_description: None,
7429            custom_data: None,
7430        }
7431    }
7432
7433    /// Sets the optional `overstayRuleDescription` field.
7434    #[must_use]
7435    pub fn with_overstay_rule_description(mut self, value: impl Into<String>) -> Self {
7436        self.overstay_rule_description = Some(value.into());
7437        self
7438    }
7439
7440    /// Sets the optional `customData` field.
7441    #[must_use]
7442    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7443        self.custom_data = Some(value);
7444        self
7445    }
7446}
7447
7448impl Validate for OverstayRule {
7449    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7450        path.push_key("overstayFee");
7451        Validate::validate_at(&self.overstay_fee, path, out);
7452        path.pop();
7453        path.push_key("overstayRuleDescription");
7454        if let Some(value) = &self.overstay_rule_description {
7455            validate::string(value.as_str(), None, Some(32), path, out);
7456        }
7457        path.pop();
7458        path.push_key("customData");
7459        if let Some(value) = &self.custom_data {
7460            Validate::validate_at(value, path, out);
7461        }
7462        path.pop();
7463    }
7464}
7465
7466/// Part of ISO 15118-20 price schedule.
7467///
7468/// The OCPP 2.1 `OverstayRuleList` data type.
7469#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7470pub struct OverstayRuleList {
7471    /// The `overstayRule` member.
7472    #[serde(rename = "overstayRule")]
7473    pub overstay_rule: Vec<OverstayRule>,
7474    /// The `overstayPowerThreshold` member.
7475    #[serde(rename = "overstayPowerThreshold")]
7476    #[serde(default, skip_serializing_if = "Option::is_none")]
7477    pub overstay_power_threshold: Option<RationalNumber>,
7478    /// Time till overstay is applied in seconds.
7479    #[serde(rename = "overstayTimeThreshold")]
7480    #[serde(default, skip_serializing_if = "Option::is_none")]
7481    #[serde(deserialize_with = "crate::types::integer::option")]
7482    pub overstay_time_threshold: Option<i32>,
7483    /// The `customData` member.
7484    #[serde(rename = "customData")]
7485    #[serde(default, skip_serializing_if = "Option::is_none")]
7486    pub custom_data: Option<crate::types::CustomData>,
7487}
7488
7489impl OverstayRuleList {
7490    /// Creates a `OverstayRuleList` from its required fields.
7491    #[must_use]
7492    pub fn new(overstay_rule: Vec<OverstayRule>) -> Self {
7493        Self {
7494            overstay_rule,
7495            overstay_power_threshold: None,
7496            overstay_time_threshold: None,
7497            custom_data: None,
7498        }
7499    }
7500
7501    /// Sets the optional `overstayPowerThreshold` field.
7502    #[must_use]
7503    pub fn with_overstay_power_threshold(mut self, value: RationalNumber) -> Self {
7504        self.overstay_power_threshold = Some(value);
7505        self
7506    }
7507
7508    /// Sets the optional `overstayTimeThreshold` field.
7509    #[must_use]
7510    pub fn with_overstay_time_threshold(mut self, value: i32) -> Self {
7511        self.overstay_time_threshold = Some(value);
7512        self
7513    }
7514
7515    /// Sets the optional `customData` field.
7516    #[must_use]
7517    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7518        self.custom_data = Some(value);
7519        self
7520    }
7521}
7522
7523impl Validate for OverstayRuleList {
7524    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7525        path.push_key("overstayRule");
7526        validate::list_len(self.overstay_rule.len(), Some(1), Some(5), path, out);
7527        for (index, item) in self.overstay_rule.iter().enumerate() {
7528            path.push_index(index);
7529            Validate::validate_at(item, path, out);
7530            path.pop();
7531        }
7532        path.pop();
7533        path.push_key("overstayPowerThreshold");
7534        if let Some(value) = &self.overstay_power_threshold {
7535            Validate::validate_at(value, path, out);
7536        }
7537        path.pop();
7538        path.push_key("customData");
7539        if let Some(value) = &self.custom_data {
7540            Validate::validate_at(value, path, out);
7541        }
7542        path.pop();
7543    }
7544}
7545
7546/// The OCPP 2.1 `PeriodicEventStreamParams` data type.
7547#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7548pub struct PeriodicEventStreamParams {
7549    /// Time in seconds after which stream data is sent.
7550    #[serde(default, skip_serializing_if = "Option::is_none")]
7551    #[serde(deserialize_with = "crate::types::integer::option")]
7552    pub interval: Option<i32>,
7553    /// Number of items to be sent together in stream.
7554    #[serde(default, skip_serializing_if = "Option::is_none")]
7555    #[serde(deserialize_with = "crate::types::integer::option")]
7556    pub values: Option<i32>,
7557    /// The `customData` member.
7558    #[serde(rename = "customData")]
7559    #[serde(default, skip_serializing_if = "Option::is_none")]
7560    pub custom_data: Option<crate::types::CustomData>,
7561}
7562
7563impl PeriodicEventStreamParams {
7564    /// Creates an empty `PeriodicEventStreamParams`. Every field of this type is optional.
7565    #[must_use]
7566    pub fn new() -> Self {
7567        Self::default()
7568    }
7569
7570    /// Sets the optional `interval` field.
7571    #[must_use]
7572    pub fn with_interval(mut self, value: i32) -> Self {
7573        self.interval = Some(value);
7574        self
7575    }
7576
7577    /// Sets the optional `values` field.
7578    #[must_use]
7579    pub fn with_values(mut self, value: i32) -> Self {
7580        self.values = Some(value);
7581        self
7582    }
7583
7584    /// Sets the optional `customData` field.
7585    #[must_use]
7586    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7587        self.custom_data = Some(value);
7588        self
7589    }
7590}
7591
7592impl Validate for PeriodicEventStreamParams {
7593    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7594        path.push_key("interval");
7595        if let Some(value) = &self.interval {
7596            validate::int_range(i64::from(*value), Some(0), None, path, out);
7597        }
7598        path.pop();
7599        path.push_key("values");
7600        if let Some(value) = &self.values {
7601            validate::int_range(i64::from(*value), Some(0), None, path, out);
7602        }
7603        path.pop();
7604        path.push_key("customData");
7605        if let Some(value) = &self.custom_data {
7606            Validate::validate_at(value, path, out);
7607        }
7608        path.pop();
7609    }
7610}
7611
7612/// Price with and without tax. At least one of _exclTax_, _inclTax_ must be present.
7613///
7614/// The OCPP 2.1 `Price` data type.
7615#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7616pub struct Price {
7617    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
7618    #[serde(rename = "exclTax")]
7619    #[serde(default, skip_serializing_if = "Option::is_none")]
7620    pub excl_tax: Option<crate::types::Decimal>,
7621    /// Price/cost including tax. Can be absent if _exclTax_ is present.
7622    #[serde(rename = "inclTax")]
7623    #[serde(default, skip_serializing_if = "Option::is_none")]
7624    pub incl_tax: Option<crate::types::Decimal>,
7625    /// The `taxRates` member.
7626    #[serde(rename = "taxRates")]
7627    #[serde(default, skip_serializing_if = "Option::is_none")]
7628    pub tax_rates: Option<Vec<TaxRate>>,
7629    /// The `customData` member.
7630    #[serde(rename = "customData")]
7631    #[serde(default, skip_serializing_if = "Option::is_none")]
7632    pub custom_data: Option<crate::types::CustomData>,
7633}
7634
7635impl Price {
7636    /// Creates an empty `Price`. Every field of this type is optional.
7637    #[must_use]
7638    pub fn new() -> Self {
7639        Self::default()
7640    }
7641
7642    /// Sets the optional `exclTax` field.
7643    #[must_use]
7644    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7645        self.excl_tax = Some(value.into());
7646        self
7647    }
7648
7649    /// Sets the optional `inclTax` field.
7650    #[must_use]
7651    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7652        self.incl_tax = Some(value.into());
7653        self
7654    }
7655
7656    /// Sets the optional `taxRates` field.
7657    #[must_use]
7658    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
7659        self.tax_rates = Some(value);
7660        self
7661    }
7662
7663    /// Sets the optional `customData` field.
7664    #[must_use]
7665    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7666        self.custom_data = Some(value);
7667        self
7668    }
7669}
7670
7671impl Validate for Price {
7672    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7673        path.push_key("taxRates");
7674        if let Some(value) = &self.tax_rates {
7675            validate::list_len(value.len(), Some(1), Some(5), path, out);
7676            for (index, item) in value.iter().enumerate() {
7677                path.push_index(index);
7678                Validate::validate_at(item, path, out);
7679                path.pop();
7680            }
7681        }
7682        path.pop();
7683        path.push_key("customData");
7684        if let Some(value) = &self.custom_data {
7685            Validate::validate_at(value, path, out);
7686        }
7687        path.pop();
7688    }
7689}
7690
7691/// 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.
7692///
7693/// The OCPP 2.1 `PriceLevelSchedule` data type.
7694#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7695pub struct PriceLevelSchedule {
7696    /// The `priceLevelScheduleEntries` member.
7697    #[serde(rename = "priceLevelScheduleEntries")]
7698    pub price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7699    /// Starting point of this price schedule.
7700    #[serde(rename = "timeAnchor")]
7701    pub time_anchor: crate::types::DateTime,
7702    /// Unique ID of this price schedule.
7703    #[serde(rename = "priceScheduleId")]
7704    #[serde(deserialize_with = "crate::types::integer::one")]
7705    pub price_schedule_id: i32,
7706    /// Defines the overall number of distinct price level elements used across all PriceLevelSchedules.
7707    #[serde(rename = "numberOfPriceLevels")]
7708    #[serde(deserialize_with = "crate::types::integer::one")]
7709    pub number_of_price_levels: i32,
7710    /// Description of the price schedule.
7711    #[serde(rename = "priceScheduleDescription")]
7712    #[serde(default, skip_serializing_if = "Option::is_none")]
7713    pub price_schedule_description: Option<String>,
7714    /// The `customData` member.
7715    #[serde(rename = "customData")]
7716    #[serde(default, skip_serializing_if = "Option::is_none")]
7717    pub custom_data: Option<crate::types::CustomData>,
7718}
7719
7720impl PriceLevelSchedule {
7721    /// Creates a `PriceLevelSchedule` from its required fields.
7722    #[must_use]
7723    pub fn new(
7724        price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7725        time_anchor: impl Into<crate::types::DateTime>,
7726        price_schedule_id: i32,
7727        number_of_price_levels: i32,
7728    ) -> Self {
7729        Self {
7730            price_level_schedule_entries,
7731            time_anchor: time_anchor.into(),
7732            price_schedule_id,
7733            number_of_price_levels,
7734            price_schedule_description: None,
7735            custom_data: None,
7736        }
7737    }
7738
7739    /// Sets the optional `priceScheduleDescription` field.
7740    #[must_use]
7741    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
7742        self.price_schedule_description = Some(value.into());
7743        self
7744    }
7745
7746    /// Sets the optional `customData` field.
7747    #[must_use]
7748    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7749        self.custom_data = Some(value);
7750        self
7751    }
7752}
7753
7754impl Validate for PriceLevelSchedule {
7755    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7756        path.push_key("priceLevelScheduleEntries");
7757        validate::list_len(
7758            self.price_level_schedule_entries.len(),
7759            Some(1),
7760            Some(100),
7761            path,
7762            out,
7763        );
7764        for (index, item) in self.price_level_schedule_entries.iter().enumerate() {
7765            path.push_index(index);
7766            Validate::validate_at(item, path, out);
7767            path.pop();
7768        }
7769        path.pop();
7770        path.push_key("priceScheduleId");
7771        validate::int_range(i64::from(self.price_schedule_id), Some(0), None, path, out);
7772        path.pop();
7773        path.push_key("numberOfPriceLevels");
7774        validate::int_range(
7775            i64::from(self.number_of_price_levels),
7776            Some(0),
7777            None,
7778            path,
7779            out,
7780        );
7781        path.pop();
7782        path.push_key("priceScheduleDescription");
7783        if let Some(value) = &self.price_schedule_description {
7784            validate::string(value.as_str(), None, Some(32), path, out);
7785        }
7786        path.pop();
7787        path.push_key("customData");
7788        if let Some(value) = &self.custom_data {
7789            Validate::validate_at(value, path, out);
7790        }
7791        path.pop();
7792    }
7793}
7794
7795/// Part of ISO 15118-20 price schedule.
7796///
7797/// The OCPP 2.1 `PriceLevelScheduleEntry` data type.
7798#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7799pub struct PriceLevelScheduleEntry {
7800    /// The amount of seconds that define the duration of this given PriceLevelScheduleEntry.
7801    #[serde(deserialize_with = "crate::types::integer::one")]
7802    pub duration: i32,
7803    /// 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.
7804    #[serde(rename = "priceLevel")]
7805    #[serde(deserialize_with = "crate::types::integer::one")]
7806    pub price_level: i32,
7807    /// The `customData` member.
7808    #[serde(rename = "customData")]
7809    #[serde(default, skip_serializing_if = "Option::is_none")]
7810    pub custom_data: Option<crate::types::CustomData>,
7811}
7812
7813impl PriceLevelScheduleEntry {
7814    /// Creates a `PriceLevelScheduleEntry` from its required fields.
7815    #[must_use]
7816    pub fn new(duration: i32, price_level: i32) -> Self {
7817        Self {
7818            duration,
7819            price_level,
7820            custom_data: None,
7821        }
7822    }
7823
7824    /// Sets the optional `customData` field.
7825    #[must_use]
7826    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7827        self.custom_data = Some(value);
7828        self
7829    }
7830}
7831
7832impl Validate for PriceLevelScheduleEntry {
7833    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7834        path.push_key("priceLevel");
7835        validate::int_range(i64::from(self.price_level), Some(0), None, path, out);
7836        path.pop();
7837        path.push_key("customData");
7838        if let Some(value) = &self.custom_data {
7839            Validate::validate_at(value, path, out);
7840        }
7841        path.pop();
7842    }
7843}
7844
7845/// Part of ISO 15118-20 price schedule.
7846///
7847/// The OCPP 2.1 `PriceRule` data type.
7848#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7849pub struct PriceRule {
7850    /// The `energyFee` member.
7851    #[serde(rename = "energyFee")]
7852    pub energy_fee: RationalNumber,
7853    /// The `powerRangeStart` member.
7854    #[serde(rename = "powerRangeStart")]
7855    pub power_range_start: RationalNumber,
7856    /// The duration of the parking fee period (in seconds).
7857    /// When the time enters into a ParkingFeePeriod, the ParkingFee will apply to the session. .
7858    #[serde(rename = "parkingFeePeriod")]
7859    #[serde(default, skip_serializing_if = "Option::is_none")]
7860    #[serde(deserialize_with = "crate::types::integer::option")]
7861    pub parking_fee_period: Option<i32>,
7862    /// Number of grams of CO2 per kWh.
7863    #[serde(rename = "carbonDioxideEmission")]
7864    #[serde(default, skip_serializing_if = "Option::is_none")]
7865    #[serde(deserialize_with = "crate::types::integer::option")]
7866    pub carbon_dioxide_emission: Option<i32>,
7867    /// Percentage of the power that is created by renewable resources.
7868    #[serde(rename = "renewableGenerationPercentage")]
7869    #[serde(default, skip_serializing_if = "Option::is_none")]
7870    #[serde(deserialize_with = "crate::types::integer::option")]
7871    pub renewable_generation_percentage: Option<i32>,
7872    /// The `parkingFee` member.
7873    #[serde(rename = "parkingFee")]
7874    #[serde(default, skip_serializing_if = "Option::is_none")]
7875    pub parking_fee: Option<RationalNumber>,
7876    /// The `customData` member.
7877    #[serde(rename = "customData")]
7878    #[serde(default, skip_serializing_if = "Option::is_none")]
7879    pub custom_data: Option<crate::types::CustomData>,
7880}
7881
7882impl PriceRule {
7883    /// Creates a `PriceRule` from its required fields.
7884    #[must_use]
7885    pub fn new(energy_fee: RationalNumber, power_range_start: RationalNumber) -> Self {
7886        Self {
7887            energy_fee,
7888            power_range_start,
7889            parking_fee_period: None,
7890            carbon_dioxide_emission: None,
7891            renewable_generation_percentage: None,
7892            parking_fee: None,
7893            custom_data: None,
7894        }
7895    }
7896
7897    /// Sets the optional `parkingFeePeriod` field.
7898    #[must_use]
7899    pub fn with_parking_fee_period(mut self, value: i32) -> Self {
7900        self.parking_fee_period = Some(value);
7901        self
7902    }
7903
7904    /// Sets the optional `carbonDioxideEmission` field.
7905    #[must_use]
7906    pub fn with_carbon_dioxide_emission(mut self, value: i32) -> Self {
7907        self.carbon_dioxide_emission = Some(value);
7908        self
7909    }
7910
7911    /// Sets the optional `renewableGenerationPercentage` field.
7912    #[must_use]
7913    pub fn with_renewable_generation_percentage(mut self, value: i32) -> Self {
7914        self.renewable_generation_percentage = Some(value);
7915        self
7916    }
7917
7918    /// Sets the optional `parkingFee` field.
7919    #[must_use]
7920    pub fn with_parking_fee(mut self, value: RationalNumber) -> Self {
7921        self.parking_fee = Some(value);
7922        self
7923    }
7924
7925    /// Sets the optional `customData` field.
7926    #[must_use]
7927    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7928        self.custom_data = Some(value);
7929        self
7930    }
7931}
7932
7933impl Validate for PriceRule {
7934    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7935        path.push_key("energyFee");
7936        Validate::validate_at(&self.energy_fee, path, out);
7937        path.pop();
7938        path.push_key("powerRangeStart");
7939        Validate::validate_at(&self.power_range_start, path, out);
7940        path.pop();
7941        path.push_key("carbonDioxideEmission");
7942        if let Some(value) = &self.carbon_dioxide_emission {
7943            validate::int_range(i64::from(*value), Some(0), None, path, out);
7944        }
7945        path.pop();
7946        path.push_key("renewableGenerationPercentage");
7947        if let Some(value) = &self.renewable_generation_percentage {
7948            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
7949        }
7950        path.pop();
7951        path.push_key("parkingFee");
7952        if let Some(value) = &self.parking_fee {
7953            Validate::validate_at(value, path, out);
7954        }
7955        path.pop();
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/// Part of ISO 15118-20 price schedule.
7965///
7966/// The OCPP 2.1 `PriceRuleStack` data type.
7967#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7968pub struct PriceRuleStack {
7969    /// Duration of the stack of price rules.  he amount of seconds that define the duration of the given PriceRule(s).
7970    #[serde(deserialize_with = "crate::types::integer::one")]
7971    pub duration: i32,
7972    /// The `priceRule` member.
7973    #[serde(rename = "priceRule")]
7974    pub price_rule: Vec<PriceRule>,
7975    /// The `customData` member.
7976    #[serde(rename = "customData")]
7977    #[serde(default, skip_serializing_if = "Option::is_none")]
7978    pub custom_data: Option<crate::types::CustomData>,
7979}
7980
7981impl PriceRuleStack {
7982    /// Creates a `PriceRuleStack` from its required fields.
7983    #[must_use]
7984    pub fn new(duration: i32, price_rule: Vec<PriceRule>) -> Self {
7985        Self {
7986            duration,
7987            price_rule,
7988            custom_data: None,
7989        }
7990    }
7991
7992    /// Sets the optional `customData` field.
7993    #[must_use]
7994    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7995        self.custom_data = Some(value);
7996        self
7997    }
7998}
7999
8000impl Validate for PriceRuleStack {
8001    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8002        path.push_key("priceRule");
8003        validate::list_len(self.price_rule.len(), Some(1), Some(8), path, out);
8004        for (index, item) in self.price_rule.iter().enumerate() {
8005            path.push_index(index);
8006            Validate::validate_at(item, path, out);
8007            path.pop();
8008        }
8009        path.pop();
8010        path.push_key("customData");
8011        if let Some(value) = &self.custom_data {
8012            Validate::validate_at(value, path, out);
8013        }
8014        path.pop();
8015    }
8016}
8017
8018/// Part of ISO 15118-20 price schedule.
8019///
8020/// The OCPP 2.1 `RationalNumber` data type.
8021#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8022pub struct RationalNumber {
8023    /// The exponent to base 10 (dec)
8024    #[serde(deserialize_with = "crate::types::integer::one")]
8025    pub exponent: i32,
8026    /// Value which shall be multiplied.
8027    #[serde(deserialize_with = "crate::types::integer::one")]
8028    pub value: i32,
8029    /// The `customData` member.
8030    #[serde(rename = "customData")]
8031    #[serde(default, skip_serializing_if = "Option::is_none")]
8032    pub custom_data: Option<crate::types::CustomData>,
8033}
8034
8035impl RationalNumber {
8036    /// Creates a `RationalNumber` from its required fields.
8037    #[must_use]
8038    pub fn new(exponent: i32, value: i32) -> Self {
8039        Self {
8040            exponent,
8041            value,
8042            custom_data: None,
8043        }
8044    }
8045
8046    /// Sets the optional `customData` field.
8047    #[must_use]
8048    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8049        self.custom_data = Some(value);
8050        self
8051    }
8052}
8053
8054impl Validate for RationalNumber {
8055    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8056        path.push_key("customData");
8057        if let Some(value) = &self.custom_data {
8058            Validate::validate_at(value, path, out);
8059        }
8060        path.pop();
8061    }
8062}
8063
8064/// The OCPP 2.1 `ReactivePowerParams` data type.
8065#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8066pub struct ReactivePowerParams {
8067    /// Only for VoltVar curve: The nominal ac voltage (rms) adjustment to the voltage curve points for Volt-Var curves (percentage).
8068    #[serde(rename = "vRef")]
8069    #[serde(default, skip_serializing_if = "Option::is_none")]
8070    pub v_ref: Option<crate::types::Decimal>,
8071    /// Only for VoltVar: Enable/disable autonomous VRef adjustment
8072    #[serde(rename = "autonomousVRefEnable")]
8073    #[serde(default, skip_serializing_if = "Option::is_none")]
8074    pub autonomous_v_ref_enable: Option<bool>,
8075    /// Only for VoltVar: Adjustment range for VRef time constant
8076    #[serde(rename = "autonomousVRefTimeConstant")]
8077    #[serde(default, skip_serializing_if = "Option::is_none")]
8078    pub autonomous_v_ref_time_constant: Option<crate::types::Decimal>,
8079    /// The `customData` member.
8080    #[serde(rename = "customData")]
8081    #[serde(default, skip_serializing_if = "Option::is_none")]
8082    pub custom_data: Option<crate::types::CustomData>,
8083}
8084
8085impl ReactivePowerParams {
8086    /// Creates an empty `ReactivePowerParams`. Every field of this type is optional.
8087    #[must_use]
8088    pub fn new() -> Self {
8089        Self::default()
8090    }
8091
8092    /// Sets the optional `vRef` field.
8093    #[must_use]
8094    pub fn with_v_ref(mut self, value: impl Into<crate::types::Decimal>) -> Self {
8095        self.v_ref = Some(value.into());
8096        self
8097    }
8098
8099    /// Sets the optional `autonomousVRefEnable` field.
8100    #[must_use]
8101    pub fn with_autonomous_v_ref_enable(mut self, value: bool) -> Self {
8102        self.autonomous_v_ref_enable = Some(value);
8103        self
8104    }
8105
8106    /// Sets the optional `autonomousVRefTimeConstant` field.
8107    #[must_use]
8108    pub fn with_autonomous_v_ref_time_constant(
8109        mut self,
8110        value: impl Into<crate::types::Decimal>,
8111    ) -> Self {
8112        self.autonomous_v_ref_time_constant = Some(value.into());
8113        self
8114    }
8115
8116    /// Sets the optional `customData` field.
8117    #[must_use]
8118    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8119        self.custom_data = Some(value);
8120        self
8121    }
8122}
8123
8124impl Validate for ReactivePowerParams {
8125    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8126        path.push_key("customData");
8127        if let Some(value) = &self.custom_data {
8128            Validate::validate_at(value, path, out);
8129        }
8130        path.pop();
8131    }
8132}
8133
8134/// The OCPP 2.1 `RelativeTimeInterval` data type.
8135#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8136pub struct RelativeTimeInterval {
8137    /// Start of the interval, in seconds from NOW.
8138    #[serde(deserialize_with = "crate::types::integer::one")]
8139    pub start: i32,
8140    /// Duration of the interval, in seconds.
8141    #[serde(default, skip_serializing_if = "Option::is_none")]
8142    #[serde(deserialize_with = "crate::types::integer::option")]
8143    pub duration: Option<i32>,
8144    /// The `customData` member.
8145    #[serde(rename = "customData")]
8146    #[serde(default, skip_serializing_if = "Option::is_none")]
8147    pub custom_data: Option<crate::types::CustomData>,
8148}
8149
8150impl RelativeTimeInterval {
8151    /// Creates a `RelativeTimeInterval` from its required fields.
8152    #[must_use]
8153    pub fn new(start: i32) -> Self {
8154        Self {
8155            start,
8156            duration: None,
8157            custom_data: None,
8158        }
8159    }
8160
8161    /// Sets the optional `duration` field.
8162    #[must_use]
8163    pub fn with_duration(mut self, value: i32) -> Self {
8164        self.duration = Some(value);
8165        self
8166    }
8167
8168    /// Sets the optional `customData` field.
8169    #[must_use]
8170    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8171        self.custom_data = Some(value);
8172        self
8173    }
8174}
8175
8176impl Validate for RelativeTimeInterval {
8177    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8178        path.push_key("customData");
8179        if let Some(value) = &self.custom_data {
8180            Validate::validate_at(value, path, out);
8181        }
8182        path.pop();
8183    }
8184}
8185
8186/// Class to report components, variables and variable attributes and characteristics.
8187///
8188/// The OCPP 2.1 `ReportData` data type.
8189#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8190pub struct ReportData {
8191    /// The `component` member.
8192    pub component: Component,
8193    /// The `variable` member.
8194    pub variable: Variable,
8195    /// The `variableAttribute` member.
8196    #[serde(rename = "variableAttribute")]
8197    pub variable_attribute: Vec<VariableAttribute>,
8198    /// The `variableCharacteristics` member.
8199    #[serde(rename = "variableCharacteristics")]
8200    #[serde(default, skip_serializing_if = "Option::is_none")]
8201    pub variable_characteristics: Option<VariableCharacteristics>,
8202    /// The `customData` member.
8203    #[serde(rename = "customData")]
8204    #[serde(default, skip_serializing_if = "Option::is_none")]
8205    pub custom_data: Option<crate::types::CustomData>,
8206}
8207
8208impl ReportData {
8209    /// Creates a `ReportData` from its required fields.
8210    #[must_use]
8211    pub fn new(
8212        component: Component,
8213        variable: Variable,
8214        variable_attribute: Vec<VariableAttribute>,
8215    ) -> Self {
8216        Self {
8217            component,
8218            variable,
8219            variable_attribute,
8220            variable_characteristics: None,
8221            custom_data: None,
8222        }
8223    }
8224
8225    /// Sets the optional `variableCharacteristics` field.
8226    #[must_use]
8227    pub fn with_variable_characteristics(mut self, value: VariableCharacteristics) -> Self {
8228        self.variable_characteristics = Some(value);
8229        self
8230    }
8231
8232    /// Sets the optional `customData` field.
8233    #[must_use]
8234    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8235        self.custom_data = Some(value);
8236        self
8237    }
8238}
8239
8240impl Validate for ReportData {
8241    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8242        path.push_key("component");
8243        Validate::validate_at(&self.component, path, out);
8244        path.pop();
8245        path.push_key("variable");
8246        Validate::validate_at(&self.variable, path, out);
8247        path.pop();
8248        path.push_key("variableAttribute");
8249        validate::list_len(self.variable_attribute.len(), Some(1), Some(4), path, out);
8250        for (index, item) in self.variable_attribute.iter().enumerate() {
8251            path.push_index(index);
8252            Validate::validate_at(item, path, out);
8253            path.pop();
8254        }
8255        path.pop();
8256        path.push_key("variableCharacteristics");
8257        if let Some(value) = &self.variable_characteristics {
8258            Validate::validate_at(value, path, out);
8259        }
8260        path.pop();
8261        path.push_key("customData");
8262        if let Some(value) = &self.custom_data {
8263            Validate::validate_at(value, path, out);
8264        }
8265        path.pop();
8266    }
8267}
8268
8269/// A SalesTariff provided by a Mobility Operator (EMSP) .
8270/// NOTE: This dataType is based on dataTypes from &lt;&lt;ref-ISOIEC15118-2,ISO 15118-2&gt;&gt;.
8271///
8272/// The OCPP 2.1 `SalesTariff` data type.
8273#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8274pub struct SalesTariff {
8275    /// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
8276    #[serde(deserialize_with = "crate::types::integer::one")]
8277    pub id: i32,
8278    /// The `salesTariffEntry` member.
8279    #[serde(rename = "salesTariffEntry")]
8280    pub sales_tariff_entry: Vec<SalesTariffEntry>,
8281    /// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
8282    #[serde(rename = "salesTariffDescription")]
8283    #[serde(default, skip_serializing_if = "Option::is_none")]
8284    pub sales_tariff_description: Option<String>,
8285    /// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
8286    #[serde(rename = "numEPriceLevels")]
8287    #[serde(default, skip_serializing_if = "Option::is_none")]
8288    #[serde(deserialize_with = "crate::types::integer::option")]
8289    pub num_e_price_levels: Option<i32>,
8290    /// The `customData` member.
8291    #[serde(rename = "customData")]
8292    #[serde(default, skip_serializing_if = "Option::is_none")]
8293    pub custom_data: Option<crate::types::CustomData>,
8294}
8295
8296impl SalesTariff {
8297    /// Creates a `SalesTariff` from its required fields.
8298    #[must_use]
8299    pub fn new(id: i32, sales_tariff_entry: Vec<SalesTariffEntry>) -> Self {
8300        Self {
8301            id,
8302            sales_tariff_entry,
8303            sales_tariff_description: None,
8304            num_e_price_levels: None,
8305            custom_data: None,
8306        }
8307    }
8308
8309    /// Sets the optional `salesTariffDescription` field.
8310    #[must_use]
8311    pub fn with_sales_tariff_description(mut self, value: impl Into<String>) -> Self {
8312        self.sales_tariff_description = Some(value.into());
8313        self
8314    }
8315
8316    /// Sets the optional `numEPriceLevels` field.
8317    #[must_use]
8318    pub fn with_num_e_price_levels(mut self, value: i32) -> Self {
8319        self.num_e_price_levels = Some(value);
8320        self
8321    }
8322
8323    /// Sets the optional `customData` field.
8324    #[must_use]
8325    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8326        self.custom_data = Some(value);
8327        self
8328    }
8329}
8330
8331impl Validate for SalesTariff {
8332    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8333        path.push_key("id");
8334        validate::int_range(i64::from(self.id), Some(0), None, path, out);
8335        path.pop();
8336        path.push_key("salesTariffEntry");
8337        validate::list_len(
8338            self.sales_tariff_entry.len(),
8339            Some(1),
8340            Some(1024),
8341            path,
8342            out,
8343        );
8344        for (index, item) in self.sales_tariff_entry.iter().enumerate() {
8345            path.push_index(index);
8346            Validate::validate_at(item, path, out);
8347            path.pop();
8348        }
8349        path.pop();
8350        path.push_key("salesTariffDescription");
8351        if let Some(value) = &self.sales_tariff_description {
8352            validate::string(value.as_str(), None, Some(32), path, out);
8353        }
8354        path.pop();
8355        path.push_key("numEPriceLevels");
8356        if let Some(value) = &self.num_e_price_levels {
8357            validate::int_range(i64::from(*value), Some(0), None, path, out);
8358        }
8359        path.pop();
8360        path.push_key("customData");
8361        if let Some(value) = &self.custom_data {
8362            Validate::validate_at(value, path, out);
8363        }
8364        path.pop();
8365    }
8366}
8367
8368/// The OCPP 2.1 `SalesTariffEntry` data type.
8369#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8370pub struct SalesTariffEntry {
8371    /// The `relativeTimeInterval` member.
8372    #[serde(rename = "relativeTimeInterval")]
8373    pub relative_time_interval: RelativeTimeInterval,
8374    /// 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.
8375    #[serde(rename = "ePriceLevel")]
8376    #[serde(default, skip_serializing_if = "Option::is_none")]
8377    #[serde(deserialize_with = "crate::types::integer::option")]
8378    pub e_price_level: Option<i32>,
8379    /// The `consumptionCost` member.
8380    #[serde(rename = "consumptionCost")]
8381    #[serde(default, skip_serializing_if = "Option::is_none")]
8382    pub consumption_cost: Option<Vec<ConsumptionCost>>,
8383    /// The `customData` member.
8384    #[serde(rename = "customData")]
8385    #[serde(default, skip_serializing_if = "Option::is_none")]
8386    pub custom_data: Option<crate::types::CustomData>,
8387}
8388
8389impl SalesTariffEntry {
8390    /// Creates a `SalesTariffEntry` from its required fields.
8391    #[must_use]
8392    pub fn new(relative_time_interval: RelativeTimeInterval) -> Self {
8393        Self {
8394            relative_time_interval,
8395            e_price_level: None,
8396            consumption_cost: None,
8397            custom_data: None,
8398        }
8399    }
8400
8401    /// Sets the optional `ePriceLevel` field.
8402    #[must_use]
8403    pub fn with_e_price_level(mut self, value: i32) -> Self {
8404        self.e_price_level = Some(value);
8405        self
8406    }
8407
8408    /// Sets the optional `consumptionCost` field.
8409    #[must_use]
8410    pub fn with_consumption_cost(mut self, value: Vec<ConsumptionCost>) -> Self {
8411        self.consumption_cost = Some(value);
8412        self
8413    }
8414
8415    /// Sets the optional `customData` field.
8416    #[must_use]
8417    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8418        self.custom_data = Some(value);
8419        self
8420    }
8421}
8422
8423impl Validate for SalesTariffEntry {
8424    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8425        path.push_key("relativeTimeInterval");
8426        Validate::validate_at(&self.relative_time_interval, path, out);
8427        path.pop();
8428        path.push_key("ePriceLevel");
8429        if let Some(value) = &self.e_price_level {
8430            validate::int_range(i64::from(*value), Some(0), None, path, out);
8431        }
8432        path.pop();
8433        path.push_key("consumptionCost");
8434        if let Some(value) = &self.consumption_cost {
8435            validate::list_len(value.len(), Some(1), Some(3), path, out);
8436            for (index, item) in value.iter().enumerate() {
8437                path.push_index(index);
8438                Validate::validate_at(item, path, out);
8439                path.pop();
8440            }
8441        }
8442        path.pop();
8443        path.push_key("customData");
8444        if let Some(value) = &self.custom_data {
8445            Validate::validate_at(value, path, out);
8446        }
8447        path.pop();
8448    }
8449}
8450
8451/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
8452///
8453/// 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.
8454///
8455/// The OCPP 2.1 `SampledValue` data type.
8456#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8457pub struct SampledValue {
8458    /// Indicates the measured value.
8459    pub value: crate::types::Decimal,
8460    /// The `measurand` member.
8461    #[serde(default, skip_serializing_if = "Option::is_none")]
8462    pub measurand: Option<Measurand>,
8463    /// The `context` member.
8464    #[serde(default, skip_serializing_if = "Option::is_none")]
8465    pub context: Option<ReadingContext>,
8466    /// The `phase` member.
8467    #[serde(default, skip_serializing_if = "Option::is_none")]
8468    pub phase: Option<Phase>,
8469    /// The `location` member.
8470    #[serde(default, skip_serializing_if = "Option::is_none")]
8471    pub location: Option<Location>,
8472    /// The `signedMeterValue` member.
8473    #[serde(rename = "signedMeterValue")]
8474    #[serde(default, skip_serializing_if = "Option::is_none")]
8475    pub signed_meter_value: Option<SignedMeterValue>,
8476    /// The `unitOfMeasure` member.
8477    #[serde(rename = "unitOfMeasure")]
8478    #[serde(default, skip_serializing_if = "Option::is_none")]
8479    pub unit_of_measure: Option<UnitOfMeasure>,
8480    /// The `customData` member.
8481    #[serde(rename = "customData")]
8482    #[serde(default, skip_serializing_if = "Option::is_none")]
8483    pub custom_data: Option<crate::types::CustomData>,
8484}
8485
8486impl SampledValue {
8487    /// Creates a `SampledValue` from its required fields.
8488    #[must_use]
8489    pub fn new(value: impl Into<crate::types::Decimal>) -> Self {
8490        Self {
8491            value: value.into(),
8492            measurand: None,
8493            context: None,
8494            phase: None,
8495            location: None,
8496            signed_meter_value: None,
8497            unit_of_measure: None,
8498            custom_data: None,
8499        }
8500    }
8501
8502    /// Sets the optional `measurand` field.
8503    #[must_use]
8504    pub fn with_measurand(mut self, value: Measurand) -> Self {
8505        self.measurand = Some(value);
8506        self
8507    }
8508
8509    /// Sets the optional `context` field.
8510    #[must_use]
8511    pub fn with_context(mut self, value: ReadingContext) -> Self {
8512        self.context = Some(value);
8513        self
8514    }
8515
8516    /// Sets the optional `phase` field.
8517    #[must_use]
8518    pub fn with_phase(mut self, value: Phase) -> Self {
8519        self.phase = Some(value);
8520        self
8521    }
8522
8523    /// Sets the optional `location` field.
8524    #[must_use]
8525    pub fn with_location(mut self, value: Location) -> Self {
8526        self.location = Some(value);
8527        self
8528    }
8529
8530    /// Sets the optional `signedMeterValue` field.
8531    #[must_use]
8532    pub fn with_signed_meter_value(mut self, value: SignedMeterValue) -> Self {
8533        self.signed_meter_value = Some(value);
8534        self
8535    }
8536
8537    /// Sets the optional `unitOfMeasure` field.
8538    #[must_use]
8539    pub fn with_unit_of_measure(mut self, value: UnitOfMeasure) -> Self {
8540        self.unit_of_measure = Some(value);
8541        self
8542    }
8543
8544    /// Sets the optional `customData` field.
8545    #[must_use]
8546    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8547        self.custom_data = Some(value);
8548        self
8549    }
8550}
8551
8552impl Validate for SampledValue {
8553    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8554        path.push_key("measurand");
8555        if let Some(value) = &self.measurand {
8556            Validate::validate_at(value, path, out);
8557        }
8558        path.pop();
8559        path.push_key("context");
8560        if let Some(value) = &self.context {
8561            Validate::validate_at(value, path, out);
8562        }
8563        path.pop();
8564        path.push_key("phase");
8565        if let Some(value) = &self.phase {
8566            Validate::validate_at(value, path, out);
8567        }
8568        path.pop();
8569        path.push_key("location");
8570        if let Some(value) = &self.location {
8571            Validate::validate_at(value, path, out);
8572        }
8573        path.pop();
8574        path.push_key("signedMeterValue");
8575        if let Some(value) = &self.signed_meter_value {
8576            Validate::validate_at(value, path, out);
8577        }
8578        path.pop();
8579        path.push_key("unitOfMeasure");
8580        if let Some(value) = &self.unit_of_measure {
8581            Validate::validate_at(value, path, out);
8582        }
8583        path.pop();
8584        path.push_key("customData");
8585        if let Some(value) = &self.custom_data {
8586            Validate::validate_at(value, path, out);
8587        }
8588        path.pop();
8589    }
8590}
8591
8592/// Class to hold parameters of SetVariableMonitoring request.
8593///
8594/// The OCPP 2.1 `SetMonitoringData` data type.
8595#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8596pub struct SetMonitoringData {
8597    /// Value for threshold or delta monitoring.
8598    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
8599    pub value: crate::types::Decimal,
8600    /// The `type` member.
8601    pub r#type: Monitor,
8602    /// 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.
8603    ///
8604    /// The severity levels have the following meaning: +
8605    /// *0-Danger* +
8606    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8607    /// *1-Hardware Failure* +
8608    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8609    /// *2-System Failure* +
8610    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8611    /// *3-Critical* +
8612    /// Indicates a critical error. Action is required. +
8613    /// *4-Error* +
8614    /// Indicates a non-urgent error. Action is required. +
8615    /// *5-Alert* +
8616    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8617    /// *6-Warning* +
8618    /// Indicates a warning event. Action may be required. +
8619    /// *7-Notice* +
8620    /// Indicates an unusual event. No immediate action is required. +
8621    /// *8-Informational* +
8622    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8623    /// *9-Debug* +
8624    /// Indicates information useful to developers for debugging, not useful during operations.
8625    #[serde(deserialize_with = "crate::types::integer::one")]
8626    pub severity: i32,
8627    /// The `component` member.
8628    pub component: Component,
8629    /// The `variable` member.
8630    pub variable: Variable,
8631    /// An id SHALL only be given to replace an existing monitor. The Charging Station handles the generation of id's for new monitors.
8632    #[serde(default, skip_serializing_if = "Option::is_none")]
8633    #[serde(deserialize_with = "crate::types::integer::option")]
8634    pub id: Option<i32>,
8635    /// The `periodicEventStream` member.
8636    #[serde(rename = "periodicEventStream")]
8637    #[serde(default, skip_serializing_if = "Option::is_none")]
8638    pub periodic_event_stream: Option<PeriodicEventStreamParams>,
8639    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction. Default = false.
8640    /// Schema default: `false`.
8641    #[serde(default, skip_serializing_if = "Option::is_none")]
8642    pub transaction: Option<bool>,
8643    /// The `customData` member.
8644    #[serde(rename = "customData")]
8645    #[serde(default, skip_serializing_if = "Option::is_none")]
8646    pub custom_data: Option<crate::types::CustomData>,
8647}
8648
8649impl SetMonitoringData {
8650    /// Creates a `SetMonitoringData` from its required fields.
8651    #[must_use]
8652    pub fn new(
8653        value: impl Into<crate::types::Decimal>,
8654        r#type: Monitor,
8655        severity: i32,
8656        component: Component,
8657        variable: Variable,
8658    ) -> Self {
8659        Self {
8660            value: value.into(),
8661            r#type,
8662            severity,
8663            component,
8664            variable,
8665            id: None,
8666            periodic_event_stream: None,
8667            transaction: None,
8668            custom_data: None,
8669        }
8670    }
8671
8672    /// Sets the optional `id` field.
8673    #[must_use]
8674    pub fn with_id(mut self, value: i32) -> Self {
8675        self.id = Some(value);
8676        self
8677    }
8678
8679    /// Sets the optional `periodicEventStream` field.
8680    #[must_use]
8681    pub fn with_periodic_event_stream(mut self, value: PeriodicEventStreamParams) -> Self {
8682        self.periodic_event_stream = Some(value);
8683        self
8684    }
8685
8686    /// Sets the optional `transaction` field.
8687    #[must_use]
8688    pub fn with_transaction(mut self, value: bool) -> Self {
8689        self.transaction = Some(value);
8690        self
8691    }
8692
8693    /// Sets the optional `customData` field.
8694    #[must_use]
8695    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8696        self.custom_data = Some(value);
8697        self
8698    }
8699}
8700
8701impl Validate for SetMonitoringData {
8702    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8703        path.push_key("type");
8704        Validate::validate_at(&self.r#type, path, out);
8705        path.pop();
8706        path.push_key("severity");
8707        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
8708        path.pop();
8709        path.push_key("component");
8710        Validate::validate_at(&self.component, path, out);
8711        path.pop();
8712        path.push_key("variable");
8713        Validate::validate_at(&self.variable, path, out);
8714        path.pop();
8715        path.push_key("id");
8716        if let Some(value) = &self.id {
8717            validate::int_range(i64::from(*value), Some(0), None, path, out);
8718        }
8719        path.pop();
8720        path.push_key("periodicEventStream");
8721        if let Some(value) = &self.periodic_event_stream {
8722            Validate::validate_at(value, path, out);
8723        }
8724        path.pop();
8725        path.push_key("customData");
8726        if let Some(value) = &self.custom_data {
8727            Validate::validate_at(value, path, out);
8728        }
8729        path.pop();
8730    }
8731}
8732
8733/// Class to hold result of SetVariableMonitoring request.
8734///
8735/// The OCPP 2.1 `SetMonitoringResult` data type.
8736#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8737pub struct SetMonitoringResult {
8738    /// The `status` member.
8739    pub status: SetMonitoringStatus,
8740    /// The `type` member.
8741    pub r#type: Monitor,
8742    /// The `component` member.
8743    pub component: Component,
8744    /// The `variable` member.
8745    pub variable: Variable,
8746    /// 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.
8747    ///
8748    /// The severity levels have the following meaning: +
8749    /// *0-Danger* +
8750    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8751    /// *1-Hardware Failure* +
8752    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8753    /// *2-System Failure* +
8754    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8755    /// *3-Critical* +
8756    /// Indicates a critical error. Action is required. +
8757    /// *4-Error* +
8758    /// Indicates a non-urgent error. Action is required. +
8759    /// *5-Alert* +
8760    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8761    /// *6-Warning* +
8762    /// Indicates a warning event. Action may be required. +
8763    /// *7-Notice* +
8764    /// Indicates an unusual event. No immediate action is required. +
8765    /// *8-Informational* +
8766    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8767    /// *9-Debug* +
8768    /// Indicates information useful to developers for debugging, not useful during operations.
8769    #[serde(deserialize_with = "crate::types::integer::one")]
8770    pub severity: i32,
8771    /// 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.
8772    #[serde(default, skip_serializing_if = "Option::is_none")]
8773    #[serde(deserialize_with = "crate::types::integer::option")]
8774    pub id: Option<i32>,
8775    /// The `statusInfo` member.
8776    #[serde(rename = "statusInfo")]
8777    #[serde(default, skip_serializing_if = "Option::is_none")]
8778    pub status_info: Option<StatusInfo>,
8779    /// The `customData` member.
8780    #[serde(rename = "customData")]
8781    #[serde(default, skip_serializing_if = "Option::is_none")]
8782    pub custom_data: Option<crate::types::CustomData>,
8783}
8784
8785impl SetMonitoringResult {
8786    /// Creates a `SetMonitoringResult` from its required fields.
8787    #[must_use]
8788    pub fn new(
8789        status: SetMonitoringStatus,
8790        r#type: Monitor,
8791        component: Component,
8792        variable: Variable,
8793        severity: i32,
8794    ) -> Self {
8795        Self {
8796            status,
8797            r#type,
8798            component,
8799            variable,
8800            severity,
8801            id: None,
8802            status_info: None,
8803            custom_data: None,
8804        }
8805    }
8806
8807    /// Sets the optional `id` field.
8808    #[must_use]
8809    pub fn with_id(mut self, value: i32) -> Self {
8810        self.id = Some(value);
8811        self
8812    }
8813
8814    /// Sets the optional `statusInfo` field.
8815    #[must_use]
8816    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8817        self.status_info = Some(value);
8818        self
8819    }
8820
8821    /// Sets the optional `customData` field.
8822    #[must_use]
8823    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8824        self.custom_data = Some(value);
8825        self
8826    }
8827}
8828
8829impl Validate for SetMonitoringResult {
8830    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8831        path.push_key("status");
8832        Validate::validate_at(&self.status, path, out);
8833        path.pop();
8834        path.push_key("type");
8835        Validate::validate_at(&self.r#type, path, out);
8836        path.pop();
8837        path.push_key("component");
8838        Validate::validate_at(&self.component, path, out);
8839        path.pop();
8840        path.push_key("variable");
8841        Validate::validate_at(&self.variable, path, out);
8842        path.pop();
8843        path.push_key("severity");
8844        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
8845        path.pop();
8846        path.push_key("id");
8847        if let Some(value) = &self.id {
8848            validate::int_range(i64::from(*value), Some(0), None, path, out);
8849        }
8850        path.pop();
8851        path.push_key("statusInfo");
8852        if let Some(value) = &self.status_info {
8853            Validate::validate_at(value, path, out);
8854        }
8855        path.pop();
8856        path.push_key("customData");
8857        if let Some(value) = &self.custom_data {
8858            Validate::validate_at(value, path, out);
8859        }
8860        path.pop();
8861    }
8862}
8863
8864/// The OCPP 2.1 `SetVariableData` data type.
8865#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8866pub struct SetVariableData {
8867    /// Value to be assigned to attribute of variable.
8868    /// This value is allowed to be an empty string ("").
8869    ///
8870    /// 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.
8871    #[serde(rename = "attributeValue")]
8872    pub attribute_value: String,
8873    /// The `component` member.
8874    pub component: Component,
8875    /// The `variable` member.
8876    pub variable: Variable,
8877    /// The `attributeType` member.
8878    #[serde(rename = "attributeType")]
8879    #[serde(default, skip_serializing_if = "Option::is_none")]
8880    pub attribute_type: Option<Attribute>,
8881    /// The `customData` member.
8882    #[serde(rename = "customData")]
8883    #[serde(default, skip_serializing_if = "Option::is_none")]
8884    pub custom_data: Option<crate::types::CustomData>,
8885}
8886
8887impl SetVariableData {
8888    /// Creates a `SetVariableData` from its required fields.
8889    #[must_use]
8890    pub fn new(
8891        attribute_value: impl Into<String>,
8892        component: Component,
8893        variable: Variable,
8894    ) -> Self {
8895        Self {
8896            attribute_value: attribute_value.into(),
8897            component,
8898            variable,
8899            attribute_type: None,
8900            custom_data: None,
8901        }
8902    }
8903
8904    /// Sets the optional `attributeType` field.
8905    #[must_use]
8906    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8907        self.attribute_type = Some(value);
8908        self
8909    }
8910
8911    /// Sets the optional `customData` field.
8912    #[must_use]
8913    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8914        self.custom_data = Some(value);
8915        self
8916    }
8917}
8918
8919impl Validate for SetVariableData {
8920    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8921        path.push_key("attributeValue");
8922        validate::string(self.attribute_value.as_str(), None, Some(2500), path, out);
8923        path.pop();
8924        path.push_key("component");
8925        Validate::validate_at(&self.component, path, out);
8926        path.pop();
8927        path.push_key("variable");
8928        Validate::validate_at(&self.variable, path, out);
8929        path.pop();
8930        path.push_key("attributeType");
8931        if let Some(value) = &self.attribute_type {
8932            Validate::validate_at(value, path, out);
8933        }
8934        path.pop();
8935        path.push_key("customData");
8936        if let Some(value) = &self.custom_data {
8937            Validate::validate_at(value, path, out);
8938        }
8939        path.pop();
8940    }
8941}
8942
8943/// The OCPP 2.1 `SetVariableResult` data type.
8944#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8945pub struct SetVariableResult {
8946    /// The `attributeStatus` member.
8947    #[serde(rename = "attributeStatus")]
8948    pub attribute_status: SetVariableStatus,
8949    /// The `component` member.
8950    pub component: Component,
8951    /// The `variable` member.
8952    pub variable: Variable,
8953    /// The `attributeType` member.
8954    #[serde(rename = "attributeType")]
8955    #[serde(default, skip_serializing_if = "Option::is_none")]
8956    pub attribute_type: Option<Attribute>,
8957    /// The `attributeStatusInfo` member.
8958    #[serde(rename = "attributeStatusInfo")]
8959    #[serde(default, skip_serializing_if = "Option::is_none")]
8960    pub attribute_status_info: Option<StatusInfo>,
8961    /// The `customData` member.
8962    #[serde(rename = "customData")]
8963    #[serde(default, skip_serializing_if = "Option::is_none")]
8964    pub custom_data: Option<crate::types::CustomData>,
8965}
8966
8967impl SetVariableResult {
8968    /// Creates a `SetVariableResult` from its required fields.
8969    #[must_use]
8970    pub fn new(
8971        attribute_status: SetVariableStatus,
8972        component: Component,
8973        variable: Variable,
8974    ) -> Self {
8975        Self {
8976            attribute_status,
8977            component,
8978            variable,
8979            attribute_type: None,
8980            attribute_status_info: None,
8981            custom_data: None,
8982        }
8983    }
8984
8985    /// Sets the optional `attributeType` field.
8986    #[must_use]
8987    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8988        self.attribute_type = Some(value);
8989        self
8990    }
8991
8992    /// Sets the optional `attributeStatusInfo` field.
8993    #[must_use]
8994    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
8995        self.attribute_status_info = Some(value);
8996        self
8997    }
8998
8999    /// Sets the optional `customData` field.
9000    #[must_use]
9001    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9002        self.custom_data = Some(value);
9003        self
9004    }
9005}
9006
9007impl Validate for SetVariableResult {
9008    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9009        path.push_key("attributeStatus");
9010        Validate::validate_at(&self.attribute_status, path, out);
9011        path.pop();
9012        path.push_key("component");
9013        Validate::validate_at(&self.component, path, out);
9014        path.pop();
9015        path.push_key("variable");
9016        Validate::validate_at(&self.variable, path, out);
9017        path.pop();
9018        path.push_key("attributeType");
9019        if let Some(value) = &self.attribute_type {
9020            Validate::validate_at(value, path, out);
9021        }
9022        path.pop();
9023        path.push_key("attributeStatusInfo");
9024        if let Some(value) = &self.attribute_status_info {
9025            Validate::validate_at(value, path, out);
9026        }
9027        path.pop();
9028        path.push_key("customData");
9029        if let Some(value) = &self.custom_data {
9030            Validate::validate_at(value, path, out);
9031        }
9032        path.pop();
9033    }
9034}
9035
9036/// Represent a signed version of the meter value.
9037///
9038/// The OCPP 2.1 `SignedMeterValue` data type.
9039#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9040pub struct SignedMeterValue {
9041    /// 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.
9042    #[serde(rename = "signedMeterData")]
9043    pub signed_meter_data: String,
9044    /// Format used by the energy meter to encode the meter data. For example: OCMF or EDL.
9045    #[serde(rename = "encodingMethod")]
9046    pub encoding_method: String,
9047    /// *(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.
9048    #[serde(rename = "signingMethod")]
9049    #[serde(default, skip_serializing_if = "Option::is_none")]
9050    pub signing_method: Option<String>,
9051    /// *(2.1)* Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
9052    #[serde(rename = "publicKey")]
9053    #[serde(default, skip_serializing_if = "Option::is_none")]
9054    pub public_key: Option<String>,
9055    /// The `customData` member.
9056    #[serde(rename = "customData")]
9057    #[serde(default, skip_serializing_if = "Option::is_none")]
9058    pub custom_data: Option<crate::types::CustomData>,
9059}
9060
9061impl SignedMeterValue {
9062    /// Creates a `SignedMeterValue` from its required fields.
9063    #[must_use]
9064    pub fn new(signed_meter_data: impl Into<String>, encoding_method: impl Into<String>) -> Self {
9065        Self {
9066            signed_meter_data: signed_meter_data.into(),
9067            encoding_method: encoding_method.into(),
9068            signing_method: None,
9069            public_key: None,
9070            custom_data: None,
9071        }
9072    }
9073
9074    /// Sets the optional `signingMethod` field.
9075    #[must_use]
9076    pub fn with_signing_method(mut self, value: impl Into<String>) -> Self {
9077        self.signing_method = Some(value.into());
9078        self
9079    }
9080
9081    /// Sets the optional `publicKey` field.
9082    #[must_use]
9083    pub fn with_public_key(mut self, value: impl Into<String>) -> Self {
9084        self.public_key = Some(value.into());
9085        self
9086    }
9087
9088    /// Sets the optional `customData` field.
9089    #[must_use]
9090    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9091        self.custom_data = Some(value);
9092        self
9093    }
9094}
9095
9096impl Validate for SignedMeterValue {
9097    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9098        path.push_key("signedMeterData");
9099        validate::string(
9100            self.signed_meter_data.as_str(),
9101            None,
9102            Some(32768),
9103            path,
9104            out,
9105        );
9106        path.pop();
9107        path.push_key("encodingMethod");
9108        validate::string(self.encoding_method.as_str(), None, Some(50), path, out);
9109        path.pop();
9110        path.push_key("signingMethod");
9111        if let Some(value) = &self.signing_method {
9112            validate::string(value.as_str(), None, Some(50), path, out);
9113        }
9114        path.pop();
9115        path.push_key("publicKey");
9116        if let Some(value) = &self.public_key {
9117            validate::string(value.as_str(), None, Some(2500), path, out);
9118        }
9119        path.pop();
9120        path.push_key("customData");
9121        if let Some(value) = &self.custom_data {
9122            Validate::validate_at(value, path, out);
9123        }
9124        path.pop();
9125    }
9126}
9127
9128/// Element providing more information about the status.
9129///
9130/// The OCPP 2.1 `StatusInfo` data type.
9131#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9132pub struct StatusInfo {
9133    /// A predefined code for the reason why the status is returned in this response. The string is case-insensitive.
9134    #[serde(rename = "reasonCode")]
9135    pub reason_code: String,
9136    /// Additional text to provide detailed information.
9137    #[serde(rename = "additionalInfo")]
9138    #[serde(default, skip_serializing_if = "Option::is_none")]
9139    pub additional_info: Option<String>,
9140    /// The `customData` member.
9141    #[serde(rename = "customData")]
9142    #[serde(default, skip_serializing_if = "Option::is_none")]
9143    pub custom_data: Option<crate::types::CustomData>,
9144}
9145
9146impl StatusInfo {
9147    /// Creates a `StatusInfo` from its required fields.
9148    #[must_use]
9149    pub fn new(reason_code: impl Into<String>) -> Self {
9150        Self {
9151            reason_code: reason_code.into(),
9152            additional_info: None,
9153            custom_data: None,
9154        }
9155    }
9156
9157    /// Sets the optional `additionalInfo` field.
9158    #[must_use]
9159    pub fn with_additional_info(mut self, value: impl Into<String>) -> Self {
9160        self.additional_info = Some(value.into());
9161        self
9162    }
9163
9164    /// Sets the optional `customData` field.
9165    #[must_use]
9166    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9167        self.custom_data = Some(value);
9168        self
9169    }
9170}
9171
9172impl Validate for StatusInfo {
9173    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9174        path.push_key("reasonCode");
9175        validate::string(self.reason_code.as_str(), None, Some(20), path, out);
9176        path.pop();
9177        path.push_key("additionalInfo");
9178        if let Some(value) = &self.additional_info {
9179            validate::string(value.as_str(), None, Some(1024), path, out);
9180        }
9181        path.pop();
9182        path.push_key("customData");
9183        if let Some(value) = &self.custom_data {
9184            Validate::validate_at(value, path, out);
9185        }
9186        path.pop();
9187    }
9188}
9189
9190/// The OCPP 2.1 `StreamDataElement` data type.
9191#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9192pub struct StreamDataElement {
9193    /// Offset relative to _basetime_ of this message. _basetime_ + _t_ is timestamp of recorded value.
9194    pub t: crate::types::Decimal,
9195    /// The `v` member.
9196    pub v: String,
9197    /// The `customData` member.
9198    #[serde(rename = "customData")]
9199    #[serde(default, skip_serializing_if = "Option::is_none")]
9200    pub custom_data: Option<crate::types::CustomData>,
9201}
9202
9203impl StreamDataElement {
9204    /// Creates a `StreamDataElement` from its required fields.
9205    #[must_use]
9206    pub fn new(t: impl Into<crate::types::Decimal>, v: impl Into<String>) -> Self {
9207        Self {
9208            t: t.into(),
9209            v: v.into(),
9210            custom_data: None,
9211        }
9212    }
9213
9214    /// Sets the optional `customData` field.
9215    #[must_use]
9216    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9217        self.custom_data = Some(value);
9218        self
9219    }
9220}
9221
9222impl Validate for StreamDataElement {
9223    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9224        path.push_key("v");
9225        validate::string(self.v.as_str(), None, Some(2500), path, out);
9226        path.pop();
9227        path.push_key("customData");
9228        if let Some(value) = &self.custom_data {
9229            Validate::validate_at(value, path, out);
9230        }
9231        path.pop();
9232    }
9233}
9234
9235/// A tariff is described by fields with prices for:
9236/// energy,
9237/// charging time,
9238/// idle time,
9239/// fixed fee,
9240/// reservation time,
9241/// reservation fixed fee. +
9242/// Each of these fields may have (optional) conditions that specify when a price is applicable. +
9243/// The _description_ contains a human-readable explanation of the tariff to be shown to the user. +
9244/// The other fields are parameters that define the tariff. These are used by the charging station to calculate the price.
9245///
9246/// The OCPP 2.1 `Tariff` data type.
9247#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9248pub struct Tariff {
9249    /// Unique id of tariff
9250    #[serde(rename = "tariffId")]
9251    pub tariff_id: String,
9252    /// Currency code according to ISO 4217
9253    pub currency: String,
9254    /// The `description` member.
9255    #[serde(default, skip_serializing_if = "Option::is_none")]
9256    pub description: Option<Vec<MessageContent>>,
9257    /// The `energy` member.
9258    #[serde(default, skip_serializing_if = "Option::is_none")]
9259    pub energy: Option<TariffEnergy>,
9260    /// Time when this tariff becomes active. When absent, it is immediately active.
9261    #[serde(rename = "validFrom")]
9262    #[serde(default, skip_serializing_if = "Option::is_none")]
9263    pub valid_from: Option<crate::types::DateTime>,
9264    /// The `chargingTime` member.
9265    #[serde(rename = "chargingTime")]
9266    #[serde(default, skip_serializing_if = "Option::is_none")]
9267    pub charging_time: Option<TariffTime>,
9268    /// The `idleTime` member.
9269    #[serde(rename = "idleTime")]
9270    #[serde(default, skip_serializing_if = "Option::is_none")]
9271    pub idle_time: Option<TariffTime>,
9272    /// The `fixedFee` member.
9273    #[serde(rename = "fixedFee")]
9274    #[serde(default, skip_serializing_if = "Option::is_none")]
9275    pub fixed_fee: Option<TariffFixed>,
9276    /// The `reservationTime` member.
9277    #[serde(rename = "reservationTime")]
9278    #[serde(default, skip_serializing_if = "Option::is_none")]
9279    pub reservation_time: Option<TariffTime>,
9280    /// The `reservationFixed` member.
9281    #[serde(rename = "reservationFixed")]
9282    #[serde(default, skip_serializing_if = "Option::is_none")]
9283    pub reservation_fixed: Option<TariffFixed>,
9284    /// The `minCost` member.
9285    #[serde(rename = "minCost")]
9286    #[serde(default, skip_serializing_if = "Option::is_none")]
9287    pub min_cost: Option<Price>,
9288    /// The `maxCost` member.
9289    #[serde(rename = "maxCost")]
9290    #[serde(default, skip_serializing_if = "Option::is_none")]
9291    pub max_cost: Option<Price>,
9292    /// The `customData` member.
9293    #[serde(rename = "customData")]
9294    #[serde(default, skip_serializing_if = "Option::is_none")]
9295    pub custom_data: Option<crate::types::CustomData>,
9296}
9297
9298impl Tariff {
9299    /// Creates a `Tariff` from its required fields.
9300    #[must_use]
9301    pub fn new(tariff_id: impl Into<String>, currency: impl Into<String>) -> Self {
9302        Self {
9303            tariff_id: tariff_id.into(),
9304            currency: currency.into(),
9305            description: None,
9306            energy: None,
9307            valid_from: None,
9308            charging_time: None,
9309            idle_time: None,
9310            fixed_fee: None,
9311            reservation_time: None,
9312            reservation_fixed: None,
9313            min_cost: None,
9314            max_cost: None,
9315            custom_data: None,
9316        }
9317    }
9318
9319    /// Sets the optional `description` field.
9320    #[must_use]
9321    pub fn with_description(mut self, value: Vec<MessageContent>) -> Self {
9322        self.description = Some(value);
9323        self
9324    }
9325
9326    /// Sets the optional `energy` field.
9327    #[must_use]
9328    pub fn with_energy(mut self, value: TariffEnergy) -> Self {
9329        self.energy = Some(value);
9330        self
9331    }
9332
9333    /// Sets the optional `validFrom` field.
9334    #[must_use]
9335    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9336        self.valid_from = Some(value.into());
9337        self
9338    }
9339
9340    /// Sets the optional `chargingTime` field.
9341    #[must_use]
9342    pub fn with_charging_time(mut self, value: TariffTime) -> Self {
9343        self.charging_time = Some(value);
9344        self
9345    }
9346
9347    /// Sets the optional `idleTime` field.
9348    #[must_use]
9349    pub fn with_idle_time(mut self, value: TariffTime) -> Self {
9350        self.idle_time = Some(value);
9351        self
9352    }
9353
9354    /// Sets the optional `fixedFee` field.
9355    #[must_use]
9356    pub fn with_fixed_fee(mut self, value: TariffFixed) -> Self {
9357        self.fixed_fee = Some(value);
9358        self
9359    }
9360
9361    /// Sets the optional `reservationTime` field.
9362    #[must_use]
9363    pub fn with_reservation_time(mut self, value: TariffTime) -> Self {
9364        self.reservation_time = Some(value);
9365        self
9366    }
9367
9368    /// Sets the optional `reservationFixed` field.
9369    #[must_use]
9370    pub fn with_reservation_fixed(mut self, value: TariffFixed) -> Self {
9371        self.reservation_fixed = Some(value);
9372        self
9373    }
9374
9375    /// Sets the optional `minCost` field.
9376    #[must_use]
9377    pub fn with_min_cost(mut self, value: Price) -> Self {
9378        self.min_cost = Some(value);
9379        self
9380    }
9381
9382    /// Sets the optional `maxCost` field.
9383    #[must_use]
9384    pub fn with_max_cost(mut self, value: Price) -> Self {
9385        self.max_cost = Some(value);
9386        self
9387    }
9388
9389    /// Sets the optional `customData` field.
9390    #[must_use]
9391    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9392        self.custom_data = Some(value);
9393        self
9394    }
9395}
9396
9397impl Validate for Tariff {
9398    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9399        path.push_key("tariffId");
9400        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9401        path.pop();
9402        path.push_key("currency");
9403        validate::string(self.currency.as_str(), None, Some(3), path, out);
9404        path.pop();
9405        path.push_key("description");
9406        if let Some(value) = &self.description {
9407            validate::list_len(value.len(), Some(1), Some(10), path, out);
9408            for (index, item) in value.iter().enumerate() {
9409                path.push_index(index);
9410                Validate::validate_at(item, path, out);
9411                path.pop();
9412            }
9413        }
9414        path.pop();
9415        path.push_key("energy");
9416        if let Some(value) = &self.energy {
9417            Validate::validate_at(value, path, out);
9418        }
9419        path.pop();
9420        path.push_key("chargingTime");
9421        if let Some(value) = &self.charging_time {
9422            Validate::validate_at(value, path, out);
9423        }
9424        path.pop();
9425        path.push_key("idleTime");
9426        if let Some(value) = &self.idle_time {
9427            Validate::validate_at(value, path, out);
9428        }
9429        path.pop();
9430        path.push_key("fixedFee");
9431        if let Some(value) = &self.fixed_fee {
9432            Validate::validate_at(value, path, out);
9433        }
9434        path.pop();
9435        path.push_key("reservationTime");
9436        if let Some(value) = &self.reservation_time {
9437            Validate::validate_at(value, path, out);
9438        }
9439        path.pop();
9440        path.push_key("reservationFixed");
9441        if let Some(value) = &self.reservation_fixed {
9442            Validate::validate_at(value, path, out);
9443        }
9444        path.pop();
9445        path.push_key("minCost");
9446        if let Some(value) = &self.min_cost {
9447            Validate::validate_at(value, path, out);
9448        }
9449        path.pop();
9450        path.push_key("maxCost");
9451        if let Some(value) = &self.max_cost {
9452            Validate::validate_at(value, path, out);
9453        }
9454        path.pop();
9455        path.push_key("customData");
9456        if let Some(value) = &self.custom_data {
9457            Validate::validate_at(value, path, out);
9458        }
9459        path.pop();
9460    }
9461}
9462
9463/// Shows assignment of tariffs to EVSE or IdToken.
9464///
9465/// The OCPP 2.1 `TariffAssignment` data type.
9466#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9467pub struct TariffAssignment {
9468    /// Tariff id.
9469    #[serde(rename = "tariffId")]
9470    pub tariff_id: String,
9471    /// The `tariffKind` member.
9472    #[serde(rename = "tariffKind")]
9473    pub tariff_kind: TariffKind,
9474    /// Date/time when this tariff become active.
9475    #[serde(rename = "validFrom")]
9476    #[serde(default, skip_serializing_if = "Option::is_none")]
9477    pub valid_from: Option<crate::types::DateTime>,
9478    /// The `evseIds` member.
9479    #[serde(rename = "evseIds")]
9480    #[serde(default, skip_serializing_if = "Option::is_none")]
9481    #[serde(deserialize_with = "crate::types::integer::option_list")]
9482    pub evse_ids: Option<Vec<i32>>,
9483    /// IdTokens related to tariff
9484    #[serde(rename = "idTokens")]
9485    #[serde(default, skip_serializing_if = "Option::is_none")]
9486    pub id_tokens: Option<Vec<String>>,
9487    /// The `customData` member.
9488    #[serde(rename = "customData")]
9489    #[serde(default, skip_serializing_if = "Option::is_none")]
9490    pub custom_data: Option<crate::types::CustomData>,
9491}
9492
9493impl TariffAssignment {
9494    /// Creates a `TariffAssignment` from its required fields.
9495    #[must_use]
9496    pub fn new(tariff_id: impl Into<String>, tariff_kind: TariffKind) -> Self {
9497        Self {
9498            tariff_id: tariff_id.into(),
9499            tariff_kind,
9500            valid_from: None,
9501            evse_ids: None,
9502            id_tokens: None,
9503            custom_data: None,
9504        }
9505    }
9506
9507    /// Sets the optional `validFrom` field.
9508    #[must_use]
9509    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9510        self.valid_from = Some(value.into());
9511        self
9512    }
9513
9514    /// Sets the optional `evseIds` field.
9515    #[must_use]
9516    pub fn with_evse_ids(mut self, value: Vec<i32>) -> Self {
9517        self.evse_ids = Some(value);
9518        self
9519    }
9520
9521    /// Sets the optional `idTokens` field.
9522    #[must_use]
9523    pub fn with_id_tokens(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
9524        self.id_tokens = Some(value.into_iter().map(Into::into).collect());
9525        self
9526    }
9527
9528    /// Sets the optional `customData` field.
9529    #[must_use]
9530    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9531        self.custom_data = Some(value);
9532        self
9533    }
9534}
9535
9536impl Validate for TariffAssignment {
9537    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9538        path.push_key("tariffId");
9539        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9540        path.pop();
9541        path.push_key("tariffKind");
9542        Validate::validate_at(&self.tariff_kind, path, out);
9543        path.pop();
9544        path.push_key("evseIds");
9545        if let Some(value) = &self.evse_ids {
9546            validate::list_len(value.len(), Some(1), None, path, out);
9547            for (index, item) in value.iter().enumerate() {
9548                path.push_index(index);
9549                validate::int_range(i64::from(*item), Some(0), None, path, out);
9550                path.pop();
9551            }
9552        }
9553        path.pop();
9554        path.push_key("idTokens");
9555        if let Some(value) = &self.id_tokens {
9556            validate::list_len(value.len(), Some(1), None, path, out);
9557            for (index, item) in value.iter().enumerate() {
9558                path.push_index(index);
9559                validate::string(item.as_str(), None, Some(255), path, out);
9560                path.pop();
9561            }
9562        }
9563        path.pop();
9564        path.push_key("customData");
9565        if let Some(value) = &self.custom_data {
9566            Validate::validate_at(value, path, out);
9567        }
9568        path.pop();
9569    }
9570}
9571
9572/// These conditions describe if and when a TariffEnergyType or TariffTimeType applies during a transaction.
9573///
9574/// 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.
9575///
9576/// For reverse energy flow (discharging) negative values of energy, power and current are used.
9577///
9578/// 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.
9579///
9580/// 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.
9581/// 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.
9582///
9583/// The OCPP 2.1 `TariffConditions` data type.
9584#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9585pub struct TariffConditions {
9586    /// Start time of day in local time. +
9587    /// Format as per RFC 3339: time-hour ":" time-minute  +
9588    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9589    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9590    #[serde(rename = "startTimeOfDay")]
9591    #[serde(default, skip_serializing_if = "Option::is_none")]
9592    pub start_time_of_day: Option<String>,
9593    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9594    ///     If end time &lt; start time then the period wraps around to the next day. +
9595    ///     To stop at end of the day use: 00:00.
9596    #[serde(rename = "endTimeOfDay")]
9597    #[serde(default, skip_serializing_if = "Option::is_none")]
9598    pub end_time_of_day: Option<String>,
9599    /// Day(s) of the week this is tariff applies.
9600    #[serde(rename = "dayOfWeek")]
9601    #[serde(default, skip_serializing_if = "Option::is_none")]
9602    pub day_of_week: Option<Vec<DayOfWeek>>,
9603    /// Start date in local time, for example: 2015-12-24.
9604    /// Valid from this day (inclusive). +
9605    /// Format as per RFC 3339: full-date  +
9606    ///
9607    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9608    #[serde(rename = "validFromDate")]
9609    #[serde(default, skip_serializing_if = "Option::is_none")]
9610    pub valid_from_date: Option<String>,
9611    /// End date in local time, for example: 2015-12-27.
9612    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9613    #[serde(rename = "validToDate")]
9614    #[serde(default, skip_serializing_if = "Option::is_none")]
9615    pub valid_to_date: Option<String>,
9616    /// The `evseKind` member.
9617    #[serde(rename = "evseKind")]
9618    #[serde(default, skip_serializing_if = "Option::is_none")]
9619    pub evse_kind: Option<EvseKind>,
9620    /// Minimum consumed energy in Wh, for example 20000 Wh.
9621    ///     Valid from this amount of energy (inclusive) being used.
9622    #[serde(rename = "minEnergy")]
9623    #[serde(default, skip_serializing_if = "Option::is_none")]
9624    pub min_energy: Option<crate::types::Decimal>,
9625    /// Maximum consumed energy in Wh, for example 50000 Wh.
9626    ///     Valid until this amount of energy (exclusive) being used.
9627    #[serde(rename = "maxEnergy")]
9628    #[serde(default, skip_serializing_if = "Option::is_none")]
9629    pub max_energy: Option<crate::types::Decimal>,
9630    /// Sum of the minimum current (in Amperes) over all phases, for example 5 A.
9631    ///     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. +
9632    ///     This is NOT about the minimum current over the entire transaction.
9633    #[serde(rename = "minCurrent")]
9634    #[serde(default, skip_serializing_if = "Option::is_none")]
9635    pub min_current: Option<crate::types::Decimal>,
9636    /// Sum of the maximum current (in Amperes) over all phases, for example 20 A.
9637    ///       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.
9638    ///       This is NOT about the maximum current over the entire transaction.
9639    #[serde(rename = "maxCurrent")]
9640    #[serde(default, skip_serializing_if = "Option::is_none")]
9641    pub max_current: Option<crate::types::Decimal>,
9642    /// Minimum power in W, for example 5000 W.
9643    ///       When the EV is charging with more than, or equal to, the defined amount of power, this price is/becomes active.
9644    ///       If the charging power is or becomes lower, this price is not or no longer valid and becomes inactive.
9645    ///       This is NOT about the minimum power over the entire transaction.
9646    #[serde(rename = "minPower")]
9647    #[serde(default, skip_serializing_if = "Option::is_none")]
9648    pub min_power: Option<crate::types::Decimal>,
9649    /// Maximum power in W, for example 20000 W.
9650    ///       When the EV is charging with less than the defined amount of power, this price becomes/is active.
9651    ///       If the charging power is or becomes higher, this price is not or no longer valid and becomes inactive.
9652    ///       This is NOT about the maximum power over the entire transaction.
9653    #[serde(rename = "maxPower")]
9654    #[serde(default, skip_serializing_if = "Option::is_none")]
9655    pub max_power: Option<crate::types::Decimal>,
9656    /// Minimum duration in seconds the transaction (charging &amp; idle) MUST last (inclusive).
9657    ///       When the duration of a transaction is longer than the defined value, this price is or becomes active.
9658    ///       Before that moment, this price is not yet active.
9659    #[serde(rename = "minTime")]
9660    #[serde(default, skip_serializing_if = "Option::is_none")]
9661    #[serde(deserialize_with = "crate::types::integer::option")]
9662    pub min_time: Option<i32>,
9663    /// Maximum duration in seconds the transaction (charging &amp; idle) MUST last (exclusive).
9664    ///       When the duration of a transaction is shorter than the defined value, this price is or becomes active.
9665    ///       After that moment, this price is no longer active.
9666    #[serde(rename = "maxTime")]
9667    #[serde(default, skip_serializing_if = "Option::is_none")]
9668    #[serde(deserialize_with = "crate::types::integer::option")]
9669    pub max_time: Option<i32>,
9670    /// Minimum duration in seconds the charging MUST last (inclusive).
9671    ///       When the duration of a charging is longer than the defined value, this price is or becomes active.
9672    ///       Before that moment, this price is not yet active.
9673    #[serde(rename = "minChargingTime")]
9674    #[serde(default, skip_serializing_if = "Option::is_none")]
9675    #[serde(deserialize_with = "crate::types::integer::option")]
9676    pub min_charging_time: Option<i32>,
9677    /// Maximum duration in seconds the charging MUST last (exclusive).
9678    ///       When the duration of a charging is shorter than the defined value, this price is or becomes active.
9679    ///       After that moment, this price is no longer active.
9680    #[serde(rename = "maxChargingTime")]
9681    #[serde(default, skip_serializing_if = "Option::is_none")]
9682    #[serde(deserialize_with = "crate::types::integer::option")]
9683    pub max_charging_time: Option<i32>,
9684    /// Minimum duration in seconds the idle period (i.e. not charging) MUST last (inclusive).
9685    ///       When the duration of the idle time is longer than the defined value, this price is or becomes active.
9686    ///       Before that moment, this price is not yet active.
9687    #[serde(rename = "minIdleTime")]
9688    #[serde(default, skip_serializing_if = "Option::is_none")]
9689    #[serde(deserialize_with = "crate::types::integer::option")]
9690    pub min_idle_time: Option<i32>,
9691    /// Maximum duration in seconds the idle period (i.e. not charging) MUST last (exclusive).
9692    ///       When the duration of idle time is shorter than the defined value, this price is or becomes active.
9693    ///       After that moment, this price is no longer active.
9694    #[serde(rename = "maxIdleTime")]
9695    #[serde(default, skip_serializing_if = "Option::is_none")]
9696    #[serde(deserialize_with = "crate::types::integer::option")]
9697    pub max_idle_time: Option<i32>,
9698    /// The `customData` member.
9699    #[serde(rename = "customData")]
9700    #[serde(default, skip_serializing_if = "Option::is_none")]
9701    pub custom_data: Option<crate::types::CustomData>,
9702}
9703
9704impl TariffConditions {
9705    /// Creates an empty `TariffConditions`. Every field of this type is optional.
9706    #[must_use]
9707    pub fn new() -> Self {
9708        Self::default()
9709    }
9710
9711    /// Sets the optional `startTimeOfDay` field.
9712    #[must_use]
9713    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9714        self.start_time_of_day = Some(value.into());
9715        self
9716    }
9717
9718    /// Sets the optional `endTimeOfDay` field.
9719    #[must_use]
9720    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9721        self.end_time_of_day = Some(value.into());
9722        self
9723    }
9724
9725    /// Sets the optional `dayOfWeek` field.
9726    #[must_use]
9727    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9728        self.day_of_week = Some(value);
9729        self
9730    }
9731
9732    /// Sets the optional `validFromDate` field.
9733    #[must_use]
9734    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9735        self.valid_from_date = Some(value.into());
9736        self
9737    }
9738
9739    /// Sets the optional `validToDate` field.
9740    #[must_use]
9741    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9742        self.valid_to_date = Some(value.into());
9743        self
9744    }
9745
9746    /// Sets the optional `evseKind` field.
9747    #[must_use]
9748    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9749        self.evse_kind = Some(value);
9750        self
9751    }
9752
9753    /// Sets the optional `minEnergy` field.
9754    #[must_use]
9755    pub fn with_min_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9756        self.min_energy = Some(value.into());
9757        self
9758    }
9759
9760    /// Sets the optional `maxEnergy` field.
9761    #[must_use]
9762    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9763        self.max_energy = Some(value.into());
9764        self
9765    }
9766
9767    /// Sets the optional `minCurrent` field.
9768    #[must_use]
9769    pub fn with_min_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9770        self.min_current = Some(value.into());
9771        self
9772    }
9773
9774    /// Sets the optional `maxCurrent` field.
9775    #[must_use]
9776    pub fn with_max_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9777        self.max_current = Some(value.into());
9778        self
9779    }
9780
9781    /// Sets the optional `minPower` field.
9782    #[must_use]
9783    pub fn with_min_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9784        self.min_power = Some(value.into());
9785        self
9786    }
9787
9788    /// Sets the optional `maxPower` field.
9789    #[must_use]
9790    pub fn with_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9791        self.max_power = Some(value.into());
9792        self
9793    }
9794
9795    /// Sets the optional `minTime` field.
9796    #[must_use]
9797    pub fn with_min_time(mut self, value: i32) -> Self {
9798        self.min_time = Some(value);
9799        self
9800    }
9801
9802    /// Sets the optional `maxTime` field.
9803    #[must_use]
9804    pub fn with_max_time(mut self, value: i32) -> Self {
9805        self.max_time = Some(value);
9806        self
9807    }
9808
9809    /// Sets the optional `minChargingTime` field.
9810    #[must_use]
9811    pub fn with_min_charging_time(mut self, value: i32) -> Self {
9812        self.min_charging_time = Some(value);
9813        self
9814    }
9815
9816    /// Sets the optional `maxChargingTime` field.
9817    #[must_use]
9818    pub fn with_max_charging_time(mut self, value: i32) -> Self {
9819        self.max_charging_time = Some(value);
9820        self
9821    }
9822
9823    /// Sets the optional `minIdleTime` field.
9824    #[must_use]
9825    pub fn with_min_idle_time(mut self, value: i32) -> Self {
9826        self.min_idle_time = Some(value);
9827        self
9828    }
9829
9830    /// Sets the optional `maxIdleTime` field.
9831    #[must_use]
9832    pub fn with_max_idle_time(mut self, value: i32) -> Self {
9833        self.max_idle_time = Some(value);
9834        self
9835    }
9836
9837    /// Sets the optional `customData` field.
9838    #[must_use]
9839    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9840        self.custom_data = Some(value);
9841        self
9842    }
9843}
9844
9845impl Validate for TariffConditions {
9846    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9847        path.push_key("dayOfWeek");
9848        if let Some(value) = &self.day_of_week {
9849            validate::list_len(value.len(), Some(1), Some(7), path, out);
9850            for (index, item) in value.iter().enumerate() {
9851                path.push_index(index);
9852                Validate::validate_at(item, path, out);
9853                path.pop();
9854            }
9855        }
9856        path.pop();
9857        path.push_key("evseKind");
9858        if let Some(value) = &self.evse_kind {
9859            Validate::validate_at(value, path, out);
9860        }
9861        path.pop();
9862        path.push_key("customData");
9863        if let Some(value) = &self.custom_data {
9864            Validate::validate_at(value, path, out);
9865        }
9866        path.pop();
9867    }
9868}
9869
9870/// These conditions describe if a FixedPrice applies at start of the transaction.
9871///
9872/// 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.
9873///
9874/// 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.
9875/// 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.
9876///
9877/// The OCPP 2.1 `TariffConditionsFixed` data type.
9878#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9879pub struct TariffConditionsFixed {
9880    /// Start time of day in local time. +
9881    /// Format as per RFC 3339: time-hour ":" time-minute  +
9882    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9883    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9884    #[serde(rename = "startTimeOfDay")]
9885    #[serde(default, skip_serializing_if = "Option::is_none")]
9886    pub start_time_of_day: Option<String>,
9887    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9888    ///     If end time &lt; start time then the period wraps around to the next day. +
9889    ///     To stop at end of the day use: 00:00.
9890    #[serde(rename = "endTimeOfDay")]
9891    #[serde(default, skip_serializing_if = "Option::is_none")]
9892    pub end_time_of_day: Option<String>,
9893    /// Day(s) of the week this is tariff applies.
9894    #[serde(rename = "dayOfWeek")]
9895    #[serde(default, skip_serializing_if = "Option::is_none")]
9896    pub day_of_week: Option<Vec<DayOfWeek>>,
9897    /// Start date in local time, for example: 2015-12-24.
9898    /// Valid from this day (inclusive). +
9899    /// Format as per RFC 3339: full-date  +
9900    ///
9901    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9902    #[serde(rename = "validFromDate")]
9903    #[serde(default, skip_serializing_if = "Option::is_none")]
9904    pub valid_from_date: Option<String>,
9905    /// End date in local time, for example: 2015-12-27.
9906    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9907    #[serde(rename = "validToDate")]
9908    #[serde(default, skip_serializing_if = "Option::is_none")]
9909    pub valid_to_date: Option<String>,
9910    /// The `evseKind` member.
9911    #[serde(rename = "evseKind")]
9912    #[serde(default, skip_serializing_if = "Option::is_none")]
9913    pub evse_kind: Option<EvseKind>,
9914    /// For which payment brand this (adhoc) tariff applies. Can be used to add a surcharge for certain payment brands.
9915    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentBrand".
9916    #[serde(rename = "paymentBrand")]
9917    #[serde(default, skip_serializing_if = "Option::is_none")]
9918    pub payment_brand: Option<String>,
9919    /// Type of adhoc payment, e.g. CC, Debit.
9920    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentRecognition".
9921    #[serde(rename = "paymentRecognition")]
9922    #[serde(default, skip_serializing_if = "Option::is_none")]
9923    pub payment_recognition: Option<String>,
9924    /// The `customData` member.
9925    #[serde(rename = "customData")]
9926    #[serde(default, skip_serializing_if = "Option::is_none")]
9927    pub custom_data: Option<crate::types::CustomData>,
9928}
9929
9930impl TariffConditionsFixed {
9931    /// Creates an empty `TariffConditionsFixed`. Every field of this type is optional.
9932    #[must_use]
9933    pub fn new() -> Self {
9934        Self::default()
9935    }
9936
9937    /// Sets the optional `startTimeOfDay` field.
9938    #[must_use]
9939    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9940        self.start_time_of_day = Some(value.into());
9941        self
9942    }
9943
9944    /// Sets the optional `endTimeOfDay` field.
9945    #[must_use]
9946    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9947        self.end_time_of_day = Some(value.into());
9948        self
9949    }
9950
9951    /// Sets the optional `dayOfWeek` field.
9952    #[must_use]
9953    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9954        self.day_of_week = Some(value);
9955        self
9956    }
9957
9958    /// Sets the optional `validFromDate` field.
9959    #[must_use]
9960    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9961        self.valid_from_date = Some(value.into());
9962        self
9963    }
9964
9965    /// Sets the optional `validToDate` field.
9966    #[must_use]
9967    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9968        self.valid_to_date = Some(value.into());
9969        self
9970    }
9971
9972    /// Sets the optional `evseKind` field.
9973    #[must_use]
9974    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9975        self.evse_kind = Some(value);
9976        self
9977    }
9978
9979    /// Sets the optional `paymentBrand` field.
9980    #[must_use]
9981    pub fn with_payment_brand(mut self, value: impl Into<String>) -> Self {
9982        self.payment_brand = Some(value.into());
9983        self
9984    }
9985
9986    /// Sets the optional `paymentRecognition` field.
9987    #[must_use]
9988    pub fn with_payment_recognition(mut self, value: impl Into<String>) -> Self {
9989        self.payment_recognition = Some(value.into());
9990        self
9991    }
9992
9993    /// Sets the optional `customData` field.
9994    #[must_use]
9995    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9996        self.custom_data = Some(value);
9997        self
9998    }
9999}
10000
10001impl Validate for TariffConditionsFixed {
10002    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10003        path.push_key("dayOfWeek");
10004        if let Some(value) = &self.day_of_week {
10005            validate::list_len(value.len(), Some(1), Some(7), path, out);
10006            for (index, item) in value.iter().enumerate() {
10007                path.push_index(index);
10008                Validate::validate_at(item, path, out);
10009                path.pop();
10010            }
10011        }
10012        path.pop();
10013        path.push_key("evseKind");
10014        if let Some(value) = &self.evse_kind {
10015            Validate::validate_at(value, path, out);
10016        }
10017        path.pop();
10018        path.push_key("paymentBrand");
10019        if let Some(value) = &self.payment_brand {
10020            validate::string(value.as_str(), None, Some(20), path, out);
10021        }
10022        path.pop();
10023        path.push_key("paymentRecognition");
10024        if let Some(value) = &self.payment_recognition {
10025            validate::string(value.as_str(), None, Some(20), path, out);
10026        }
10027        path.pop();
10028        path.push_key("customData");
10029        if let Some(value) = &self.custom_data {
10030            Validate::validate_at(value, path, out);
10031        }
10032        path.pop();
10033    }
10034}
10035
10036/// Price elements and tax for energy
10037///
10038/// The OCPP 2.1 `TariffEnergy` data type.
10039#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10040pub struct TariffEnergy {
10041    /// The `prices` member.
10042    pub prices: Vec<TariffEnergyPrice>,
10043    /// The `taxRates` member.
10044    #[serde(rename = "taxRates")]
10045    #[serde(default, skip_serializing_if = "Option::is_none")]
10046    pub tax_rates: Option<Vec<TaxRate>>,
10047    /// The `customData` member.
10048    #[serde(rename = "customData")]
10049    #[serde(default, skip_serializing_if = "Option::is_none")]
10050    pub custom_data: Option<crate::types::CustomData>,
10051}
10052
10053impl TariffEnergy {
10054    /// Creates a `TariffEnergy` from its required fields.
10055    #[must_use]
10056    pub fn new(prices: Vec<TariffEnergyPrice>) -> Self {
10057        Self {
10058            prices,
10059            tax_rates: None,
10060            custom_data: None,
10061        }
10062    }
10063
10064    /// Sets the optional `taxRates` field.
10065    #[must_use]
10066    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10067        self.tax_rates = Some(value);
10068        self
10069    }
10070
10071    /// Sets the optional `customData` field.
10072    #[must_use]
10073    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10074        self.custom_data = Some(value);
10075        self
10076    }
10077}
10078
10079impl Validate for TariffEnergy {
10080    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10081        path.push_key("prices");
10082        validate::list_len(self.prices.len(), Some(1), None, path, out);
10083        for (index, item) in self.prices.iter().enumerate() {
10084            path.push_index(index);
10085            Validate::validate_at(item, path, out);
10086            path.pop();
10087        }
10088        path.pop();
10089        path.push_key("taxRates");
10090        if let Some(value) = &self.tax_rates {
10091            validate::list_len(value.len(), Some(1), Some(5), path, out);
10092            for (index, item) in value.iter().enumerate() {
10093                path.push_index(index);
10094                Validate::validate_at(item, path, out);
10095                path.pop();
10096            }
10097        }
10098        path.pop();
10099        path.push_key("customData");
10100        if let Some(value) = &self.custom_data {
10101            Validate::validate_at(value, path, out);
10102        }
10103        path.pop();
10104    }
10105}
10106
10107/// Tariff with optional conditions for an energy price.
10108///
10109/// The OCPP 2.1 `TariffEnergyPrice` data type.
10110#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10111pub struct TariffEnergyPrice {
10112    /// Price per kWh (excl. tax) for this element.
10113    #[serde(rename = "priceKwh")]
10114    pub price_kwh: crate::types::Decimal,
10115    /// The `conditions` member.
10116    #[serde(default, skip_serializing_if = "Option::is_none")]
10117    pub conditions: Option<TariffConditions>,
10118    /// The `customData` member.
10119    #[serde(rename = "customData")]
10120    #[serde(default, skip_serializing_if = "Option::is_none")]
10121    pub custom_data: Option<crate::types::CustomData>,
10122}
10123
10124impl TariffEnergyPrice {
10125    /// Creates a `TariffEnergyPrice` from its required fields.
10126    #[must_use]
10127    pub fn new(price_kwh: impl Into<crate::types::Decimal>) -> Self {
10128        Self {
10129            price_kwh: price_kwh.into(),
10130            conditions: None,
10131            custom_data: None,
10132        }
10133    }
10134
10135    /// Sets the optional `conditions` field.
10136    #[must_use]
10137    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10138        self.conditions = Some(value);
10139        self
10140    }
10141
10142    /// Sets the optional `customData` field.
10143    #[must_use]
10144    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10145        self.custom_data = Some(value);
10146        self
10147    }
10148}
10149
10150impl Validate for TariffEnergyPrice {
10151    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10152        path.push_key("conditions");
10153        if let Some(value) = &self.conditions {
10154            Validate::validate_at(value, path, out);
10155        }
10156        path.pop();
10157        path.push_key("customData");
10158        if let Some(value) = &self.custom_data {
10159            Validate::validate_at(value, path, out);
10160        }
10161        path.pop();
10162    }
10163}
10164
10165/// The OCPP 2.1 `TariffFixed` data type.
10166#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10167pub struct TariffFixed {
10168    /// The `prices` member.
10169    pub prices: Vec<TariffFixedPrice>,
10170    /// The `taxRates` member.
10171    #[serde(rename = "taxRates")]
10172    #[serde(default, skip_serializing_if = "Option::is_none")]
10173    pub tax_rates: Option<Vec<TaxRate>>,
10174    /// The `customData` member.
10175    #[serde(rename = "customData")]
10176    #[serde(default, skip_serializing_if = "Option::is_none")]
10177    pub custom_data: Option<crate::types::CustomData>,
10178}
10179
10180impl TariffFixed {
10181    /// Creates a `TariffFixed` from its required fields.
10182    #[must_use]
10183    pub fn new(prices: Vec<TariffFixedPrice>) -> Self {
10184        Self {
10185            prices,
10186            tax_rates: None,
10187            custom_data: None,
10188        }
10189    }
10190
10191    /// Sets the optional `taxRates` field.
10192    #[must_use]
10193    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10194        self.tax_rates = Some(value);
10195        self
10196    }
10197
10198    /// Sets the optional `customData` field.
10199    #[must_use]
10200    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10201        self.custom_data = Some(value);
10202        self
10203    }
10204}
10205
10206impl Validate for TariffFixed {
10207    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10208        path.push_key("prices");
10209        validate::list_len(self.prices.len(), Some(1), None, path, out);
10210        for (index, item) in self.prices.iter().enumerate() {
10211            path.push_index(index);
10212            Validate::validate_at(item, path, out);
10213            path.pop();
10214        }
10215        path.pop();
10216        path.push_key("taxRates");
10217        if let Some(value) = &self.tax_rates {
10218            validate::list_len(value.len(), Some(1), Some(5), path, out);
10219            for (index, item) in value.iter().enumerate() {
10220                path.push_index(index);
10221                Validate::validate_at(item, path, out);
10222                path.pop();
10223            }
10224        }
10225        path.pop();
10226        path.push_key("customData");
10227        if let Some(value) = &self.custom_data {
10228            Validate::validate_at(value, path, out);
10229        }
10230        path.pop();
10231    }
10232}
10233
10234/// Tariff with optional conditions for a fixed price.
10235///
10236/// The OCPP 2.1 `TariffFixedPrice` data type.
10237#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10238pub struct TariffFixedPrice {
10239    /// Fixed price  for this element e.g. a start fee.
10240    #[serde(rename = "priceFixed")]
10241    pub price_fixed: crate::types::Decimal,
10242    /// The `conditions` member.
10243    #[serde(default, skip_serializing_if = "Option::is_none")]
10244    pub conditions: Option<TariffConditionsFixed>,
10245    /// The `customData` member.
10246    #[serde(rename = "customData")]
10247    #[serde(default, skip_serializing_if = "Option::is_none")]
10248    pub custom_data: Option<crate::types::CustomData>,
10249}
10250
10251impl TariffFixedPrice {
10252    /// Creates a `TariffFixedPrice` from its required fields.
10253    #[must_use]
10254    pub fn new(price_fixed: impl Into<crate::types::Decimal>) -> Self {
10255        Self {
10256            price_fixed: price_fixed.into(),
10257            conditions: None,
10258            custom_data: None,
10259        }
10260    }
10261
10262    /// Sets the optional `conditions` field.
10263    #[must_use]
10264    pub fn with_conditions(mut self, value: TariffConditionsFixed) -> Self {
10265        self.conditions = Some(value);
10266        self
10267    }
10268
10269    /// Sets the optional `customData` field.
10270    #[must_use]
10271    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10272        self.custom_data = Some(value);
10273        self
10274    }
10275}
10276
10277impl Validate for TariffFixedPrice {
10278    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10279        path.push_key("conditions");
10280        if let Some(value) = &self.conditions {
10281            Validate::validate_at(value, path, out);
10282        }
10283        path.pop();
10284        path.push_key("customData");
10285        if let Some(value) = &self.custom_data {
10286            Validate::validate_at(value, path, out);
10287        }
10288        path.pop();
10289    }
10290}
10291
10292/// Price elements and tax for time
10293///
10294/// The OCPP 2.1 `TariffTime` data type.
10295#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10296pub struct TariffTime {
10297    /// The `prices` member.
10298    pub prices: Vec<TariffTimePrice>,
10299    /// The `taxRates` member.
10300    #[serde(rename = "taxRates")]
10301    #[serde(default, skip_serializing_if = "Option::is_none")]
10302    pub tax_rates: Option<Vec<TaxRate>>,
10303    /// The `customData` member.
10304    #[serde(rename = "customData")]
10305    #[serde(default, skip_serializing_if = "Option::is_none")]
10306    pub custom_data: Option<crate::types::CustomData>,
10307}
10308
10309impl TariffTime {
10310    /// Creates a `TariffTime` from its required fields.
10311    #[must_use]
10312    pub fn new(prices: Vec<TariffTimePrice>) -> Self {
10313        Self {
10314            prices,
10315            tax_rates: None,
10316            custom_data: None,
10317        }
10318    }
10319
10320    /// Sets the optional `taxRates` field.
10321    #[must_use]
10322    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10323        self.tax_rates = Some(value);
10324        self
10325    }
10326
10327    /// Sets the optional `customData` field.
10328    #[must_use]
10329    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10330        self.custom_data = Some(value);
10331        self
10332    }
10333}
10334
10335impl Validate for TariffTime {
10336    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10337        path.push_key("prices");
10338        validate::list_len(self.prices.len(), Some(1), None, path, out);
10339        for (index, item) in self.prices.iter().enumerate() {
10340            path.push_index(index);
10341            Validate::validate_at(item, path, out);
10342            path.pop();
10343        }
10344        path.pop();
10345        path.push_key("taxRates");
10346        if let Some(value) = &self.tax_rates {
10347            validate::list_len(value.len(), Some(1), Some(5), path, out);
10348            for (index, item) in value.iter().enumerate() {
10349                path.push_index(index);
10350                Validate::validate_at(item, path, out);
10351                path.pop();
10352            }
10353        }
10354        path.pop();
10355        path.push_key("customData");
10356        if let Some(value) = &self.custom_data {
10357            Validate::validate_at(value, path, out);
10358        }
10359        path.pop();
10360    }
10361}
10362
10363/// Tariff with optional conditions for a time duration price.
10364///
10365/// The OCPP 2.1 `TariffTimePrice` data type.
10366#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10367pub struct TariffTimePrice {
10368    /// Price per minute (excl. tax) for this element.
10369    #[serde(rename = "priceMinute")]
10370    pub price_minute: crate::types::Decimal,
10371    /// The `conditions` member.
10372    #[serde(default, skip_serializing_if = "Option::is_none")]
10373    pub conditions: Option<TariffConditions>,
10374    /// The `customData` member.
10375    #[serde(rename = "customData")]
10376    #[serde(default, skip_serializing_if = "Option::is_none")]
10377    pub custom_data: Option<crate::types::CustomData>,
10378}
10379
10380impl TariffTimePrice {
10381    /// Creates a `TariffTimePrice` from its required fields.
10382    #[must_use]
10383    pub fn new(price_minute: impl Into<crate::types::Decimal>) -> Self {
10384        Self {
10385            price_minute: price_minute.into(),
10386            conditions: None,
10387            custom_data: None,
10388        }
10389    }
10390
10391    /// Sets the optional `conditions` field.
10392    #[must_use]
10393    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10394        self.conditions = Some(value);
10395        self
10396    }
10397
10398    /// Sets the optional `customData` field.
10399    #[must_use]
10400    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10401        self.custom_data = Some(value);
10402        self
10403    }
10404}
10405
10406impl Validate for TariffTimePrice {
10407    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10408        path.push_key("conditions");
10409        if let Some(value) = &self.conditions {
10410            Validate::validate_at(value, path, out);
10411        }
10412        path.pop();
10413        path.push_key("customData");
10414        if let Some(value) = &self.custom_data {
10415            Validate::validate_at(value, path, out);
10416        }
10417        path.pop();
10418    }
10419}
10420
10421/// Tax percentage
10422///
10423/// The OCPP 2.1 `TaxRate` data type.
10424#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10425pub struct TaxRate {
10426    /// Type of this tax, e.g.  "Federal ",  "State", for information on receipt.
10427    pub r#type: String,
10428    /// Tax percentage
10429    pub tax: crate::types::Decimal,
10430    /// Stack level for this type of tax. Default value, when absent, is 0. +
10431    /// _stack_ = 0: tax on net price; +
10432    /// _stack_ = 1: tax added on top of _stack_ 0; +
10433    /// _stack_ = 2: tax added on top of _stack_ 1, etc.
10434    #[serde(default, skip_serializing_if = "Option::is_none")]
10435    #[serde(deserialize_with = "crate::types::integer::option")]
10436    pub stack: Option<i32>,
10437    /// The `customData` member.
10438    #[serde(rename = "customData")]
10439    #[serde(default, skip_serializing_if = "Option::is_none")]
10440    pub custom_data: Option<crate::types::CustomData>,
10441}
10442
10443impl TaxRate {
10444    /// Creates a `TaxRate` from its required fields.
10445    #[must_use]
10446    pub fn new(r#type: impl Into<String>, tax: impl Into<crate::types::Decimal>) -> Self {
10447        Self {
10448            r#type: r#type.into(),
10449            tax: tax.into(),
10450            stack: None,
10451            custom_data: None,
10452        }
10453    }
10454
10455    /// Sets the optional `stack` field.
10456    #[must_use]
10457    pub fn with_stack(mut self, value: i32) -> Self {
10458        self.stack = Some(value);
10459        self
10460    }
10461
10462    /// Sets the optional `customData` field.
10463    #[must_use]
10464    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10465        self.custom_data = Some(value);
10466        self
10467    }
10468}
10469
10470impl Validate for TaxRate {
10471    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10472        path.push_key("type");
10473        validate::string(self.r#type.as_str(), None, Some(20), path, out);
10474        path.pop();
10475        path.push_key("stack");
10476        if let Some(value) = &self.stack {
10477            validate::int_range(i64::from(*value), Some(0), None, path, out);
10478        }
10479        path.pop();
10480        path.push_key("customData");
10481        if let Some(value) = &self.custom_data {
10482            Validate::validate_at(value, path, out);
10483        }
10484        path.pop();
10485    }
10486}
10487
10488/// Part of ISO 15118-20 price schedule.
10489///
10490/// The OCPP 2.1 `TaxRule` data type.
10491#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10492pub struct TaxRule {
10493    /// Id for the tax rule.
10494    #[serde(rename = "taxRuleID")]
10495    #[serde(deserialize_with = "crate::types::integer::one")]
10496    pub tax_rule_id: i32,
10497    /// Indicates whether this tax applies to Energy Fees.
10498    #[serde(rename = "appliesToEnergyFee")]
10499    pub applies_to_energy_fee: bool,
10500    /// Indicates whether this tax applies to Parking Fees.
10501    #[serde(rename = "appliesToParkingFee")]
10502    pub applies_to_parking_fee: bool,
10503    /// Indicates whether this tax applies to Overstay Fees.
10504    #[serde(rename = "appliesToOverstayFee")]
10505    pub applies_to_overstay_fee: bool,
10506    /// Indicates whether this tax applies to Minimum/Maximum Cost.
10507    #[serde(rename = "appliesToMinimumMaximumCost")]
10508    pub applies_to_minimum_maximum_cost: bool,
10509    /// The `taxRate` member.
10510    #[serde(rename = "taxRate")]
10511    pub tax_rate: RationalNumber,
10512    /// Human readable string to identify the tax rule.
10513    #[serde(rename = "taxRuleName")]
10514    #[serde(default, skip_serializing_if = "Option::is_none")]
10515    pub tax_rule_name: Option<String>,
10516    /// Indicates whether the tax is included in any price or not.
10517    #[serde(rename = "taxIncludedInPrice")]
10518    #[serde(default, skip_serializing_if = "Option::is_none")]
10519    pub tax_included_in_price: Option<bool>,
10520    /// The `customData` member.
10521    #[serde(rename = "customData")]
10522    #[serde(default, skip_serializing_if = "Option::is_none")]
10523    pub custom_data: Option<crate::types::CustomData>,
10524}
10525
10526impl TaxRule {
10527    /// Creates a `TaxRule` from its required fields.
10528    #[must_use]
10529    pub fn new(
10530        tax_rule_id: i32,
10531        applies_to_energy_fee: bool,
10532        applies_to_parking_fee: bool,
10533        applies_to_overstay_fee: bool,
10534        applies_to_minimum_maximum_cost: bool,
10535        tax_rate: RationalNumber,
10536    ) -> Self {
10537        Self {
10538            tax_rule_id,
10539            applies_to_energy_fee,
10540            applies_to_parking_fee,
10541            applies_to_overstay_fee,
10542            applies_to_minimum_maximum_cost,
10543            tax_rate,
10544            tax_rule_name: None,
10545            tax_included_in_price: None,
10546            custom_data: None,
10547        }
10548    }
10549
10550    /// Sets the optional `taxRuleName` field.
10551    #[must_use]
10552    pub fn with_tax_rule_name(mut self, value: impl Into<String>) -> Self {
10553        self.tax_rule_name = Some(value.into());
10554        self
10555    }
10556
10557    /// Sets the optional `taxIncludedInPrice` field.
10558    #[must_use]
10559    pub fn with_tax_included_in_price(mut self, value: bool) -> Self {
10560        self.tax_included_in_price = Some(value);
10561        self
10562    }
10563
10564    /// Sets the optional `customData` field.
10565    #[must_use]
10566    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10567        self.custom_data = Some(value);
10568        self
10569    }
10570}
10571
10572impl Validate for TaxRule {
10573    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10574        path.push_key("taxRuleID");
10575        validate::int_range(i64::from(self.tax_rule_id), Some(0), None, path, out);
10576        path.pop();
10577        path.push_key("taxRate");
10578        Validate::validate_at(&self.tax_rate, path, out);
10579        path.pop();
10580        path.push_key("taxRuleName");
10581        if let Some(value) = &self.tax_rule_name {
10582            validate::string(value.as_str(), None, Some(100), path, out);
10583        }
10584        path.pop();
10585        path.push_key("customData");
10586        if let Some(value) = &self.custom_data {
10587            Validate::validate_at(value, path, out);
10588        }
10589        path.pop();
10590    }
10591}
10592
10593/// This contains the cost calculated during a transaction. It is used both for running cost and final cost of the transaction.
10594///
10595/// The OCPP 2.1 `TotalCost` data type.
10596#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10597pub struct TotalCost {
10598    /// Currency of the costs in ISO 4217 Code.
10599    pub currency: String,
10600    /// The `typeOfCost` member.
10601    #[serde(rename = "typeOfCost")]
10602    pub type_of_cost: TariffCost,
10603    /// The `total` member.
10604    pub total: TotalPrice,
10605    /// The `fixed` member.
10606    #[serde(default, skip_serializing_if = "Option::is_none")]
10607    pub fixed: Option<Price>,
10608    /// The `energy` member.
10609    #[serde(default, skip_serializing_if = "Option::is_none")]
10610    pub energy: Option<Price>,
10611    /// The `chargingTime` member.
10612    #[serde(rename = "chargingTime")]
10613    #[serde(default, skip_serializing_if = "Option::is_none")]
10614    pub charging_time: Option<Price>,
10615    /// The `idleTime` member.
10616    #[serde(rename = "idleTime")]
10617    #[serde(default, skip_serializing_if = "Option::is_none")]
10618    pub idle_time: Option<Price>,
10619    /// The `reservationTime` member.
10620    #[serde(rename = "reservationTime")]
10621    #[serde(default, skip_serializing_if = "Option::is_none")]
10622    pub reservation_time: Option<Price>,
10623    /// The `reservationFixed` member.
10624    #[serde(rename = "reservationFixed")]
10625    #[serde(default, skip_serializing_if = "Option::is_none")]
10626    pub reservation_fixed: Option<Price>,
10627    /// The `customData` member.
10628    #[serde(rename = "customData")]
10629    #[serde(default, skip_serializing_if = "Option::is_none")]
10630    pub custom_data: Option<crate::types::CustomData>,
10631}
10632
10633impl TotalCost {
10634    /// Creates a `TotalCost` from its required fields.
10635    #[must_use]
10636    pub fn new(currency: impl Into<String>, type_of_cost: TariffCost, total: TotalPrice) -> Self {
10637        Self {
10638            currency: currency.into(),
10639            type_of_cost,
10640            total,
10641            fixed: None,
10642            energy: None,
10643            charging_time: None,
10644            idle_time: None,
10645            reservation_time: None,
10646            reservation_fixed: None,
10647            custom_data: None,
10648        }
10649    }
10650
10651    /// Sets the optional `fixed` field.
10652    #[must_use]
10653    pub fn with_fixed(mut self, value: Price) -> Self {
10654        self.fixed = Some(value);
10655        self
10656    }
10657
10658    /// Sets the optional `energy` field.
10659    #[must_use]
10660    pub fn with_energy(mut self, value: Price) -> Self {
10661        self.energy = Some(value);
10662        self
10663    }
10664
10665    /// Sets the optional `chargingTime` field.
10666    #[must_use]
10667    pub fn with_charging_time(mut self, value: Price) -> Self {
10668        self.charging_time = Some(value);
10669        self
10670    }
10671
10672    /// Sets the optional `idleTime` field.
10673    #[must_use]
10674    pub fn with_idle_time(mut self, value: Price) -> Self {
10675        self.idle_time = Some(value);
10676        self
10677    }
10678
10679    /// Sets the optional `reservationTime` field.
10680    #[must_use]
10681    pub fn with_reservation_time(mut self, value: Price) -> Self {
10682        self.reservation_time = Some(value);
10683        self
10684    }
10685
10686    /// Sets the optional `reservationFixed` field.
10687    #[must_use]
10688    pub fn with_reservation_fixed(mut self, value: Price) -> Self {
10689        self.reservation_fixed = Some(value);
10690        self
10691    }
10692
10693    /// Sets the optional `customData` field.
10694    #[must_use]
10695    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10696        self.custom_data = Some(value);
10697        self
10698    }
10699}
10700
10701impl Validate for TotalCost {
10702    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10703        path.push_key("currency");
10704        validate::string(self.currency.as_str(), None, Some(3), path, out);
10705        path.pop();
10706        path.push_key("typeOfCost");
10707        Validate::validate_at(&self.type_of_cost, path, out);
10708        path.pop();
10709        path.push_key("total");
10710        Validate::validate_at(&self.total, path, out);
10711        path.pop();
10712        path.push_key("fixed");
10713        if let Some(value) = &self.fixed {
10714            Validate::validate_at(value, path, out);
10715        }
10716        path.pop();
10717        path.push_key("energy");
10718        if let Some(value) = &self.energy {
10719            Validate::validate_at(value, path, out);
10720        }
10721        path.pop();
10722        path.push_key("chargingTime");
10723        if let Some(value) = &self.charging_time {
10724            Validate::validate_at(value, path, out);
10725        }
10726        path.pop();
10727        path.push_key("idleTime");
10728        if let Some(value) = &self.idle_time {
10729            Validate::validate_at(value, path, out);
10730        }
10731        path.pop();
10732        path.push_key("reservationTime");
10733        if let Some(value) = &self.reservation_time {
10734            Validate::validate_at(value, path, out);
10735        }
10736        path.pop();
10737        path.push_key("reservationFixed");
10738        if let Some(value) = &self.reservation_fixed {
10739            Validate::validate_at(value, path, out);
10740        }
10741        path.pop();
10742        path.push_key("customData");
10743        if let Some(value) = &self.custom_data {
10744            Validate::validate_at(value, path, out);
10745        }
10746        path.pop();
10747    }
10748}
10749
10750/// Total cost with and without tax. Contains the total of energy, charging time, idle time, fixed and reservation costs including and/or excluding tax.
10751///
10752/// The OCPP 2.1 `TotalPrice` data type.
10753#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10754pub struct TotalPrice {
10755    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
10756    #[serde(rename = "exclTax")]
10757    #[serde(default, skip_serializing_if = "Option::is_none")]
10758    pub excl_tax: Option<crate::types::Decimal>,
10759    /// Price/cost including tax. Can be absent if _exclTax_ is present.
10760    #[serde(rename = "inclTax")]
10761    #[serde(default, skip_serializing_if = "Option::is_none")]
10762    pub incl_tax: Option<crate::types::Decimal>,
10763    /// The `customData` member.
10764    #[serde(rename = "customData")]
10765    #[serde(default, skip_serializing_if = "Option::is_none")]
10766    pub custom_data: Option<crate::types::CustomData>,
10767}
10768
10769impl TotalPrice {
10770    /// Creates an empty `TotalPrice`. Every field of this type is optional.
10771    #[must_use]
10772    pub fn new() -> Self {
10773        Self::default()
10774    }
10775
10776    /// Sets the optional `exclTax` field.
10777    #[must_use]
10778    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10779        self.excl_tax = Some(value.into());
10780        self
10781    }
10782
10783    /// Sets the optional `inclTax` field.
10784    #[must_use]
10785    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10786        self.incl_tax = Some(value.into());
10787        self
10788    }
10789
10790    /// Sets the optional `customData` field.
10791    #[must_use]
10792    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10793        self.custom_data = Some(value);
10794        self
10795    }
10796}
10797
10798impl Validate for TotalPrice {
10799    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10800        path.push_key("customData");
10801        if let Some(value) = &self.custom_data {
10802            Validate::validate_at(value, path, out);
10803        }
10804        path.pop();
10805    }
10806}
10807
10808/// This contains the calculated usage of energy, charging time and idle time during a transaction.
10809///
10810/// The OCPP 2.1 `TotalUsage` data type.
10811#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10812pub struct TotalUsage {
10813    /// The `energy` member.
10814    pub energy: crate::types::Decimal,
10815    /// Total duration of the charging session (including the duration of charging and not charging), in seconds.
10816    #[serde(rename = "chargingTime")]
10817    #[serde(deserialize_with = "crate::types::integer::one")]
10818    pub charging_time: i32,
10819    /// Total duration of the charging session where the EV was not charging (no energy was transferred between EVSE and EV), in seconds.
10820    #[serde(rename = "idleTime")]
10821    #[serde(deserialize_with = "crate::types::integer::one")]
10822    pub idle_time: i32,
10823    /// Total time of reservation in seconds.
10824    #[serde(rename = "reservationTime")]
10825    #[serde(default, skip_serializing_if = "Option::is_none")]
10826    #[serde(deserialize_with = "crate::types::integer::option")]
10827    pub reservation_time: Option<i32>,
10828    /// The `customData` member.
10829    #[serde(rename = "customData")]
10830    #[serde(default, skip_serializing_if = "Option::is_none")]
10831    pub custom_data: Option<crate::types::CustomData>,
10832}
10833
10834impl TotalUsage {
10835    /// Creates a `TotalUsage` from its required fields.
10836    #[must_use]
10837    pub fn new(
10838        energy: impl Into<crate::types::Decimal>,
10839        charging_time: i32,
10840        idle_time: i32,
10841    ) -> Self {
10842        Self {
10843            energy: energy.into(),
10844            charging_time,
10845            idle_time,
10846            reservation_time: None,
10847            custom_data: None,
10848        }
10849    }
10850
10851    /// Sets the optional `reservationTime` field.
10852    #[must_use]
10853    pub fn with_reservation_time(mut self, value: i32) -> Self {
10854        self.reservation_time = Some(value);
10855        self
10856    }
10857
10858    /// Sets the optional `customData` field.
10859    #[must_use]
10860    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10861        self.custom_data = Some(value);
10862        self
10863    }
10864}
10865
10866impl Validate for TotalUsage {
10867    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10868        path.push_key("customData");
10869        if let Some(value) = &self.custom_data {
10870            Validate::validate_at(value, path, out);
10871        }
10872        path.pop();
10873    }
10874}
10875
10876/// The OCPP 2.1 `Transaction` data type.
10877#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10878pub struct Transaction {
10879    /// This contains the Id of the transaction.
10880    #[serde(rename = "transactionId")]
10881    pub transaction_id: String,
10882    /// The `chargingState` member.
10883    #[serde(rename = "chargingState")]
10884    #[serde(default, skip_serializing_if = "Option::is_none")]
10885    pub charging_state: Option<ChargingState>,
10886    /// 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.
10887    #[serde(rename = "timeSpentCharging")]
10888    #[serde(default, skip_serializing_if = "Option::is_none")]
10889    #[serde(deserialize_with = "crate::types::integer::option")]
10890    pub time_spent_charging: Option<i32>,
10891    /// The `stoppedReason` member.
10892    #[serde(rename = "stoppedReason")]
10893    #[serde(default, skip_serializing_if = "Option::is_none")]
10894    pub stopped_reason: Option<Reason>,
10895    /// 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.
10896    #[serde(rename = "remoteStartId")]
10897    #[serde(default, skip_serializing_if = "Option::is_none")]
10898    #[serde(deserialize_with = "crate::types::integer::option")]
10899    pub remote_start_id: Option<i32>,
10900    /// The `operationMode` member.
10901    #[serde(rename = "operationMode")]
10902    #[serde(default, skip_serializing_if = "Option::is_none")]
10903    pub operation_mode: Option<OperationMode>,
10904    /// *(2.1)* Id of tariff in use for transaction
10905    #[serde(rename = "tariffId")]
10906    #[serde(default, skip_serializing_if = "Option::is_none")]
10907    pub tariff_id: Option<String>,
10908    /// The `transactionLimit` member.
10909    #[serde(rename = "transactionLimit")]
10910    #[serde(default, skip_serializing_if = "Option::is_none")]
10911    pub transaction_limit: Option<TransactionLimit>,
10912    /// The `customData` member.
10913    #[serde(rename = "customData")]
10914    #[serde(default, skip_serializing_if = "Option::is_none")]
10915    pub custom_data: Option<crate::types::CustomData>,
10916}
10917
10918impl Transaction {
10919    /// Creates a `Transaction` from its required fields.
10920    #[must_use]
10921    pub fn new(transaction_id: impl Into<String>) -> Self {
10922        Self {
10923            transaction_id: transaction_id.into(),
10924            charging_state: None,
10925            time_spent_charging: None,
10926            stopped_reason: None,
10927            remote_start_id: None,
10928            operation_mode: None,
10929            tariff_id: None,
10930            transaction_limit: None,
10931            custom_data: None,
10932        }
10933    }
10934
10935    /// Sets the optional `chargingState` field.
10936    #[must_use]
10937    pub fn with_charging_state(mut self, value: ChargingState) -> Self {
10938        self.charging_state = Some(value);
10939        self
10940    }
10941
10942    /// Sets the optional `timeSpentCharging` field.
10943    #[must_use]
10944    pub fn with_time_spent_charging(mut self, value: i32) -> Self {
10945        self.time_spent_charging = Some(value);
10946        self
10947    }
10948
10949    /// Sets the optional `stoppedReason` field.
10950    #[must_use]
10951    pub fn with_stopped_reason(mut self, value: Reason) -> Self {
10952        self.stopped_reason = Some(value);
10953        self
10954    }
10955
10956    /// Sets the optional `remoteStartId` field.
10957    #[must_use]
10958    pub fn with_remote_start_id(mut self, value: i32) -> Self {
10959        self.remote_start_id = Some(value);
10960        self
10961    }
10962
10963    /// Sets the optional `operationMode` field.
10964    #[must_use]
10965    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
10966        self.operation_mode = Some(value);
10967        self
10968    }
10969
10970    /// Sets the optional `tariffId` field.
10971    #[must_use]
10972    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
10973        self.tariff_id = Some(value.into());
10974        self
10975    }
10976
10977    /// Sets the optional `transactionLimit` field.
10978    #[must_use]
10979    pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
10980        self.transaction_limit = Some(value);
10981        self
10982    }
10983
10984    /// Sets the optional `customData` field.
10985    #[must_use]
10986    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10987        self.custom_data = Some(value);
10988        self
10989    }
10990}
10991
10992impl Validate for Transaction {
10993    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10994        path.push_key("transactionId");
10995        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
10996        path.pop();
10997        path.push_key("chargingState");
10998        if let Some(value) = &self.charging_state {
10999            Validate::validate_at(value, path, out);
11000        }
11001        path.pop();
11002        path.push_key("stoppedReason");
11003        if let Some(value) = &self.stopped_reason {
11004            Validate::validate_at(value, path, out);
11005        }
11006        path.pop();
11007        path.push_key("operationMode");
11008        if let Some(value) = &self.operation_mode {
11009            Validate::validate_at(value, path, out);
11010        }
11011        path.pop();
11012        path.push_key("tariffId");
11013        if let Some(value) = &self.tariff_id {
11014            validate::string(value.as_str(), None, Some(60), path, out);
11015        }
11016        path.pop();
11017        path.push_key("transactionLimit");
11018        if let Some(value) = &self.transaction_limit {
11019            Validate::validate_at(value, path, out);
11020        }
11021        path.pop();
11022        path.push_key("customData");
11023        if let Some(value) = &self.custom_data {
11024            Validate::validate_at(value, path, out);
11025        }
11026        path.pop();
11027    }
11028}
11029
11030/// Cost, energy, time or SoC limit for a transaction.
11031///
11032/// The OCPP 2.1 `TransactionLimit` data type.
11033#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11034pub struct TransactionLimit {
11035    /// Maximum allowed cost of transaction in currency of tariff.
11036    #[serde(rename = "maxCost")]
11037    #[serde(default, skip_serializing_if = "Option::is_none")]
11038    pub max_cost: Option<crate::types::Decimal>,
11039    /// Maximum allowed energy in Wh to charge in transaction.
11040    #[serde(rename = "maxEnergy")]
11041    #[serde(default, skip_serializing_if = "Option::is_none")]
11042    pub max_energy: Option<crate::types::Decimal>,
11043    /// Maximum duration of transaction in seconds from start to end.
11044    #[serde(rename = "maxTime")]
11045    #[serde(default, skip_serializing_if = "Option::is_none")]
11046    #[serde(deserialize_with = "crate::types::integer::option")]
11047    pub max_time: Option<i32>,
11048    /// Maximum State of Charge of EV in percentage.
11049    #[serde(rename = "maxSoC")]
11050    #[serde(default, skip_serializing_if = "Option::is_none")]
11051    #[serde(deserialize_with = "crate::types::integer::option")]
11052    pub max_so_c: Option<i32>,
11053    /// The `customData` member.
11054    #[serde(rename = "customData")]
11055    #[serde(default, skip_serializing_if = "Option::is_none")]
11056    pub custom_data: Option<crate::types::CustomData>,
11057}
11058
11059impl TransactionLimit {
11060    /// Creates an empty `TransactionLimit`. Every field of this type is optional.
11061    #[must_use]
11062    pub fn new() -> Self {
11063        Self::default()
11064    }
11065
11066    /// Sets the optional `maxCost` field.
11067    #[must_use]
11068    pub fn with_max_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11069        self.max_cost = Some(value.into());
11070        self
11071    }
11072
11073    /// Sets the optional `maxEnergy` field.
11074    #[must_use]
11075    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11076        self.max_energy = Some(value.into());
11077        self
11078    }
11079
11080    /// Sets the optional `maxTime` field.
11081    #[must_use]
11082    pub fn with_max_time(mut self, value: i32) -> Self {
11083        self.max_time = Some(value);
11084        self
11085    }
11086
11087    /// Sets the optional `maxSoC` field.
11088    #[must_use]
11089    pub fn with_max_so_c(mut self, value: i32) -> Self {
11090        self.max_so_c = Some(value);
11091        self
11092    }
11093
11094    /// Sets the optional `customData` field.
11095    #[must_use]
11096    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11097        self.custom_data = Some(value);
11098        self
11099    }
11100}
11101
11102impl Validate for TransactionLimit {
11103    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11104        path.push_key("maxSoC");
11105        if let Some(value) = &self.max_so_c {
11106            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
11107        }
11108        path.pop();
11109        path.push_key("customData");
11110        if let Some(value) = &self.custom_data {
11111            Validate::validate_at(value, path, out);
11112        }
11113        path.pop();
11114    }
11115}
11116
11117/// Represents a UnitOfMeasure with a multiplier
11118///
11119/// The OCPP 2.1 `UnitOfMeasure` data type.
11120#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11121pub struct UnitOfMeasure {
11122    /// Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type.
11123    /// This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
11124    /// If an applicable unit is available in that list, otherwise a "custom" unit might be used.
11125    /// Schema default: `"Wh"`.
11126    #[serde(default, skip_serializing_if = "Option::is_none")]
11127    pub unit: Option<String>,
11128    /// Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0. +
11129    /// The _multiplier_ only multiplies the value of the measurand. It does not specify a conversion between units, for example, kW and W.
11130    /// Schema default: `0`.
11131    #[serde(default, skip_serializing_if = "Option::is_none")]
11132    #[serde(deserialize_with = "crate::types::integer::option")]
11133    pub multiplier: Option<i32>,
11134    /// The `customData` member.
11135    #[serde(rename = "customData")]
11136    #[serde(default, skip_serializing_if = "Option::is_none")]
11137    pub custom_data: Option<crate::types::CustomData>,
11138}
11139
11140impl UnitOfMeasure {
11141    /// Creates an empty `UnitOfMeasure`. Every field of this type is optional.
11142    #[must_use]
11143    pub fn new() -> Self {
11144        Self::default()
11145    }
11146
11147    /// Sets the optional `unit` field.
11148    #[must_use]
11149    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11150        self.unit = Some(value.into());
11151        self
11152    }
11153
11154    /// Sets the optional `multiplier` field.
11155    #[must_use]
11156    pub fn with_multiplier(mut self, value: i32) -> Self {
11157        self.multiplier = Some(value);
11158        self
11159    }
11160
11161    /// Sets the optional `customData` field.
11162    #[must_use]
11163    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11164        self.custom_data = Some(value);
11165        self
11166    }
11167}
11168
11169impl Validate for UnitOfMeasure {
11170    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11171        path.push_key("unit");
11172        if let Some(value) = &self.unit {
11173            validate::string(value.as_str(), None, Some(20), path, out);
11174        }
11175        path.pop();
11176        path.push_key("customData");
11177        if let Some(value) = &self.custom_data {
11178            Validate::validate_at(value, path, out);
11179        }
11180        path.pop();
11181    }
11182}
11183
11184/// Charging parameters for ISO 15118-20, also supporting V2X charging/discharging.+
11185/// All values are greater or equal to zero, with the exception of EVMinEnergyRequest, EVMaxEnergyRequest, EVTargetEnergyRequest, EVMinV2XEnergyRequest and EVMaxV2XEnergyRequest.
11186///
11187/// The OCPP 2.1 `V2XChargingParameters` data type.
11188#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11189pub struct V2XChargingParameters {
11190    /// Minimum charge power in W, defined by max(EV, EVSE).
11191    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11192    /// Relates to:
11193    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower
11194    #[serde(rename = "minChargePower")]
11195    #[serde(default, skip_serializing_if = "Option::is_none")]
11196    pub min_charge_power: Option<crate::types::Decimal>,
11197    /// Minimum charge power on phase L2 in W, defined by max(EV, EVSE).
11198    /// Relates to:
11199    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L2
11200    #[serde(rename = "minChargePower_L2")]
11201    #[serde(default, skip_serializing_if = "Option::is_none")]
11202    pub min_charge_power_l2: Option<crate::types::Decimal>,
11203    /// Minimum charge power on phase L3 in W, defined by max(EV, EVSE).
11204    /// Relates to:
11205    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L3
11206    #[serde(rename = "minChargePower_L3")]
11207    #[serde(default, skip_serializing_if = "Option::is_none")]
11208    pub min_charge_power_l3: Option<crate::types::Decimal>,
11209    /// Maximum charge (absorbed) power in W, defined by min(EV, EVSE) at unity power factor. +
11210    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11211    /// It corresponds to the ChaWMax attribute in the IEC 61850.
11212    /// It is usually equivalent to the rated apparent power of the EV when discharging (ChaVAMax) in IEC 61850. +
11213    ///
11214    /// Relates to:
11215    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower
11216    #[serde(rename = "maxChargePower")]
11217    #[serde(default, skip_serializing_if = "Option::is_none")]
11218    pub max_charge_power: Option<crate::types::Decimal>,
11219    /// Maximum charge power on phase L2 in W, defined by min(EV, EVSE)
11220    /// Relates to:
11221    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L2
11222    #[serde(rename = "maxChargePower_L2")]
11223    #[serde(default, skip_serializing_if = "Option::is_none")]
11224    pub max_charge_power_l2: Option<crate::types::Decimal>,
11225    /// Maximum charge power on phase L3 in W, defined by min(EV, EVSE)
11226    /// Relates to:
11227    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L3
11228    #[serde(rename = "maxChargePower_L3")]
11229    #[serde(default, skip_serializing_if = "Option::is_none")]
11230    pub max_charge_power_l3: Option<crate::types::Decimal>,
11231    /// Minimum discharge (injected) power in W, defined by max(EV, EVSE) at unity power factor. Value &gt;= 0. +
11232    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1. +
11233    /// It corresponds to the WMax attribute in the IEC 61850.
11234    /// It is usually equivalent to the rated apparent power of the EV when discharging (VAMax attribute in the IEC 61850).
11235    ///
11236    /// Relates to:
11237    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower
11238    #[serde(rename = "minDischargePower")]
11239    #[serde(default, skip_serializing_if = "Option::is_none")]
11240    pub min_discharge_power: Option<crate::types::Decimal>,
11241    /// Minimum discharge power on phase L2 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11242    /// Relates to:
11243    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L2
11244    #[serde(rename = "minDischargePower_L2")]
11245    #[serde(default, skip_serializing_if = "Option::is_none")]
11246    pub min_discharge_power_l2: Option<crate::types::Decimal>,
11247    /// Minimum discharge power on phase L3 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11248    /// Relates to:
11249    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L3
11250    #[serde(rename = "minDischargePower_L3")]
11251    #[serde(default, skip_serializing_if = "Option::is_none")]
11252    pub min_discharge_power_l3: Option<crate::types::Decimal>,
11253    /// Maximum discharge (injected) power in W, defined by min(EV, EVSE) at unity power factor.  Value &gt;= 0.
11254    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11255    /// Relates to:
11256    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower
11257    #[serde(rename = "maxDischargePower")]
11258    #[serde(default, skip_serializing_if = "Option::is_none")]
11259    pub max_discharge_power: Option<crate::types::Decimal>,
11260    /// Maximum discharge power on phase L2 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11261    /// Relates to:
11262    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePowe_L2
11263    #[serde(rename = "maxDischargePower_L2")]
11264    #[serde(default, skip_serializing_if = "Option::is_none")]
11265    pub max_discharge_power_l2: Option<crate::types::Decimal>,
11266    /// Maximum discharge power on phase L3 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11267    /// Relates to:
11268    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower_L3
11269    #[serde(rename = "maxDischargePower_L3")]
11270    #[serde(default, skip_serializing_if = "Option::is_none")]
11271    pub max_discharge_power_l3: Option<crate::types::Decimal>,
11272    /// Minimum charge current in A, defined by max(EV, EVSE)
11273    /// Relates to:
11274    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumChargeCurrent
11275    #[serde(rename = "minChargeCurrent")]
11276    #[serde(default, skip_serializing_if = "Option::is_none")]
11277    pub min_charge_current: Option<crate::types::Decimal>,
11278    /// Maximum charge current in A, defined by min(EV, EVSE)
11279    /// Relates to:
11280    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumChargeCurrent
11281    #[serde(rename = "maxChargeCurrent")]
11282    #[serde(default, skip_serializing_if = "Option::is_none")]
11283    pub max_charge_current: Option<crate::types::Decimal>,
11284    /// Minimum discharge current in A, defined by max(EV, EVSE).  Value &gt;= 0.
11285    /// Relates to:
11286    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumDischargeCurrent
11287    #[serde(rename = "minDischargeCurrent")]
11288    #[serde(default, skip_serializing_if = "Option::is_none")]
11289    pub min_discharge_current: Option<crate::types::Decimal>,
11290    /// Maximum discharge current in A, defined by min(EV, EVSE).  Value &gt;= 0.
11291    /// Relates to:
11292    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumDischargeCurrent
11293    #[serde(rename = "maxDischargeCurrent")]
11294    #[serde(default, skip_serializing_if = "Option::is_none")]
11295    pub max_discharge_current: Option<crate::types::Decimal>,
11296    /// Minimum voltage in V, defined by max(EV, EVSE)
11297    /// Relates to:
11298    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumVoltage
11299    #[serde(rename = "minVoltage")]
11300    #[serde(default, skip_serializing_if = "Option::is_none")]
11301    pub min_voltage: Option<crate::types::Decimal>,
11302    /// Maximum voltage in V, defined by min(EV, EVSE)
11303    /// Relates to:
11304    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumVoltage
11305    #[serde(rename = "maxVoltage")]
11306    #[serde(default, skip_serializing_if = "Option::is_none")]
11307    pub max_voltage: Option<crate::types::Decimal>,
11308    /// Energy to requested state of charge in Wh
11309    /// Relates to:
11310    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVTargetEnergyRequest
11311    #[serde(rename = "evTargetEnergyRequest")]
11312    #[serde(default, skip_serializing_if = "Option::is_none")]
11313    pub ev_target_energy_request: Option<crate::types::Decimal>,
11314    /// Energy to minimum allowed state of charge in Wh
11315    /// Relates to:
11316    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMinimumEnergyRequest
11317    #[serde(rename = "evMinEnergyRequest")]
11318    #[serde(default, skip_serializing_if = "Option::is_none")]
11319    pub ev_min_energy_request: Option<crate::types::Decimal>,
11320    /// Energy to maximum state of charge in Wh
11321    /// Relates to:
11322    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMaximumEnergyRequest
11323    #[serde(rename = "evMaxEnergyRequest")]
11324    #[serde(default, skip_serializing_if = "Option::is_none")]
11325    pub ev_max_energy_request: Option<crate::types::Decimal>,
11326    /// Energy (in Wh) to minimum state of charge for cycling (V2X) activity.
11327    /// Positive value means that current state of charge is below V2X range.
11328    /// Relates to:
11329    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMinimumV2XEnergyRequest
11330    #[serde(rename = "evMinV2XEnergyRequest")]
11331    #[serde(default, skip_serializing_if = "Option::is_none")]
11332    pub ev_min_v2_x_energy_request: Option<crate::types::Decimal>,
11333    /// Energy (in Wh) to maximum state of charge for cycling (V2X) activity.
11334    /// Negative value indicates that current state of charge is above V2X range.
11335    /// Relates to:
11336    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMaximumV2XEnergyRequest
11337    #[serde(rename = "evMaxV2XEnergyRequest")]
11338    #[serde(default, skip_serializing_if = "Option::is_none")]
11339    pub ev_max_v2_x_energy_request: Option<crate::types::Decimal>,
11340    /// Target state of charge at departure as percentage.
11341    /// Relates to:
11342    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: TargetSOC
11343    #[serde(rename = "targetSoC")]
11344    #[serde(default, skip_serializing_if = "Option::is_none")]
11345    #[serde(deserialize_with = "crate::types::integer::option")]
11346    pub target_so_c: Option<i32>,
11347    /// The `customData` member.
11348    #[serde(rename = "customData")]
11349    #[serde(default, skip_serializing_if = "Option::is_none")]
11350    pub custom_data: Option<crate::types::CustomData>,
11351}
11352
11353impl V2XChargingParameters {
11354    /// Creates an empty `V2XChargingParameters`. Every field of this type is optional.
11355    #[must_use]
11356    pub fn new() -> Self {
11357        Self::default()
11358    }
11359
11360    /// Sets the optional `minChargePower` field.
11361    #[must_use]
11362    pub fn with_min_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11363        self.min_charge_power = Some(value.into());
11364        self
11365    }
11366
11367    /// Sets the optional `minChargePower_L2` field.
11368    #[must_use]
11369    pub fn with_min_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11370        self.min_charge_power_l2 = Some(value.into());
11371        self
11372    }
11373
11374    /// Sets the optional `minChargePower_L3` field.
11375    #[must_use]
11376    pub fn with_min_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11377        self.min_charge_power_l3 = Some(value.into());
11378        self
11379    }
11380
11381    /// Sets the optional `maxChargePower` field.
11382    #[must_use]
11383    pub fn with_max_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11384        self.max_charge_power = Some(value.into());
11385        self
11386    }
11387
11388    /// Sets the optional `maxChargePower_L2` field.
11389    #[must_use]
11390    pub fn with_max_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11391        self.max_charge_power_l2 = Some(value.into());
11392        self
11393    }
11394
11395    /// Sets the optional `maxChargePower_L3` field.
11396    #[must_use]
11397    pub fn with_max_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11398        self.max_charge_power_l3 = Some(value.into());
11399        self
11400    }
11401
11402    /// Sets the optional `minDischargePower` field.
11403    #[must_use]
11404    pub fn with_min_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11405        self.min_discharge_power = Some(value.into());
11406        self
11407    }
11408
11409    /// Sets the optional `minDischargePower_L2` field.
11410    #[must_use]
11411    pub fn with_min_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11412        self.min_discharge_power_l2 = Some(value.into());
11413        self
11414    }
11415
11416    /// Sets the optional `minDischargePower_L3` field.
11417    #[must_use]
11418    pub fn with_min_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11419        self.min_discharge_power_l3 = Some(value.into());
11420        self
11421    }
11422
11423    /// Sets the optional `maxDischargePower` field.
11424    #[must_use]
11425    pub fn with_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11426        self.max_discharge_power = Some(value.into());
11427        self
11428    }
11429
11430    /// Sets the optional `maxDischargePower_L2` field.
11431    #[must_use]
11432    pub fn with_max_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11433        self.max_discharge_power_l2 = Some(value.into());
11434        self
11435    }
11436
11437    /// Sets the optional `maxDischargePower_L3` field.
11438    #[must_use]
11439    pub fn with_max_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11440        self.max_discharge_power_l3 = Some(value.into());
11441        self
11442    }
11443
11444    /// Sets the optional `minChargeCurrent` field.
11445    #[must_use]
11446    pub fn with_min_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11447        self.min_charge_current = Some(value.into());
11448        self
11449    }
11450
11451    /// Sets the optional `maxChargeCurrent` field.
11452    #[must_use]
11453    pub fn with_max_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11454        self.max_charge_current = Some(value.into());
11455        self
11456    }
11457
11458    /// Sets the optional `minDischargeCurrent` field.
11459    #[must_use]
11460    pub fn with_min_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11461        self.min_discharge_current = Some(value.into());
11462        self
11463    }
11464
11465    /// Sets the optional `maxDischargeCurrent` field.
11466    #[must_use]
11467    pub fn with_max_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11468        self.max_discharge_current = Some(value.into());
11469        self
11470    }
11471
11472    /// Sets the optional `minVoltage` field.
11473    #[must_use]
11474    pub fn with_min_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11475        self.min_voltage = Some(value.into());
11476        self
11477    }
11478
11479    /// Sets the optional `maxVoltage` field.
11480    #[must_use]
11481    pub fn with_max_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11482        self.max_voltage = Some(value.into());
11483        self
11484    }
11485
11486    /// Sets the optional `evTargetEnergyRequest` field.
11487    #[must_use]
11488    pub fn with_ev_target_energy_request(
11489        mut self,
11490        value: impl Into<crate::types::Decimal>,
11491    ) -> Self {
11492        self.ev_target_energy_request = Some(value.into());
11493        self
11494    }
11495
11496    /// Sets the optional `evMinEnergyRequest` field.
11497    #[must_use]
11498    pub fn with_ev_min_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11499        self.ev_min_energy_request = Some(value.into());
11500        self
11501    }
11502
11503    /// Sets the optional `evMaxEnergyRequest` field.
11504    #[must_use]
11505    pub fn with_ev_max_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11506        self.ev_max_energy_request = Some(value.into());
11507        self
11508    }
11509
11510    /// Sets the optional `evMinV2XEnergyRequest` field.
11511    #[must_use]
11512    pub fn with_ev_min_v2_x_energy_request(
11513        mut self,
11514        value: impl Into<crate::types::Decimal>,
11515    ) -> Self {
11516        self.ev_min_v2_x_energy_request = Some(value.into());
11517        self
11518    }
11519
11520    /// Sets the optional `evMaxV2XEnergyRequest` field.
11521    #[must_use]
11522    pub fn with_ev_max_v2_x_energy_request(
11523        mut self,
11524        value: impl Into<crate::types::Decimal>,
11525    ) -> Self {
11526        self.ev_max_v2_x_energy_request = Some(value.into());
11527        self
11528    }
11529
11530    /// Sets the optional `targetSoC` field.
11531    #[must_use]
11532    pub fn with_target_so_c(mut self, value: i32) -> Self {
11533        self.target_so_c = Some(value);
11534        self
11535    }
11536
11537    /// Sets the optional `customData` field.
11538    #[must_use]
11539    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11540        self.custom_data = Some(value);
11541        self
11542    }
11543}
11544
11545impl Validate for V2XChargingParameters {
11546    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11547        path.push_key("targetSoC");
11548        if let Some(value) = &self.target_so_c {
11549            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
11550        }
11551        path.pop();
11552        path.push_key("customData");
11553        if let Some(value) = &self.custom_data {
11554            Validate::validate_at(value, path, out);
11555        }
11556        path.pop();
11557    }
11558}
11559
11560/// *(2.1)* A point of a frequency-watt curve.
11561///
11562/// The OCPP 2.1 `V2XFreqWattPoint` data type.
11563#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11564pub struct V2XFreqWattPoint {
11565    /// Net frequency in Hz.
11566    pub frequency: crate::types::Decimal,
11567    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11568    pub power: crate::types::Decimal,
11569    /// The `customData` member.
11570    #[serde(rename = "customData")]
11571    #[serde(default, skip_serializing_if = "Option::is_none")]
11572    pub custom_data: Option<crate::types::CustomData>,
11573}
11574
11575impl V2XFreqWattPoint {
11576    /// Creates a `V2XFreqWattPoint` from its required fields.
11577    #[must_use]
11578    pub fn new(
11579        frequency: impl Into<crate::types::Decimal>,
11580        power: impl Into<crate::types::Decimal>,
11581    ) -> Self {
11582        Self {
11583            frequency: frequency.into(),
11584            power: power.into(),
11585            custom_data: None,
11586        }
11587    }
11588
11589    /// Sets the optional `customData` field.
11590    #[must_use]
11591    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11592        self.custom_data = Some(value);
11593        self
11594    }
11595}
11596
11597impl Validate for V2XFreqWattPoint {
11598    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11599        path.push_key("customData");
11600        if let Some(value) = &self.custom_data {
11601            Validate::validate_at(value, path, out);
11602        }
11603        path.pop();
11604    }
11605}
11606
11607/// *(2.1)* A point of a signal-watt curve.
11608///
11609/// The OCPP 2.1 `V2XSignalWattPoint` data type.
11610#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11611pub struct V2XSignalWattPoint {
11612    /// Signal value from an AFRRSignalRequest.
11613    #[serde(deserialize_with = "crate::types::integer::one")]
11614    pub signal: i32,
11615    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11616    pub power: crate::types::Decimal,
11617    /// The `customData` member.
11618    #[serde(rename = "customData")]
11619    #[serde(default, skip_serializing_if = "Option::is_none")]
11620    pub custom_data: Option<crate::types::CustomData>,
11621}
11622
11623impl V2XSignalWattPoint {
11624    /// Creates a `V2XSignalWattPoint` from its required fields.
11625    #[must_use]
11626    pub fn new(signal: i32, power: impl Into<crate::types::Decimal>) -> Self {
11627        Self {
11628            signal,
11629            power: power.into(),
11630            custom_data: None,
11631        }
11632    }
11633
11634    /// Sets the optional `customData` field.
11635    #[must_use]
11636    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11637        self.custom_data = Some(value);
11638        self
11639    }
11640}
11641
11642impl Validate for V2XSignalWattPoint {
11643    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11644        path.push_key("customData");
11645        if let Some(value) = &self.custom_data {
11646            Validate::validate_at(value, path, out);
11647        }
11648        path.pop();
11649    }
11650}
11651
11652/// VPN Configuration settings
11653///
11654/// The OCPP 2.1 `VPN` data type.
11655#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11656pub struct VPN {
11657    /// VPN Server Address
11658    pub server: String,
11659    /// VPN User
11660    pub user: String,
11661    /// *(2.1)* VPN Password.
11662    pub password: String,
11663    /// VPN shared secret.
11664    pub key: String,
11665    /// The `type` member.
11666    pub r#type: VPNEnum,
11667    /// VPN group.
11668    #[serde(default, skip_serializing_if = "Option::is_none")]
11669    pub group: Option<String>,
11670    /// The `customData` member.
11671    #[serde(rename = "customData")]
11672    #[serde(default, skip_serializing_if = "Option::is_none")]
11673    pub custom_data: Option<crate::types::CustomData>,
11674}
11675
11676impl VPN {
11677    /// Creates a `VPN` from its required fields.
11678    #[must_use]
11679    pub fn new(
11680        server: impl Into<String>,
11681        user: impl Into<String>,
11682        password: impl Into<String>,
11683        key: impl Into<String>,
11684        r#type: VPNEnum,
11685    ) -> Self {
11686        Self {
11687            server: server.into(),
11688            user: user.into(),
11689            password: password.into(),
11690            key: key.into(),
11691            r#type,
11692            group: None,
11693            custom_data: None,
11694        }
11695    }
11696
11697    /// Sets the optional `group` field.
11698    #[must_use]
11699    pub fn with_group(mut self, value: impl Into<String>) -> Self {
11700        self.group = Some(value.into());
11701        self
11702    }
11703
11704    /// Sets the optional `customData` field.
11705    #[must_use]
11706    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11707        self.custom_data = Some(value);
11708        self
11709    }
11710}
11711
11712impl Validate for VPN {
11713    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11714        path.push_key("server");
11715        validate::string(self.server.as_str(), None, Some(2000), path, out);
11716        path.pop();
11717        path.push_key("user");
11718        validate::string(self.user.as_str(), None, Some(50), path, out);
11719        path.pop();
11720        path.push_key("password");
11721        validate::string(self.password.as_str(), None, Some(64), path, out);
11722        path.pop();
11723        path.push_key("key");
11724        validate::string(self.key.as_str(), None, Some(255), path, out);
11725        path.pop();
11726        path.push_key("type");
11727        Validate::validate_at(&self.r#type, path, out);
11728        path.pop();
11729        path.push_key("group");
11730        if let Some(value) = &self.group {
11731            validate::string(value.as_str(), None, Some(50), path, out);
11732        }
11733        path.pop();
11734        path.push_key("customData");
11735        if let Some(value) = &self.custom_data {
11736            Validate::validate_at(value, path, out);
11737        }
11738        path.pop();
11739    }
11740}
11741
11742/// Reference key to a component-variable.
11743///
11744/// The OCPP 2.1 `Variable` data type.
11745#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11746pub struct Variable {
11747    /// 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.
11748    pub name: String,
11749    /// Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
11750    #[serde(default, skip_serializing_if = "Option::is_none")]
11751    pub instance: Option<String>,
11752    /// The `customData` member.
11753    #[serde(rename = "customData")]
11754    #[serde(default, skip_serializing_if = "Option::is_none")]
11755    pub custom_data: Option<crate::types::CustomData>,
11756}
11757
11758impl Variable {
11759    /// Creates a `Variable` from its required fields.
11760    #[must_use]
11761    pub fn new(name: impl Into<String>) -> Self {
11762        Self {
11763            name: name.into(),
11764            instance: None,
11765            custom_data: None,
11766        }
11767    }
11768
11769    /// Sets the optional `instance` field.
11770    #[must_use]
11771    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
11772        self.instance = Some(value.into());
11773        self
11774    }
11775
11776    /// Sets the optional `customData` field.
11777    #[must_use]
11778    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11779        self.custom_data = Some(value);
11780        self
11781    }
11782}
11783
11784impl Validate for Variable {
11785    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11786        path.push_key("name");
11787        validate::string(self.name.as_str(), None, Some(50), path, out);
11788        path.pop();
11789        path.push_key("instance");
11790        if let Some(value) = &self.instance {
11791            validate::string(value.as_str(), None, Some(50), path, out);
11792        }
11793        path.pop();
11794        path.push_key("customData");
11795        if let Some(value) = &self.custom_data {
11796            Validate::validate_at(value, path, out);
11797        }
11798        path.pop();
11799    }
11800}
11801
11802/// Attribute data of a variable.
11803///
11804/// The OCPP 2.1 `VariableAttribute` data type.
11805#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11806pub struct VariableAttribute {
11807    /// The `type` member.
11808    #[serde(default, skip_serializing_if = "Option::is_none")]
11809    pub r#type: Option<Attribute>,
11810    /// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
11811    ///
11812    /// 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.
11813    #[serde(default, skip_serializing_if = "Option::is_none")]
11814    pub value: Option<String>,
11815    /// The `mutability` member.
11816    #[serde(default, skip_serializing_if = "Option::is_none")]
11817    pub mutability: Option<Mutability>,
11818    /// If true, value will be persistent across system reboots or power down. Default when omitted is false.
11819    /// Schema default: `false`.
11820    #[serde(default, skip_serializing_if = "Option::is_none")]
11821    pub persistent: Option<bool>,
11822    /// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
11823    /// Schema default: `false`.
11824    #[serde(default, skip_serializing_if = "Option::is_none")]
11825    pub constant: Option<bool>,
11826    /// The `customData` member.
11827    #[serde(rename = "customData")]
11828    #[serde(default, skip_serializing_if = "Option::is_none")]
11829    pub custom_data: Option<crate::types::CustomData>,
11830}
11831
11832impl VariableAttribute {
11833    /// Creates an empty `VariableAttribute`. Every field of this type is optional.
11834    #[must_use]
11835    pub fn new() -> Self {
11836        Self::default()
11837    }
11838
11839    /// Sets the optional `type` field.
11840    #[must_use]
11841    pub fn with_type(mut self, value: Attribute) -> Self {
11842        self.r#type = Some(value);
11843        self
11844    }
11845
11846    /// Sets the optional `value` field.
11847    #[must_use]
11848    pub fn with_value(mut self, value: impl Into<String>) -> Self {
11849        self.value = Some(value.into());
11850        self
11851    }
11852
11853    /// Sets the optional `mutability` field.
11854    #[must_use]
11855    pub fn with_mutability(mut self, value: Mutability) -> Self {
11856        self.mutability = Some(value);
11857        self
11858    }
11859
11860    /// Sets the optional `persistent` field.
11861    #[must_use]
11862    pub fn with_persistent(mut self, value: bool) -> Self {
11863        self.persistent = Some(value);
11864        self
11865    }
11866
11867    /// Sets the optional `constant` field.
11868    #[must_use]
11869    pub fn with_constant(mut self, value: bool) -> Self {
11870        self.constant = Some(value);
11871        self
11872    }
11873
11874    /// Sets the optional `customData` field.
11875    #[must_use]
11876    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11877        self.custom_data = Some(value);
11878        self
11879    }
11880}
11881
11882impl Validate for VariableAttribute {
11883    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11884        path.push_key("type");
11885        if let Some(value) = &self.r#type {
11886            Validate::validate_at(value, path, out);
11887        }
11888        path.pop();
11889        path.push_key("value");
11890        if let Some(value) = &self.value {
11891            validate::string(value.as_str(), None, Some(2500), path, out);
11892        }
11893        path.pop();
11894        path.push_key("mutability");
11895        if let Some(value) = &self.mutability {
11896            Validate::validate_at(value, path, out);
11897        }
11898        path.pop();
11899        path.push_key("customData");
11900        if let Some(value) = &self.custom_data {
11901            Validate::validate_at(value, path, out);
11902        }
11903        path.pop();
11904    }
11905}
11906
11907/// Fixed read-only parameters of a variable.
11908///
11909/// The OCPP 2.1 `VariableCharacteristics` data type.
11910#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11911pub struct VariableCharacteristics {
11912    /// The `dataType` member.
11913    #[serde(rename = "dataType")]
11914    pub data_type: Data,
11915    /// Flag indicating if this variable supports monitoring.
11916    #[serde(rename = "supportsMonitoring")]
11917    pub supports_monitoring: bool,
11918    /// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
11919    #[serde(default, skip_serializing_if = "Option::is_none")]
11920    pub unit: Option<String>,
11921    /// Minimum possible value of this variable.
11922    #[serde(rename = "minLimit")]
11923    #[serde(default, skip_serializing_if = "Option::is_none")]
11924    pub min_limit: Option<crate::types::Decimal>,
11925    /// 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.
11926    #[serde(rename = "maxLimit")]
11927    #[serde(default, skip_serializing_if = "Option::is_none")]
11928    pub max_limit: Option<crate::types::Decimal>,
11929    /// *(2.1)* Maximum number of elements from _valuesList_ that are supported as _attributeValue_.
11930    #[serde(rename = "maxElements")]
11931    #[serde(default, skip_serializing_if = "Option::is_none")]
11932    #[serde(deserialize_with = "crate::types::integer::option")]
11933    pub max_elements: Option<i32>,
11934    /// Mandatory when _dataType_ = OptionList, MemberList or SequenceList. In that case _valuesList_ specifies the allowed values for the type.
11935    ///
11936    /// The length of this field can be limited by DeviceDataCtrlr.ConfigurationValueSize.
11937    ///
11938    /// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
11939    ///
11940    /// * MemberList: The (Actual) Variable value  may be an (unordered) (sub-)set of the reported (CSV) valid values list.
11941    ///
11942    /// * SequenceList: The (Actual) Variable value  may be an ordered (priority, etc)  (sub-)set of the reported (CSV) valid values.
11943    ///
11944    /// This is a comma separated list.
11945    ///
11946    /// 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.
11947    #[serde(rename = "valuesList")]
11948    #[serde(default, skip_serializing_if = "Option::is_none")]
11949    pub values_list: Option<String>,
11950    /// The `customData` member.
11951    #[serde(rename = "customData")]
11952    #[serde(default, skip_serializing_if = "Option::is_none")]
11953    pub custom_data: Option<crate::types::CustomData>,
11954}
11955
11956impl VariableCharacteristics {
11957    /// Creates a `VariableCharacteristics` from its required fields.
11958    #[must_use]
11959    pub fn new(data_type: Data, supports_monitoring: bool) -> Self {
11960        Self {
11961            data_type,
11962            supports_monitoring,
11963            unit: None,
11964            min_limit: None,
11965            max_limit: None,
11966            max_elements: None,
11967            values_list: None,
11968            custom_data: None,
11969        }
11970    }
11971
11972    /// Sets the optional `unit` field.
11973    #[must_use]
11974    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11975        self.unit = Some(value.into());
11976        self
11977    }
11978
11979    /// Sets the optional `minLimit` field.
11980    #[must_use]
11981    pub fn with_min_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11982        self.min_limit = Some(value.into());
11983        self
11984    }
11985
11986    /// Sets the optional `maxLimit` field.
11987    #[must_use]
11988    pub fn with_max_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11989        self.max_limit = Some(value.into());
11990        self
11991    }
11992
11993    /// Sets the optional `maxElements` field.
11994    #[must_use]
11995    pub fn with_max_elements(mut self, value: i32) -> Self {
11996        self.max_elements = Some(value);
11997        self
11998    }
11999
12000    /// Sets the optional `valuesList` field.
12001    #[must_use]
12002    pub fn with_values_list(mut self, value: impl Into<String>) -> Self {
12003        self.values_list = Some(value.into());
12004        self
12005    }
12006
12007    /// Sets the optional `customData` field.
12008    #[must_use]
12009    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12010        self.custom_data = Some(value);
12011        self
12012    }
12013}
12014
12015impl Validate for VariableCharacteristics {
12016    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12017        path.push_key("dataType");
12018        Validate::validate_at(&self.data_type, path, out);
12019        path.pop();
12020        path.push_key("unit");
12021        if let Some(value) = &self.unit {
12022            validate::string(value.as_str(), None, Some(16), path, out);
12023        }
12024        path.pop();
12025        path.push_key("maxElements");
12026        if let Some(value) = &self.max_elements {
12027            validate::int_range(i64::from(*value), Some(1), None, path, out);
12028        }
12029        path.pop();
12030        path.push_key("valuesList");
12031        if let Some(value) = &self.values_list {
12032            validate::string(value.as_str(), None, Some(1000), path, out);
12033        }
12034        path.pop();
12035        path.push_key("customData");
12036        if let Some(value) = &self.custom_data {
12037            Validate::validate_at(value, path, out);
12038        }
12039        path.pop();
12040    }
12041}
12042
12043/// A monitoring setting for a variable.
12044///
12045/// The OCPP 2.1 `VariableMonitoring` data type.
12046#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12047pub struct VariableMonitoring {
12048    /// Identifies the monitor.
12049    #[serde(deserialize_with = "crate::types::integer::one")]
12050    pub id: i32,
12051    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction.
12052    pub transaction: bool,
12053    /// Value for threshold or delta monitoring.
12054    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
12055    pub value: crate::types::Decimal,
12056    /// The `type` member.
12057    pub r#type: Monitor,
12058    /// 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.
12059    ///
12060    /// The severity levels have the following meaning: +
12061    /// *0-Danger* +
12062    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
12063    /// *1-Hardware Failure* +
12064    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
12065    /// *2-System Failure* +
12066    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
12067    /// *3-Critical* +
12068    /// Indicates a critical error. Action is required. +
12069    /// *4-Error* +
12070    /// Indicates a non-urgent error. Action is required. +
12071    /// *5-Alert* +
12072    /// Indicates an alert event. Default severity for any type of monitoring event.  +
12073    /// *6-Warning* +
12074    /// Indicates a warning event. Action may be required. +
12075    /// *7-Notice* +
12076    /// Indicates an unusual event. No immediate action is required. +
12077    /// *8-Informational* +
12078    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
12079    /// *9-Debug* +
12080    /// Indicates information useful to developers for debugging, not useful during operations.
12081    #[serde(deserialize_with = "crate::types::integer::one")]
12082    pub severity: i32,
12083    /// The `eventNotificationType` member.
12084    #[serde(rename = "eventNotificationType")]
12085    pub event_notification_type: EventNotification,
12086    /// The `customData` member.
12087    #[serde(rename = "customData")]
12088    #[serde(default, skip_serializing_if = "Option::is_none")]
12089    pub custom_data: Option<crate::types::CustomData>,
12090}
12091
12092impl VariableMonitoring {
12093    /// Creates a `VariableMonitoring` from its required fields.
12094    #[must_use]
12095    pub fn new(
12096        id: i32,
12097        transaction: bool,
12098        value: impl Into<crate::types::Decimal>,
12099        r#type: Monitor,
12100        severity: i32,
12101        event_notification_type: EventNotification,
12102    ) -> Self {
12103        Self {
12104            id,
12105            transaction,
12106            value: value.into(),
12107            r#type,
12108            severity,
12109            event_notification_type,
12110            custom_data: None,
12111        }
12112    }
12113
12114    /// Sets the optional `customData` field.
12115    #[must_use]
12116    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12117        self.custom_data = Some(value);
12118        self
12119    }
12120}
12121
12122impl Validate for VariableMonitoring {
12123    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12124        path.push_key("id");
12125        validate::int_range(i64::from(self.id), Some(0), None, path, out);
12126        path.pop();
12127        path.push_key("type");
12128        Validate::validate_at(&self.r#type, path, out);
12129        path.pop();
12130        path.push_key("severity");
12131        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
12132        path.pop();
12133        path.push_key("eventNotificationType");
12134        Validate::validate_at(&self.event_notification_type, path, out);
12135        path.pop();
12136        path.push_key("customData");
12137        if let Some(value) = &self.custom_data {
12138            Validate::validate_at(value, path, out);
12139        }
12140        path.pop();
12141    }
12142}
12143
12144/// The OCPP 2.1 `VoltageParams` data type.
12145#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
12146pub struct VoltageParams {
12147    /// EN 50549-1 chapter 4.9.3.4
12148    ///     Voltage threshold for the 10 min time window mean value monitoring.
12149    ///     The 10 min mean is recalculated up to every 3 s.
12150    ///     If the present voltage is above this threshold for more than the time defined by _hv10MinMeanValue_, the EV must trip.
12151    ///     This value is mandatory if _hv10MinMeanTripDelay_ is set.
12152    #[serde(rename = "hv10MinMeanValue")]
12153    #[serde(default, skip_serializing_if = "Option::is_none")]
12154    pub hv10_min_mean_value: Option<crate::types::Decimal>,
12155    /// Time for which the voltage is allowed to stay above the 10 min mean value.
12156    ///     After this time, the EV must trip.
12157    ///     This value is mandatory if OverVoltageMeanValue10min is set.
12158    #[serde(rename = "hv10MinMeanTripDelay")]
12159    #[serde(default, skip_serializing_if = "Option::is_none")]
12160    pub hv10_min_mean_trip_delay: Option<crate::types::Decimal>,
12161    /// The `powerDuringCessation` member.
12162    #[serde(rename = "powerDuringCessation")]
12163    #[serde(default, skip_serializing_if = "Option::is_none")]
12164    pub power_during_cessation: Option<PowerDuringCessation>,
12165    /// The `customData` member.
12166    #[serde(rename = "customData")]
12167    #[serde(default, skip_serializing_if = "Option::is_none")]
12168    pub custom_data: Option<crate::types::CustomData>,
12169}
12170
12171impl VoltageParams {
12172    /// Creates an empty `VoltageParams`. Every field of this type is optional.
12173    #[must_use]
12174    pub fn new() -> Self {
12175        Self::default()
12176    }
12177
12178    /// Sets the optional `hv10MinMeanValue` field.
12179    #[must_use]
12180    pub fn with_hv10_min_mean_value(mut self, value: impl Into<crate::types::Decimal>) -> Self {
12181        self.hv10_min_mean_value = Some(value.into());
12182        self
12183    }
12184
12185    /// Sets the optional `hv10MinMeanTripDelay` field.
12186    #[must_use]
12187    pub fn with_hv10_min_mean_trip_delay(
12188        mut self,
12189        value: impl Into<crate::types::Decimal>,
12190    ) -> Self {
12191        self.hv10_min_mean_trip_delay = Some(value.into());
12192        self
12193    }
12194
12195    /// Sets the optional `powerDuringCessation` field.
12196    #[must_use]
12197    pub fn with_power_during_cessation(mut self, value: PowerDuringCessation) -> Self {
12198        self.power_during_cessation = Some(value);
12199        self
12200    }
12201
12202    /// Sets the optional `customData` field.
12203    #[must_use]
12204    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12205        self.custom_data = Some(value);
12206        self
12207    }
12208}
12209
12210impl Validate for VoltageParams {
12211    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12212        path.push_key("powerDuringCessation");
12213        if let Some(value) = &self.power_during_cessation {
12214            Validate::validate_at(value, path, out);
12215        }
12216        path.pop();
12217        path.push_key("customData");
12218        if let Some(value) = &self.custom_data {
12219            Validate::validate_at(value, path, out);
12220        }
12221        path.pop();
12222    }
12223}