Skip to main content

ocpp_kit/v2_1/
types.rs

1// @generated by `cargo xtask codegen` from the vendored OCPP JSON schemas.
2// DO NOT EDIT — re-run the generator instead. CI fails if this file is stale.
3
4//! Data types shared between OCPP 2.1 messages, generated from the official JSON schemas.
5
6#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
7#![allow(
8    clippy::too_many_lines,
9    clippy::too_many_arguments,
10    clippy::wildcard_imports
11)]
12#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
13
14use alloc::string::String;
15use alloc::vec::Vec;
16
17use serde::{Deserialize, Serialize};
18
19use super::enums::*;
20use crate::validate::{self, Validate, ValidationPath, Violations};
21
22/// EV AC charging parameters for ISO 15118-2
23///
24/// The OCPP 2.1 `ACChargingParameters` data type.
25#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
26pub struct ACChargingParameters {
27    /// Amount of energy requested (in Wh). This includes energy required for preconditioning.
28    /// Relates to: +
29    /// *ISO 15118-2*: AC_EVChargeParameterType: EAmount +
30    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVTargetEnergyRequest
31    #[serde(rename = "energyAmount")]
32    pub energy_amount: crate::types::Decimal,
33    /// Minimum current (amps) supported by the electric vehicle (per phase).
34    /// Relates to: +
35    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMinCurrent
36    #[serde(rename = "evMinCurrent")]
37    pub ev_min_current: crate::types::Decimal,
38    /// Maximum current (amps) supported by the electric vehicle (per phase). Includes cable capacity.
39    /// Relates to: +
40    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMaxCurrent
41    #[serde(rename = "evMaxCurrent")]
42    pub ev_max_current: crate::types::Decimal,
43    /// Maximum voltage supported by the electric vehicle.
44    /// Relates to: +
45    /// *ISO 15118-2*: AC_EVChargeParameterType: EVMaxVoltage
46    #[serde(rename = "evMaxVoltage")]
47    pub ev_max_voltage: crate::types::Decimal,
48    /// The `customData` member.
49    #[serde(rename = "customData")]
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    pub custom_data: Option<crate::types::CustomData>,
52}
53
54impl ACChargingParameters {
55    /// Creates a `ACChargingParameters` from its required fields.
56    #[must_use]
57    pub fn new(
58        energy_amount: impl Into<crate::types::Decimal>,
59        ev_min_current: impl Into<crate::types::Decimal>,
60        ev_max_current: impl Into<crate::types::Decimal>,
61        ev_max_voltage: impl Into<crate::types::Decimal>,
62    ) -> Self {
63        Self {
64            energy_amount: energy_amount.into(),
65            ev_min_current: ev_min_current.into(),
66            ev_max_current: ev_max_current.into(),
67            ev_max_voltage: ev_max_voltage.into(),
68            custom_data: None,
69        }
70    }
71
72    /// Sets the optional `customData` field.
73    #[must_use]
74    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
75        self.custom_data = Some(value);
76        self
77    }
78}
79
80impl Validate for ACChargingParameters {
81    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
82        path.push_key("customData");
83        if let Some(value) = &self.custom_data {
84            Validate::validate_at(value, path, out);
85        }
86        path.pop();
87    }
88}
89
90/// Collection of configuration data needed to make a data-connection over a cellular network.
91///
92/// NOTE: When asking a GSM modem to dial in, it is possible to specify which mobile operator should be used. This can be done with the mobile country code (MCC) in combination with a mobile network code (MNC). Example: If your preferred network is Vodafone Netherlands, the MCC=204 and the MNC=04 which means the key PreferredNetwork = 20404 Some modems allows to specify a preferred network, which means, if this network is not available, a different network is used. If you specify UseOnlyPreferredNetwork and this network is not available, the modem will not dial in.
93///
94/// The OCPP 2.1 `APN` data type.
95#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
96pub struct APN {
97    /// The Access Point Name as an URL.
98    pub apn: String,
99    /// The `apnAuthentication` member.
100    #[serde(rename = "apnAuthentication")]
101    pub apn_authentication: APNAuthentication,
102    /// APN username.
103    #[serde(rename = "apnUserName")]
104    #[serde(default, skip_serializing_if = "Option::is_none")]
105    pub apn_user_name: Option<String>,
106    /// *(2.1)* APN Password.
107    #[serde(rename = "apnPassword")]
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub apn_password: Option<String>,
110    /// SIM card pin code.
111    #[serde(rename = "simPin")]
112    #[serde(default, skip_serializing_if = "Option::is_none")]
113    pub sim_pin: Option<i32>,
114    /// Preferred network, written as MCC and MNC concatenated. See note.
115    #[serde(rename = "preferredNetwork")]
116    #[serde(default, skip_serializing_if = "Option::is_none")]
117    pub preferred_network: Option<String>,
118    /// Default: false. Use only the preferred Network, do
119    /// not dial in when not available. See Note.
120    /// Schema default: `false`.
121    #[serde(rename = "useOnlyPreferredNetwork")]
122    #[serde(default, skip_serializing_if = "Option::is_none")]
123    pub use_only_preferred_network: Option<bool>,
124    /// The `customData` member.
125    #[serde(rename = "customData")]
126    #[serde(default, skip_serializing_if = "Option::is_none")]
127    pub custom_data: Option<crate::types::CustomData>,
128}
129
130impl APN {
131    /// Creates a `APN` from its required fields.
132    #[must_use]
133    pub fn new(apn: impl Into<String>, apn_authentication: APNAuthentication) -> Self {
134        Self {
135            apn: apn.into(),
136            apn_authentication,
137            apn_user_name: None,
138            apn_password: None,
139            sim_pin: None,
140            preferred_network: None,
141            use_only_preferred_network: None,
142            custom_data: None,
143        }
144    }
145
146    /// Sets the optional `apnUserName` field.
147    #[must_use]
148    pub fn with_apn_user_name(mut self, value: impl Into<String>) -> Self {
149        self.apn_user_name = Some(value.into());
150        self
151    }
152
153    /// Sets the optional `apnPassword` field.
154    #[must_use]
155    pub fn with_apn_password(mut self, value: impl Into<String>) -> Self {
156        self.apn_password = Some(value.into());
157        self
158    }
159
160    /// Sets the optional `simPin` field.
161    #[must_use]
162    pub fn with_sim_pin(mut self, value: i32) -> Self {
163        self.sim_pin = Some(value);
164        self
165    }
166
167    /// Sets the optional `preferredNetwork` field.
168    #[must_use]
169    pub fn with_preferred_network(mut self, value: impl Into<String>) -> Self {
170        self.preferred_network = Some(value.into());
171        self
172    }
173
174    /// Sets the optional `useOnlyPreferredNetwork` field.
175    #[must_use]
176    pub fn with_use_only_preferred_network(mut self, value: bool) -> Self {
177        self.use_only_preferred_network = Some(value);
178        self
179    }
180
181    /// Sets the optional `customData` field.
182    #[must_use]
183    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
184        self.custom_data = Some(value);
185        self
186    }
187}
188
189impl Validate for APN {
190    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
191        path.push_key("apn");
192        validate::string(self.apn.as_str(), None, Some(2000), path, out);
193        path.pop();
194        path.push_key("apnAuthentication");
195        Validate::validate_at(&self.apn_authentication, path, out);
196        path.pop();
197        path.push_key("apnUserName");
198        if let Some(value) = &self.apn_user_name {
199            validate::string(value.as_str(), None, Some(50), path, out);
200        }
201        path.pop();
202        path.push_key("apnPassword");
203        if let Some(value) = &self.apn_password {
204            validate::string(value.as_str(), None, Some(64), path, out);
205        }
206        path.pop();
207        path.push_key("preferredNetwork");
208        if let Some(value) = &self.preferred_network {
209            validate::string(value.as_str(), None, Some(6), path, out);
210        }
211        path.pop();
212        path.push_key("customData");
213        if let Some(value) = &self.custom_data {
214            Validate::validate_at(value, path, out);
215        }
216        path.pop();
217    }
218}
219
220/// The AbsolutePriceScheduleType is modeled after the same type that is defined in ISO 15118-20, such that if it is supplied by an EMSP as a signed EXI message, the conversion from EXI to JSON (in OCPP) and back to EXI (for ISO 15118-20) does not change the digest and therefore does not invalidate the signature.
221///
222/// image::images/AbsolutePriceSchedule-Simple.png\[\]
223///
224/// The OCPP 2.1 `AbsolutePriceSchedule` data type.
225#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
226pub struct AbsolutePriceSchedule {
227    /// Starting point of price schedule.
228    #[serde(rename = "timeAnchor")]
229    pub time_anchor: crate::types::DateTime,
230    /// Unique ID of price schedule
231    #[serde(rename = "priceScheduleID")]
232    pub price_schedule_id: i32,
233    /// Currency according to ISO 4217.
234    pub currency: String,
235    /// String that indicates what language is used for the human readable strings in the price schedule. Based on ISO 639.
236    pub language: String,
237    /// A string in URN notation which shall uniquely identify an algorithm that defines how to compute an energy fee sum for a specific power profile based on the EnergyFee information from the PriceRule elements.
238    #[serde(rename = "priceAlgorithm")]
239    pub price_algorithm: String,
240    /// The `priceRuleStacks` member.
241    #[serde(rename = "priceRuleStacks")]
242    pub price_rule_stacks: Vec<PriceRuleStack>,
243    /// Description of the price schedule.
244    #[serde(rename = "priceScheduleDescription")]
245    #[serde(default, skip_serializing_if = "Option::is_none")]
246    pub price_schedule_description: Option<String>,
247    /// The `minimumCost` member.
248    #[serde(rename = "minimumCost")]
249    #[serde(default, skip_serializing_if = "Option::is_none")]
250    pub minimum_cost: Option<RationalNumber>,
251    /// The `maximumCost` member.
252    #[serde(rename = "maximumCost")]
253    #[serde(default, skip_serializing_if = "Option::is_none")]
254    pub maximum_cost: Option<RationalNumber>,
255    /// The `taxRules` member.
256    #[serde(rename = "taxRules")]
257    #[serde(default, skip_serializing_if = "Option::is_none")]
258    pub tax_rules: Option<Vec<TaxRule>>,
259    /// The `overstayRuleList` member.
260    #[serde(rename = "overstayRuleList")]
261    #[serde(default, skip_serializing_if = "Option::is_none")]
262    pub overstay_rule_list: Option<OverstayRuleList>,
263    /// The `additionalSelectedServices` member.
264    #[serde(rename = "additionalSelectedServices")]
265    #[serde(default, skip_serializing_if = "Option::is_none")]
266    pub additional_selected_services: Option<Vec<AdditionalSelectedServices>>,
267    /// The `customData` member.
268    #[serde(rename = "customData")]
269    #[serde(default, skip_serializing_if = "Option::is_none")]
270    pub custom_data: Option<crate::types::CustomData>,
271}
272
273impl AbsolutePriceSchedule {
274    /// Creates a `AbsolutePriceSchedule` from its required fields.
275    #[must_use]
276    pub fn new(
277        time_anchor: impl Into<crate::types::DateTime>,
278        price_schedule_id: i32,
279        currency: impl Into<String>,
280        language: impl Into<String>,
281        price_algorithm: impl Into<String>,
282        price_rule_stacks: Vec<PriceRuleStack>,
283    ) -> Self {
284        Self {
285            time_anchor: time_anchor.into(),
286            price_schedule_id,
287            currency: currency.into(),
288            language: language.into(),
289            price_algorithm: price_algorithm.into(),
290            price_rule_stacks,
291            price_schedule_description: None,
292            minimum_cost: None,
293            maximum_cost: None,
294            tax_rules: None,
295            overstay_rule_list: None,
296            additional_selected_services: None,
297            custom_data: None,
298        }
299    }
300
301    /// Sets the optional `priceScheduleDescription` field.
302    #[must_use]
303    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
304        self.price_schedule_description = Some(value.into());
305        self
306    }
307
308    /// Sets the optional `minimumCost` field.
309    #[must_use]
310    pub fn with_minimum_cost(mut self, value: RationalNumber) -> Self {
311        self.minimum_cost = Some(value);
312        self
313    }
314
315    /// Sets the optional `maximumCost` field.
316    #[must_use]
317    pub fn with_maximum_cost(mut self, value: RationalNumber) -> Self {
318        self.maximum_cost = Some(value);
319        self
320    }
321
322    /// Sets the optional `taxRules` field.
323    #[must_use]
324    pub fn with_tax_rules(mut self, value: Vec<TaxRule>) -> Self {
325        self.tax_rules = Some(value);
326        self
327    }
328
329    /// Sets the optional `overstayRuleList` field.
330    #[must_use]
331    pub fn with_overstay_rule_list(mut self, value: OverstayRuleList) -> Self {
332        self.overstay_rule_list = Some(value);
333        self
334    }
335
336    /// Sets the optional `additionalSelectedServices` field.
337    #[must_use]
338    pub fn with_additional_selected_services(
339        mut self,
340        value: Vec<AdditionalSelectedServices>,
341    ) -> Self {
342        self.additional_selected_services = Some(value);
343        self
344    }
345
346    /// Sets the optional `customData` field.
347    #[must_use]
348    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
349        self.custom_data = Some(value);
350        self
351    }
352}
353
354impl Validate for AbsolutePriceSchedule {
355    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
356        path.push_key("priceScheduleID");
357        validate::int_range(i64::from(self.price_schedule_id), Some(0), None, path, out);
358        path.pop();
359        path.push_key("currency");
360        validate::string(self.currency.as_str(), None, Some(3), path, out);
361        path.pop();
362        path.push_key("language");
363        validate::string(self.language.as_str(), None, Some(8), path, out);
364        path.pop();
365        path.push_key("priceAlgorithm");
366        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
367        path.pop();
368        path.push_key("priceRuleStacks");
369        validate::list_len(self.price_rule_stacks.len(), Some(1), Some(1024), path, out);
370        for (index, item) in self.price_rule_stacks.iter().enumerate() {
371            path.push_index(index);
372            Validate::validate_at(item, path, out);
373            path.pop();
374        }
375        path.pop();
376        path.push_key("priceScheduleDescription");
377        if let Some(value) = &self.price_schedule_description {
378            validate::string(value.as_str(), None, Some(160), path, out);
379        }
380        path.pop();
381        path.push_key("minimumCost");
382        if let Some(value) = &self.minimum_cost {
383            Validate::validate_at(value, path, out);
384        }
385        path.pop();
386        path.push_key("maximumCost");
387        if let Some(value) = &self.maximum_cost {
388            Validate::validate_at(value, path, out);
389        }
390        path.pop();
391        path.push_key("taxRules");
392        if let Some(value) = &self.tax_rules {
393            validate::list_len(value.len(), Some(1), Some(10), path, out);
394            for (index, item) in value.iter().enumerate() {
395                path.push_index(index);
396                Validate::validate_at(item, path, out);
397                path.pop();
398            }
399        }
400        path.pop();
401        path.push_key("overstayRuleList");
402        if let Some(value) = &self.overstay_rule_list {
403            Validate::validate_at(value, path, out);
404        }
405        path.pop();
406        path.push_key("additionalSelectedServices");
407        if let Some(value) = &self.additional_selected_services {
408            validate::list_len(value.len(), Some(1), Some(5), path, out);
409            for (index, item) in value.iter().enumerate() {
410                path.push_index(index);
411                Validate::validate_at(item, path, out);
412                path.pop();
413            }
414        }
415        path.pop();
416        path.push_key("customData");
417        if let Some(value) = &self.custom_data {
418            Validate::validate_at(value, path, out);
419        }
420        path.pop();
421    }
422}
423
424/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
425///
426/// The OCPP 2.1 `AdditionalInfo` data type.
427#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
428pub struct AdditionalInfo {
429    /// *(2.1)* This field specifies the additional IdToken.
430    #[serde(rename = "additionalIdToken")]
431    pub additional_id_token: String,
432    /// _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_.
433    pub r#type: String,
434    /// The `customData` member.
435    #[serde(rename = "customData")]
436    #[serde(default, skip_serializing_if = "Option::is_none")]
437    pub custom_data: Option<crate::types::CustomData>,
438}
439
440impl AdditionalInfo {
441    /// Creates a `AdditionalInfo` from its required fields.
442    #[must_use]
443    pub fn new(additional_id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
444        Self {
445            additional_id_token: additional_id_token.into(),
446            r#type: r#type.into(),
447            custom_data: None,
448        }
449    }
450
451    /// Sets the optional `customData` field.
452    #[must_use]
453    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
454        self.custom_data = Some(value);
455        self
456    }
457}
458
459impl Validate for AdditionalInfo {
460    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
461        path.push_key("additionalIdToken");
462        validate::string(
463            self.additional_id_token.as_str(),
464            None,
465            Some(255),
466            path,
467            out,
468        );
469        path.pop();
470        path.push_key("type");
471        validate::string(self.r#type.as_str(), None, Some(50), path, out);
472        path.pop();
473        path.push_key("customData");
474        if let Some(value) = &self.custom_data {
475            Validate::validate_at(value, path, out);
476        }
477        path.pop();
478    }
479}
480
481/// Part of ISO 15118-20 price schedule.
482///
483/// The OCPP 2.1 `AdditionalSelectedServices` data type.
484#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
485pub struct AdditionalSelectedServices {
486    /// The `serviceFee` member.
487    #[serde(rename = "serviceFee")]
488    pub service_fee: RationalNumber,
489    /// Human readable string to identify this service.
490    #[serde(rename = "serviceName")]
491    pub service_name: String,
492    /// The `customData` member.
493    #[serde(rename = "customData")]
494    #[serde(default, skip_serializing_if = "Option::is_none")]
495    pub custom_data: Option<crate::types::CustomData>,
496}
497
498impl AdditionalSelectedServices {
499    /// Creates a `AdditionalSelectedServices` from its required fields.
500    #[must_use]
501    pub fn new(service_fee: RationalNumber, service_name: impl Into<String>) -> Self {
502        Self {
503            service_fee,
504            service_name: service_name.into(),
505            custom_data: None,
506        }
507    }
508
509    /// Sets the optional `customData` field.
510    #[must_use]
511    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
512        self.custom_data = Some(value);
513        self
514    }
515}
516
517impl Validate for AdditionalSelectedServices {
518    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
519        path.push_key("serviceFee");
520        Validate::validate_at(&self.service_fee, path, out);
521        path.pop();
522        path.push_key("serviceName");
523        validate::string(self.service_name.as_str(), None, Some(80), path, out);
524        path.pop();
525        path.push_key("customData");
526        if let Some(value) = &self.custom_data {
527            Validate::validate_at(value, path, out);
528        }
529        path.pop();
530    }
531}
532
533/// *(2.1)* A generic address format.
534///
535/// The OCPP 2.1 `Address` data type.
536#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
537pub struct Address {
538    /// Name of person/company
539    pub name: String,
540    /// Address line 1
541    pub address1: String,
542    /// City
543    pub city: String,
544    /// Country name
545    pub country: String,
546    /// Address line 2
547    #[serde(default, skip_serializing_if = "Option::is_none")]
548    pub address2: Option<String>,
549    /// Postal code
550    #[serde(rename = "postalCode")]
551    #[serde(default, skip_serializing_if = "Option::is_none")]
552    pub postal_code: Option<String>,
553    /// The `customData` member.
554    #[serde(rename = "customData")]
555    #[serde(default, skip_serializing_if = "Option::is_none")]
556    pub custom_data: Option<crate::types::CustomData>,
557}
558
559impl Address {
560    /// Creates a `Address` from its required fields.
561    #[must_use]
562    pub fn new(
563        name: impl Into<String>,
564        address1: impl Into<String>,
565        city: impl Into<String>,
566        country: impl Into<String>,
567    ) -> Self {
568        Self {
569            name: name.into(),
570            address1: address1.into(),
571            city: city.into(),
572            country: country.into(),
573            address2: None,
574            postal_code: None,
575            custom_data: None,
576        }
577    }
578
579    /// Sets the optional `address2` field.
580    #[must_use]
581    pub fn with_address2(mut self, value: impl Into<String>) -> Self {
582        self.address2 = Some(value.into());
583        self
584    }
585
586    /// Sets the optional `postalCode` field.
587    #[must_use]
588    pub fn with_postal_code(mut self, value: impl Into<String>) -> Self {
589        self.postal_code = Some(value.into());
590        self
591    }
592
593    /// Sets the optional `customData` field.
594    #[must_use]
595    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
596        self.custom_data = Some(value);
597        self
598    }
599}
600
601impl Validate for Address {
602    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
603        path.push_key("name");
604        validate::string(self.name.as_str(), None, Some(50), path, out);
605        path.pop();
606        path.push_key("address1");
607        validate::string(self.address1.as_str(), None, Some(100), path, out);
608        path.pop();
609        path.push_key("city");
610        validate::string(self.city.as_str(), None, Some(100), path, out);
611        path.pop();
612        path.push_key("country");
613        validate::string(self.country.as_str(), None, Some(50), path, out);
614        path.pop();
615        path.push_key("address2");
616        if let Some(value) = &self.address2 {
617            validate::string(value.as_str(), None, Some(100), path, out);
618        }
619        path.pop();
620        path.push_key("postalCode");
621        if let Some(value) = &self.postal_code {
622            validate::string(value.as_str(), None, Some(20), path, out);
623        }
624        path.pop();
625        path.push_key("customData");
626        if let Some(value) = &self.custom_data {
627            Validate::validate_at(value, path, out);
628        }
629        path.pop();
630    }
631}
632
633/// Contains the identifier to use for authorization.
634///
635/// The OCPP 2.1 `AuthorizationData` data type.
636#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
637pub struct AuthorizationData {
638    /// The `idToken` member.
639    #[serde(rename = "idToken")]
640    pub id_token: IdToken,
641    /// The `idTokenInfo` member.
642    #[serde(rename = "idTokenInfo")]
643    #[serde(default, skip_serializing_if = "Option::is_none")]
644    pub id_token_info: Option<IdTokenInfo>,
645    /// The `customData` member.
646    #[serde(rename = "customData")]
647    #[serde(default, skip_serializing_if = "Option::is_none")]
648    pub custom_data: Option<crate::types::CustomData>,
649}
650
651impl AuthorizationData {
652    /// Creates a `AuthorizationData` from its required fields.
653    #[must_use]
654    pub fn new(id_token: IdToken) -> Self {
655        Self {
656            id_token,
657            id_token_info: None,
658            custom_data: None,
659        }
660    }
661
662    /// Sets the optional `idTokenInfo` field.
663    #[must_use]
664    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
665        self.id_token_info = Some(value);
666        self
667    }
668
669    /// Sets the optional `customData` field.
670    #[must_use]
671    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
672        self.custom_data = Some(value);
673        self
674    }
675}
676
677impl Validate for AuthorizationData {
678    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
679        path.push_key("idToken");
680        Validate::validate_at(&self.id_token, path, out);
681        path.pop();
682        path.push_key("idTokenInfo");
683        if let Some(value) = &self.id_token_info {
684            Validate::validate_at(value, path, out);
685        }
686        path.pop();
687        path.push_key("customData");
688        if let Some(value) = &self.custom_data {
689            Validate::validate_at(value, path, out);
690        }
691        path.pop();
692    }
693}
694
695/// The OCPP 2.1 `BatteryData` data type.
696#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
697pub struct BatteryData {
698    /// Slot number where battery is inserted or removed.
699    #[serde(rename = "evseId")]
700    pub evse_id: i32,
701    /// Serial number of battery.
702    #[serde(rename = "serialNumber")]
703    pub serial_number: String,
704    /// State of charge
705    #[serde(rename = "soC")]
706    pub so_c: crate::types::Decimal,
707    /// State of health
708    #[serde(rename = "soH")]
709    pub so_h: crate::types::Decimal,
710    /// Production date of battery.
711    #[serde(rename = "productionDate")]
712    #[serde(default, skip_serializing_if = "Option::is_none")]
713    pub production_date: Option<crate::types::DateTime>,
714    /// Vendor-specific info from battery in undefined format.
715    #[serde(rename = "vendorInfo")]
716    #[serde(default, skip_serializing_if = "Option::is_none")]
717    pub vendor_info: Option<String>,
718    /// The `customData` member.
719    #[serde(rename = "customData")]
720    #[serde(default, skip_serializing_if = "Option::is_none")]
721    pub custom_data: Option<crate::types::CustomData>,
722}
723
724impl BatteryData {
725    /// Creates a `BatteryData` from its required fields.
726    #[must_use]
727    pub fn new(
728        evse_id: i32,
729        serial_number: impl Into<String>,
730        so_c: impl Into<crate::types::Decimal>,
731        so_h: impl Into<crate::types::Decimal>,
732    ) -> Self {
733        Self {
734            evse_id,
735            serial_number: serial_number.into(),
736            so_c: so_c.into(),
737            so_h: so_h.into(),
738            production_date: None,
739            vendor_info: None,
740            custom_data: None,
741        }
742    }
743
744    /// Sets the optional `productionDate` field.
745    #[must_use]
746    pub fn with_production_date(mut self, value: impl Into<crate::types::DateTime>) -> Self {
747        self.production_date = Some(value.into());
748        self
749    }
750
751    /// Sets the optional `vendorInfo` field.
752    #[must_use]
753    pub fn with_vendor_info(mut self, value: impl Into<String>) -> Self {
754        self.vendor_info = Some(value.into());
755        self
756    }
757
758    /// Sets the optional `customData` field.
759    #[must_use]
760    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
761        self.custom_data = Some(value);
762        self
763    }
764}
765
766impl Validate for BatteryData {
767    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
768        path.push_key("evseId");
769        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
770        path.pop();
771        path.push_key("serialNumber");
772        validate::string(self.serial_number.as_str(), None, Some(50), path, out);
773        path.pop();
774        path.push_key("soC");
775        validate::range(
776            self.so_c,
777            Some(crate::types::Decimal::new(0, 0)),
778            Some(crate::types::Decimal::new(100, 0)),
779            path,
780            out,
781        );
782        path.pop();
783        path.push_key("soH");
784        validate::range(
785            self.so_h,
786            Some(crate::types::Decimal::new(0, 0)),
787            Some(crate::types::Decimal::new(100, 0)),
788            path,
789            out,
790        );
791        path.pop();
792        path.push_key("vendorInfo");
793        if let Some(value) = &self.vendor_info {
794            validate::string(value.as_str(), None, Some(500), path, out);
795        }
796        path.pop();
797        path.push_key("customData");
798        if let Some(value) = &self.custom_data {
799            Validate::validate_at(value, path, out);
800        }
801        path.pop();
802    }
803}
804
805/// The OCPP 2.1 `CertificateHashData` data type.
806#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
807pub struct CertificateHashData {
808    /// The `hashAlgorithm` member.
809    #[serde(rename = "hashAlgorithm")]
810    pub hash_algorithm: HashAlgorithm,
811    /// The hash of the issuer’s distinguished
812    /// name (DN), that must be calculated over the DER
813    /// encoding of the issuer’s name field in the certificate
814    /// being checked.
815    #[serde(rename = "issuerNameHash")]
816    pub issuer_name_hash: String,
817    /// The hash of the DER encoded public key:
818    /// the value (excluding tag and length) of the subject
819    /// public key field in the issuer’s certificate.
820    #[serde(rename = "issuerKeyHash")]
821    pub issuer_key_hash: String,
822    /// The string representation of the
823    /// hexadecimal value of the serial number without the
824    /// prefix "0x" and without leading zeroes.
825    #[serde(rename = "serialNumber")]
826    pub serial_number: String,
827    /// The `customData` member.
828    #[serde(rename = "customData")]
829    #[serde(default, skip_serializing_if = "Option::is_none")]
830    pub custom_data: Option<crate::types::CustomData>,
831}
832
833impl CertificateHashData {
834    /// Creates a `CertificateHashData` from its required fields.
835    #[must_use]
836    pub fn new(
837        hash_algorithm: HashAlgorithm,
838        issuer_name_hash: impl Into<String>,
839        issuer_key_hash: impl Into<String>,
840        serial_number: impl Into<String>,
841    ) -> Self {
842        Self {
843            hash_algorithm,
844            issuer_name_hash: issuer_name_hash.into(),
845            issuer_key_hash: issuer_key_hash.into(),
846            serial_number: serial_number.into(),
847            custom_data: None,
848        }
849    }
850
851    /// Sets the optional `customData` field.
852    #[must_use]
853    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
854        self.custom_data = Some(value);
855        self
856    }
857}
858
859impl Validate for CertificateHashData {
860    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
861        path.push_key("hashAlgorithm");
862        Validate::validate_at(&self.hash_algorithm, path, out);
863        path.pop();
864        path.push_key("issuerNameHash");
865        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
866        path.pop();
867        path.push_key("issuerKeyHash");
868        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
869        path.pop();
870        path.push_key("serialNumber");
871        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
872        path.pop();
873        path.push_key("customData");
874        if let Some(value) = &self.custom_data {
875            Validate::validate_at(value, path, out);
876        }
877        path.pop();
878    }
879}
880
881/// The OCPP 2.1 `CertificateHashDataChain` data type.
882#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
883pub struct CertificateHashDataChain {
884    /// The `certificateHashData` member.
885    #[serde(rename = "certificateHashData")]
886    pub certificate_hash_data: CertificateHashData,
887    /// The `certificateType` member.
888    #[serde(rename = "certificateType")]
889    pub certificate_type: GetCertificateIdUse,
890    /// The `childCertificateHashData` member.
891    #[serde(rename = "childCertificateHashData")]
892    #[serde(default, skip_serializing_if = "Option::is_none")]
893    pub child_certificate_hash_data: Option<Vec<CertificateHashData>>,
894    /// The `customData` member.
895    #[serde(rename = "customData")]
896    #[serde(default, skip_serializing_if = "Option::is_none")]
897    pub custom_data: Option<crate::types::CustomData>,
898}
899
900impl CertificateHashDataChain {
901    /// Creates a `CertificateHashDataChain` from its required fields.
902    #[must_use]
903    pub fn new(
904        certificate_hash_data: CertificateHashData,
905        certificate_type: GetCertificateIdUse,
906    ) -> Self {
907        Self {
908            certificate_hash_data,
909            certificate_type,
910            child_certificate_hash_data: None,
911            custom_data: None,
912        }
913    }
914
915    /// Sets the optional `childCertificateHashData` field.
916    #[must_use]
917    pub fn with_child_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
918        self.child_certificate_hash_data = Some(value);
919        self
920    }
921
922    /// Sets the optional `customData` field.
923    #[must_use]
924    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
925        self.custom_data = Some(value);
926        self
927    }
928}
929
930impl Validate for CertificateHashDataChain {
931    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
932        path.push_key("certificateHashData");
933        Validate::validate_at(&self.certificate_hash_data, path, out);
934        path.pop();
935        path.push_key("certificateType");
936        Validate::validate_at(&self.certificate_type, path, out);
937        path.pop();
938        path.push_key("childCertificateHashData");
939        if let Some(value) = &self.child_certificate_hash_data {
940            validate::list_len(value.len(), Some(1), Some(4), path, out);
941            for (index, item) in value.iter().enumerate() {
942                path.push_index(index);
943                Validate::validate_at(item, path, out);
944                path.pop();
945            }
946        }
947        path.pop();
948        path.push_key("customData");
949        if let Some(value) = &self.custom_data {
950            Validate::validate_at(value, path, out);
951        }
952        path.pop();
953    }
954}
955
956/// Revocation status of certificate
957///
958/// The OCPP 2.1 `CertificateStatus` data type.
959#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
960pub struct CertificateStatus {
961    /// The `certificateHashData` member.
962    #[serde(rename = "certificateHashData")]
963    pub certificate_hash_data: CertificateHashData,
964    /// The `source` member.
965    pub source: CertificateStatusSource,
966    /// The `status` member.
967    pub status: CertificateStatusEnum,
968    /// The `nextUpdate` member.
969    #[serde(rename = "nextUpdate")]
970    pub next_update: crate::types::DateTime,
971    /// The `customData` member.
972    #[serde(rename = "customData")]
973    #[serde(default, skip_serializing_if = "Option::is_none")]
974    pub custom_data: Option<crate::types::CustomData>,
975}
976
977impl CertificateStatus {
978    /// Creates a `CertificateStatus` from its required fields.
979    #[must_use]
980    pub fn new(
981        certificate_hash_data: CertificateHashData,
982        source: CertificateStatusSource,
983        status: CertificateStatusEnum,
984        next_update: impl Into<crate::types::DateTime>,
985    ) -> Self {
986        Self {
987            certificate_hash_data,
988            source,
989            status,
990            next_update: next_update.into(),
991            custom_data: None,
992        }
993    }
994
995    /// Sets the optional `customData` field.
996    #[must_use]
997    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
998        self.custom_data = Some(value);
999        self
1000    }
1001}
1002
1003impl Validate for CertificateStatus {
1004    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1005        path.push_key("certificateHashData");
1006        Validate::validate_at(&self.certificate_hash_data, path, out);
1007        path.pop();
1008        path.push_key("source");
1009        Validate::validate_at(&self.source, path, out);
1010        path.pop();
1011        path.push_key("status");
1012        Validate::validate_at(&self.status, path, out);
1013        path.pop();
1014        path.push_key("customData");
1015        if let Some(value) = &self.custom_data {
1016            Validate::validate_at(value, path, out);
1017        }
1018        path.pop();
1019    }
1020}
1021
1022/// Data necessary to request the revocation status of a certificate.
1023///
1024/// The OCPP 2.1 `CertificateStatusRequestInfo` data type.
1025#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1026pub struct CertificateStatusRequestInfo {
1027    /// The `certificateHashData` member.
1028    #[serde(rename = "certificateHashData")]
1029    pub certificate_hash_data: CertificateHashData,
1030    /// The `source` member.
1031    pub source: CertificateStatusSource,
1032    /// URL(s) of _source_.
1033    pub urls: Vec<String>,
1034    /// The `customData` member.
1035    #[serde(rename = "customData")]
1036    #[serde(default, skip_serializing_if = "Option::is_none")]
1037    pub custom_data: Option<crate::types::CustomData>,
1038}
1039
1040impl CertificateStatusRequestInfo {
1041    /// Creates a `CertificateStatusRequestInfo` from its required fields.
1042    #[must_use]
1043    pub fn new(
1044        certificate_hash_data: CertificateHashData,
1045        source: CertificateStatusSource,
1046        urls: impl IntoIterator<Item = impl Into<String>>,
1047    ) -> Self {
1048        Self {
1049            certificate_hash_data,
1050            source,
1051            urls: urls.into_iter().map(Into::into).collect(),
1052            custom_data: None,
1053        }
1054    }
1055
1056    /// Sets the optional `customData` field.
1057    #[must_use]
1058    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1059        self.custom_data = Some(value);
1060        self
1061    }
1062}
1063
1064impl Validate for CertificateStatusRequestInfo {
1065    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1066        path.push_key("certificateHashData");
1067        Validate::validate_at(&self.certificate_hash_data, path, out);
1068        path.pop();
1069        path.push_key("source");
1070        Validate::validate_at(&self.source, path, out);
1071        path.pop();
1072        path.push_key("urls");
1073        validate::list_len(self.urls.len(), Some(1), Some(5), path, out);
1074        for (index, item) in self.urls.iter().enumerate() {
1075            path.push_index(index);
1076            validate::string(item.as_str(), None, Some(2000), path, out);
1077            path.pop();
1078        }
1079        path.pop();
1080        path.push_key("customData");
1081        if let Some(value) = &self.custom_data {
1082            Validate::validate_at(value, path, out);
1083        }
1084        path.pop();
1085    }
1086}
1087
1088/// The OCPP 2.1 `ChargingLimit` data type.
1089#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1090pub struct ChargingLimit {
1091    /// Represents the source of the charging limit. Values defined in appendix as ChargingLimitSourceEnumStringType.
1092    #[serde(rename = "chargingLimitSource")]
1093    pub charging_limit_source: String,
1094    /// *(2.1)* True when the reported limit concerns local generation that is providing extra capacity, instead of a limitation.
1095    #[serde(rename = "isLocalGeneration")]
1096    #[serde(default, skip_serializing_if = "Option::is_none")]
1097    pub is_local_generation: Option<bool>,
1098    /// Indicates whether the charging limit is critical for the grid.
1099    #[serde(rename = "isGridCritical")]
1100    #[serde(default, skip_serializing_if = "Option::is_none")]
1101    pub is_grid_critical: Option<bool>,
1102    /// The `customData` member.
1103    #[serde(rename = "customData")]
1104    #[serde(default, skip_serializing_if = "Option::is_none")]
1105    pub custom_data: Option<crate::types::CustomData>,
1106}
1107
1108impl ChargingLimit {
1109    /// Creates a `ChargingLimit` from its required fields.
1110    #[must_use]
1111    pub fn new(charging_limit_source: impl Into<String>) -> Self {
1112        Self {
1113            charging_limit_source: charging_limit_source.into(),
1114            is_local_generation: None,
1115            is_grid_critical: None,
1116            custom_data: None,
1117        }
1118    }
1119
1120    /// Sets the optional `isLocalGeneration` field.
1121    #[must_use]
1122    pub fn with_is_local_generation(mut self, value: bool) -> Self {
1123        self.is_local_generation = Some(value);
1124        self
1125    }
1126
1127    /// Sets the optional `isGridCritical` field.
1128    #[must_use]
1129    pub fn with_is_grid_critical(mut self, value: bool) -> Self {
1130        self.is_grid_critical = Some(value);
1131        self
1132    }
1133
1134    /// Sets the optional `customData` field.
1135    #[must_use]
1136    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1137        self.custom_data = Some(value);
1138        self
1139    }
1140}
1141
1142impl Validate for ChargingLimit {
1143    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1144        path.push_key("chargingLimitSource");
1145        validate::string(
1146            self.charging_limit_source.as_str(),
1147            None,
1148            Some(20),
1149            path,
1150            out,
1151        );
1152        path.pop();
1153        path.push_key("customData");
1154        if let Some(value) = &self.custom_data {
1155            Validate::validate_at(value, path, out);
1156        }
1157        path.pop();
1158    }
1159}
1160
1161/// The OCPP 2.1 `ChargingNeeds` data type.
1162#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1163pub struct ChargingNeeds {
1164    /// The `requestedEnergyTransfer` member.
1165    #[serde(rename = "requestedEnergyTransfer")]
1166    pub requested_energy_transfer: EnergyTransferMode,
1167    /// The `acChargingParameters` member.
1168    #[serde(rename = "acChargingParameters")]
1169    #[serde(default, skip_serializing_if = "Option::is_none")]
1170    pub ac_charging_parameters: Option<ACChargingParameters>,
1171    /// The `derChargingParameters` member.
1172    #[serde(rename = "derChargingParameters")]
1173    #[serde(default, skip_serializing_if = "Option::is_none")]
1174    pub der_charging_parameters: Option<DERChargingParameters>,
1175    /// The `evEnergyOffer` member.
1176    #[serde(rename = "evEnergyOffer")]
1177    #[serde(default, skip_serializing_if = "Option::is_none")]
1178    pub ev_energy_offer: Option<EVEnergyOffer>,
1179    /// The `dcChargingParameters` member.
1180    #[serde(rename = "dcChargingParameters")]
1181    #[serde(default, skip_serializing_if = "Option::is_none")]
1182    pub dc_charging_parameters: Option<DCChargingParameters>,
1183    /// The `v2xChargingParameters` member.
1184    #[serde(rename = "v2xChargingParameters")]
1185    #[serde(default, skip_serializing_if = "Option::is_none")]
1186    pub v2x_charging_parameters: Option<V2XChargingParameters>,
1187    /// *(2.1)* Modes of energy transfer that are marked as available by EV.
1188    #[serde(rename = "availableEnergyTransfer")]
1189    #[serde(default, skip_serializing_if = "Option::is_none")]
1190    pub available_energy_transfer: Option<Vec<EnergyTransferMode>>,
1191    /// The `controlMode` member.
1192    #[serde(rename = "controlMode")]
1193    #[serde(default, skip_serializing_if = "Option::is_none")]
1194    pub control_mode: Option<ControlMode>,
1195    /// The `mobilityNeedsMode` member.
1196    #[serde(rename = "mobilityNeedsMode")]
1197    #[serde(default, skip_serializing_if = "Option::is_none")]
1198    pub mobility_needs_mode: Option<MobilityNeedsMode>,
1199    /// Estimated departure time of the EV. +
1200    /// *ISO 15118-2:* AC/DC_EVChargeParameterType: DepartureTime +
1201    /// *ISO 15118-20:* Dynamic/Scheduled_SEReqControlModeType: DepartureTIme
1202    #[serde(rename = "departureTime")]
1203    #[serde(default, skip_serializing_if = "Option::is_none")]
1204    pub departure_time: Option<crate::types::DateTime>,
1205    /// The `customData` member.
1206    #[serde(rename = "customData")]
1207    #[serde(default, skip_serializing_if = "Option::is_none")]
1208    pub custom_data: Option<crate::types::CustomData>,
1209}
1210
1211impl ChargingNeeds {
1212    /// Creates a `ChargingNeeds` from its required fields.
1213    #[must_use]
1214    pub fn new(requested_energy_transfer: EnergyTransferMode) -> Self {
1215        Self {
1216            requested_energy_transfer,
1217            ac_charging_parameters: None,
1218            der_charging_parameters: None,
1219            ev_energy_offer: None,
1220            dc_charging_parameters: None,
1221            v2x_charging_parameters: None,
1222            available_energy_transfer: None,
1223            control_mode: None,
1224            mobility_needs_mode: None,
1225            departure_time: None,
1226            custom_data: None,
1227        }
1228    }
1229
1230    /// Sets the optional `acChargingParameters` field.
1231    #[must_use]
1232    pub fn with_ac_charging_parameters(mut self, value: ACChargingParameters) -> Self {
1233        self.ac_charging_parameters = Some(value);
1234        self
1235    }
1236
1237    /// Sets the optional `derChargingParameters` field.
1238    #[must_use]
1239    pub fn with_der_charging_parameters(mut self, value: DERChargingParameters) -> Self {
1240        self.der_charging_parameters = Some(value);
1241        self
1242    }
1243
1244    /// Sets the optional `evEnergyOffer` field.
1245    #[must_use]
1246    pub fn with_ev_energy_offer(mut self, value: EVEnergyOffer) -> Self {
1247        self.ev_energy_offer = Some(value);
1248        self
1249    }
1250
1251    /// Sets the optional `dcChargingParameters` field.
1252    #[must_use]
1253    pub fn with_dc_charging_parameters(mut self, value: DCChargingParameters) -> Self {
1254        self.dc_charging_parameters = Some(value);
1255        self
1256    }
1257
1258    /// Sets the optional `v2xChargingParameters` field.
1259    #[must_use]
1260    pub fn with_v2x_charging_parameters(mut self, value: V2XChargingParameters) -> Self {
1261        self.v2x_charging_parameters = Some(value);
1262        self
1263    }
1264
1265    /// Sets the optional `availableEnergyTransfer` field.
1266    #[must_use]
1267    pub fn with_available_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
1268        self.available_energy_transfer = Some(value);
1269        self
1270    }
1271
1272    /// Sets the optional `controlMode` field.
1273    #[must_use]
1274    pub fn with_control_mode(mut self, value: ControlMode) -> Self {
1275        self.control_mode = Some(value);
1276        self
1277    }
1278
1279    /// Sets the optional `mobilityNeedsMode` field.
1280    #[must_use]
1281    pub fn with_mobility_needs_mode(mut self, value: MobilityNeedsMode) -> Self {
1282        self.mobility_needs_mode = Some(value);
1283        self
1284    }
1285
1286    /// Sets the optional `departureTime` field.
1287    #[must_use]
1288    pub fn with_departure_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1289        self.departure_time = Some(value.into());
1290        self
1291    }
1292
1293    /// Sets the optional `customData` field.
1294    #[must_use]
1295    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1296        self.custom_data = Some(value);
1297        self
1298    }
1299}
1300
1301impl Validate for ChargingNeeds {
1302    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1303        path.push_key("requestedEnergyTransfer");
1304        Validate::validate_at(&self.requested_energy_transfer, path, out);
1305        path.pop();
1306        path.push_key("acChargingParameters");
1307        if let Some(value) = &self.ac_charging_parameters {
1308            Validate::validate_at(value, path, out);
1309        }
1310        path.pop();
1311        path.push_key("derChargingParameters");
1312        if let Some(value) = &self.der_charging_parameters {
1313            Validate::validate_at(value, path, out);
1314        }
1315        path.pop();
1316        path.push_key("evEnergyOffer");
1317        if let Some(value) = &self.ev_energy_offer {
1318            Validate::validate_at(value, path, out);
1319        }
1320        path.pop();
1321        path.push_key("dcChargingParameters");
1322        if let Some(value) = &self.dc_charging_parameters {
1323            Validate::validate_at(value, path, out);
1324        }
1325        path.pop();
1326        path.push_key("v2xChargingParameters");
1327        if let Some(value) = &self.v2x_charging_parameters {
1328            Validate::validate_at(value, path, out);
1329        }
1330        path.pop();
1331        path.push_key("availableEnergyTransfer");
1332        if let Some(value) = &self.available_energy_transfer {
1333            validate::list_len(value.len(), Some(1), None, path, out);
1334            for (index, item) in value.iter().enumerate() {
1335                path.push_index(index);
1336                Validate::validate_at(item, path, out);
1337                path.pop();
1338            }
1339        }
1340        path.pop();
1341        path.push_key("controlMode");
1342        if let Some(value) = &self.control_mode {
1343            Validate::validate_at(value, path, out);
1344        }
1345        path.pop();
1346        path.push_key("mobilityNeedsMode");
1347        if let Some(value) = &self.mobility_needs_mode {
1348            Validate::validate_at(value, path, out);
1349        }
1350        path.pop();
1351        path.push_key("customData");
1352        if let Some(value) = &self.custom_data {
1353            Validate::validate_at(value, path, out);
1354        }
1355        path.pop();
1356    }
1357}
1358
1359/// 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.
1360///
1361/// The OCPP 2.1 `ChargingPeriod` data type.
1362#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1363pub struct ChargingPeriod {
1364    /// Start timestamp of charging period. A period ends when the next period starts. The last period ends when the session ends.
1365    #[serde(rename = "startPeriod")]
1366    pub start_period: crate::types::DateTime,
1367    /// The `dimensions` member.
1368    #[serde(default, skip_serializing_if = "Option::is_none")]
1369    pub dimensions: Option<Vec<CostDimension>>,
1370    /// Unique identifier of the Tariff that was used to calculate cost. If not provided, then cost was calculated by some other means.
1371    #[serde(rename = "tariffId")]
1372    #[serde(default, skip_serializing_if = "Option::is_none")]
1373    pub tariff_id: Option<String>,
1374    /// The `customData` member.
1375    #[serde(rename = "customData")]
1376    #[serde(default, skip_serializing_if = "Option::is_none")]
1377    pub custom_data: Option<crate::types::CustomData>,
1378}
1379
1380impl ChargingPeriod {
1381    /// Creates a `ChargingPeriod` from its required fields.
1382    #[must_use]
1383    pub fn new(start_period: impl Into<crate::types::DateTime>) -> Self {
1384        Self {
1385            start_period: start_period.into(),
1386            dimensions: None,
1387            tariff_id: None,
1388            custom_data: None,
1389        }
1390    }
1391
1392    /// Sets the optional `dimensions` field.
1393    #[must_use]
1394    pub fn with_dimensions(mut self, value: Vec<CostDimension>) -> Self {
1395        self.dimensions = Some(value);
1396        self
1397    }
1398
1399    /// Sets the optional `tariffId` field.
1400    #[must_use]
1401    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
1402        self.tariff_id = Some(value.into());
1403        self
1404    }
1405
1406    /// Sets the optional `customData` field.
1407    #[must_use]
1408    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1409        self.custom_data = Some(value);
1410        self
1411    }
1412}
1413
1414impl Validate for ChargingPeriod {
1415    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1416        path.push_key("dimensions");
1417        if let Some(value) = &self.dimensions {
1418            validate::list_len(value.len(), Some(1), None, path, out);
1419            for (index, item) in value.iter().enumerate() {
1420                path.push_index(index);
1421                Validate::validate_at(item, path, out);
1422                path.pop();
1423            }
1424        }
1425        path.pop();
1426        path.push_key("tariffId");
1427        if let Some(value) = &self.tariff_id {
1428            validate::string(value.as_str(), None, Some(60), path, out);
1429        }
1430        path.pop();
1431        path.push_key("customData");
1432        if let Some(value) = &self.custom_data {
1433            Validate::validate_at(value, path, out);
1434        }
1435        path.pop();
1436    }
1437}
1438
1439/// 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.
1440///
1441/// image::images/ChargingProfile-Simple.png\[\]
1442///
1443/// The OCPP 2.1 `ChargingProfile` data type.
1444#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1445pub struct ChargingProfile {
1446    /// 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.
1447    pub id: i32,
1448    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1449    #[serde(rename = "stackLevel")]
1450    pub stack_level: i32,
1451    /// The `chargingProfilePurpose` member.
1452    #[serde(rename = "chargingProfilePurpose")]
1453    pub charging_profile_purpose: ChargingProfilePurpose,
1454    /// The `chargingProfileKind` member.
1455    #[serde(rename = "chargingProfileKind")]
1456    pub charging_profile_kind: ChargingProfileKind,
1457    /// The `chargingSchedule` member.
1458    #[serde(rename = "chargingSchedule")]
1459    pub charging_schedule: Vec<ChargingSchedule>,
1460    /// The `recurrencyKind` member.
1461    #[serde(rename = "recurrencyKind")]
1462    #[serde(default, skip_serializing_if = "Option::is_none")]
1463    pub recurrency_kind: Option<RecurrencyKind>,
1464    /// 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.
1465    #[serde(rename = "validFrom")]
1466    #[serde(default, skip_serializing_if = "Option::is_none")]
1467    pub valid_from: Option<crate::types::DateTime>,
1468    /// Point in time at which the profile stops to be valid. If absent, the profile is valid until it is replaced by another profile.
1469    #[serde(rename = "validTo")]
1470    #[serde(default, skip_serializing_if = "Option::is_none")]
1471    pub valid_to: Option<crate::types::DateTime>,
1472    /// 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.
1473    #[serde(rename = "transactionId")]
1474    #[serde(default, skip_serializing_if = "Option::is_none")]
1475    pub transaction_id: Option<String>,
1476    /// *(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.
1477    /// If _invalidAfterOfflineDuration_ is true, then this charging profile will become permanently invalid.
1478    /// 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.
1479    #[serde(rename = "maxOfflineDuration")]
1480    #[serde(default, skip_serializing_if = "Option::is_none")]
1481    pub max_offline_duration: Option<i32>,
1482    /// *(2.1)* When set to true this charging profile will not be valid anymore after being offline for more than _maxOfflineDuration_. +
1483    ///     When absent defaults to false.
1484    #[serde(rename = "invalidAfterOfflineDuration")]
1485    #[serde(default, skip_serializing_if = "Option::is_none")]
1486    pub invalid_after_offline_duration: Option<bool>,
1487    /// *(2.1)*  Interval in seconds after receipt of last update, when to request a profile update by sending a PullDynamicScheduleUpdateRequest message.
1488    ///     A value of 0 or no value means that no update interval applies. +
1489    ///     Only relevant in a dynamic charging profile.
1490    #[serde(rename = "dynUpdateInterval")]
1491    #[serde(default, skip_serializing_if = "Option::is_none")]
1492    pub dyn_update_interval: Option<i32>,
1493    /// *(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. +
1494    ///     Only relevant in a dynamic charging profile.
1495    #[serde(rename = "dynUpdateTime")]
1496    #[serde(default, skip_serializing_if = "Option::is_none")]
1497    pub dyn_update_time: Option<crate::types::DateTime>,
1498    /// *(2.1)* ISO 15118-20 signature for all price schedules in _chargingSchedules_. +
1499    /// 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.
1500    #[serde(rename = "priceScheduleSignature")]
1501    #[serde(default, skip_serializing_if = "Option::is_none")]
1502    pub price_schedule_signature: Option<String>,
1503    /// The `customData` member.
1504    #[serde(rename = "customData")]
1505    #[serde(default, skip_serializing_if = "Option::is_none")]
1506    pub custom_data: Option<crate::types::CustomData>,
1507}
1508
1509impl ChargingProfile {
1510    /// Creates a `ChargingProfile` from its required fields.
1511    #[must_use]
1512    pub fn new(
1513        id: i32,
1514        stack_level: i32,
1515        charging_profile_purpose: ChargingProfilePurpose,
1516        charging_profile_kind: ChargingProfileKind,
1517        charging_schedule: Vec<ChargingSchedule>,
1518    ) -> Self {
1519        Self {
1520            id,
1521            stack_level,
1522            charging_profile_purpose,
1523            charging_profile_kind,
1524            charging_schedule,
1525            recurrency_kind: None,
1526            valid_from: None,
1527            valid_to: None,
1528            transaction_id: None,
1529            max_offline_duration: None,
1530            invalid_after_offline_duration: None,
1531            dyn_update_interval: None,
1532            dyn_update_time: None,
1533            price_schedule_signature: None,
1534            custom_data: None,
1535        }
1536    }
1537
1538    /// Sets the optional `recurrencyKind` field.
1539    #[must_use]
1540    pub fn with_recurrency_kind(mut self, value: RecurrencyKind) -> Self {
1541        self.recurrency_kind = Some(value);
1542        self
1543    }
1544
1545    /// Sets the optional `validFrom` field.
1546    #[must_use]
1547    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1548        self.valid_from = Some(value.into());
1549        self
1550    }
1551
1552    /// Sets the optional `validTo` field.
1553    #[must_use]
1554    pub fn with_valid_to(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1555        self.valid_to = Some(value.into());
1556        self
1557    }
1558
1559    /// Sets the optional `transactionId` field.
1560    #[must_use]
1561    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
1562        self.transaction_id = Some(value.into());
1563        self
1564    }
1565
1566    /// Sets the optional `maxOfflineDuration` field.
1567    #[must_use]
1568    pub fn with_max_offline_duration(mut self, value: i32) -> Self {
1569        self.max_offline_duration = Some(value);
1570        self
1571    }
1572
1573    /// Sets the optional `invalidAfterOfflineDuration` field.
1574    #[must_use]
1575    pub fn with_invalid_after_offline_duration(mut self, value: bool) -> Self {
1576        self.invalid_after_offline_duration = Some(value);
1577        self
1578    }
1579
1580    /// Sets the optional `dynUpdateInterval` field.
1581    #[must_use]
1582    pub fn with_dyn_update_interval(mut self, value: i32) -> Self {
1583        self.dyn_update_interval = Some(value);
1584        self
1585    }
1586
1587    /// Sets the optional `dynUpdateTime` field.
1588    #[must_use]
1589    pub fn with_dyn_update_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1590        self.dyn_update_time = Some(value.into());
1591        self
1592    }
1593
1594    /// Sets the optional `priceScheduleSignature` field.
1595    #[must_use]
1596    pub fn with_price_schedule_signature(mut self, value: impl Into<String>) -> Self {
1597        self.price_schedule_signature = Some(value.into());
1598        self
1599    }
1600
1601    /// Sets the optional `customData` field.
1602    #[must_use]
1603    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1604        self.custom_data = Some(value);
1605        self
1606    }
1607}
1608
1609impl Validate for ChargingProfile {
1610    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1611        path.push_key("stackLevel");
1612        validate::int_range(i64::from(self.stack_level), Some(0), None, path, out);
1613        path.pop();
1614        path.push_key("chargingProfilePurpose");
1615        Validate::validate_at(&self.charging_profile_purpose, path, out);
1616        path.pop();
1617        path.push_key("chargingProfileKind");
1618        Validate::validate_at(&self.charging_profile_kind, path, out);
1619        path.pop();
1620        path.push_key("chargingSchedule");
1621        validate::list_len(self.charging_schedule.len(), Some(1), Some(3), path, out);
1622        for (index, item) in self.charging_schedule.iter().enumerate() {
1623            path.push_index(index);
1624            Validate::validate_at(item, path, out);
1625            path.pop();
1626        }
1627        path.pop();
1628        path.push_key("recurrencyKind");
1629        if let Some(value) = &self.recurrency_kind {
1630            Validate::validate_at(value, path, out);
1631        }
1632        path.pop();
1633        path.push_key("transactionId");
1634        if let Some(value) = &self.transaction_id {
1635            validate::string(value.as_str(), None, Some(36), path, out);
1636        }
1637        path.pop();
1638        path.push_key("priceScheduleSignature");
1639        if let Some(value) = &self.price_schedule_signature {
1640            validate::string(value.as_str(), None, Some(256), path, out);
1641        }
1642        path.pop();
1643        path.push_key("customData");
1644        if let Some(value) = &self.custom_data {
1645            Validate::validate_at(value, path, out);
1646        }
1647        path.pop();
1648    }
1649}
1650
1651/// A ChargingProfileCriterionType is a filter for charging profiles to be selected by a GetChargingProfilesRequest.
1652///
1653/// The OCPP 2.1 `ChargingProfileCriterion` data type.
1654#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1655pub struct ChargingProfileCriterion {
1656    /// The `chargingProfilePurpose` member.
1657    #[serde(rename = "chargingProfilePurpose")]
1658    #[serde(default, skip_serializing_if = "Option::is_none")]
1659    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
1660    /// Value determining level in hierarchy stack of profiles. Higher values have precedence over lower values. Lowest level is 0.
1661    #[serde(rename = "stackLevel")]
1662    #[serde(default, skip_serializing_if = "Option::is_none")]
1663    pub stack_level: Option<i32>,
1664    /// 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;
1665    #[serde(rename = "chargingProfileId")]
1666    #[serde(default, skip_serializing_if = "Option::is_none")]
1667    pub charging_profile_id: Option<Vec<i32>>,
1668    /// 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.
1669    #[serde(rename = "chargingLimitSource")]
1670    #[serde(default, skip_serializing_if = "Option::is_none")]
1671    pub charging_limit_source: Option<Vec<String>>,
1672    /// The `customData` member.
1673    #[serde(rename = "customData")]
1674    #[serde(default, skip_serializing_if = "Option::is_none")]
1675    pub custom_data: Option<crate::types::CustomData>,
1676}
1677
1678impl ChargingProfileCriterion {
1679    /// Creates an empty `ChargingProfileCriterion`. Every field of this type is optional.
1680    #[must_use]
1681    pub fn new() -> Self {
1682        Self::default()
1683    }
1684
1685    /// Sets the optional `chargingProfilePurpose` field.
1686    #[must_use]
1687    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
1688        self.charging_profile_purpose = Some(value);
1689        self
1690    }
1691
1692    /// Sets the optional `stackLevel` field.
1693    #[must_use]
1694    pub fn with_stack_level(mut self, value: i32) -> Self {
1695        self.stack_level = Some(value);
1696        self
1697    }
1698
1699    /// Sets the optional `chargingProfileId` field.
1700    #[must_use]
1701    pub fn with_charging_profile_id(mut self, value: Vec<i32>) -> Self {
1702        self.charging_profile_id = Some(value);
1703        self
1704    }
1705
1706    /// Sets the optional `chargingLimitSource` field.
1707    #[must_use]
1708    pub fn with_charging_limit_source(
1709        mut self,
1710        value: impl IntoIterator<Item = impl Into<String>>,
1711    ) -> Self {
1712        self.charging_limit_source = Some(value.into_iter().map(Into::into).collect());
1713        self
1714    }
1715
1716    /// Sets the optional `customData` field.
1717    #[must_use]
1718    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1719        self.custom_data = Some(value);
1720        self
1721    }
1722}
1723
1724impl Validate for ChargingProfileCriterion {
1725    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1726        path.push_key("chargingProfilePurpose");
1727        if let Some(value) = &self.charging_profile_purpose {
1728            Validate::validate_at(value, path, out);
1729        }
1730        path.pop();
1731        path.push_key("stackLevel");
1732        if let Some(value) = &self.stack_level {
1733            validate::int_range(i64::from(*value), Some(0), None, path, out);
1734        }
1735        path.pop();
1736        path.push_key("chargingProfileId");
1737        if let Some(value) = &self.charging_profile_id {
1738            validate::list_len(value.len(), Some(1), None, path, out);
1739        }
1740        path.pop();
1741        path.push_key("chargingLimitSource");
1742        if let Some(value) = &self.charging_limit_source {
1743            validate::list_len(value.len(), Some(1), Some(4), path, out);
1744            for (index, item) in value.iter().enumerate() {
1745                path.push_index(index);
1746                validate::string(item.as_str(), None, Some(20), path, out);
1747                path.pop();
1748            }
1749        }
1750        path.pop();
1751        path.push_key("customData");
1752        if let Some(value) = &self.custom_data {
1753            Validate::validate_at(value, path, out);
1754        }
1755        path.pop();
1756    }
1757}
1758
1759/// 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'. +
1760/// 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.
1761///
1762/// image::images/ChargingSchedule-Simple.png\[\]
1763///
1764/// The OCPP 2.1 `ChargingSchedule` data type.
1765#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1766pub struct ChargingSchedule {
1767    /// The `id` member.
1768    pub id: i32,
1769    /// The `chargingRateUnit` member.
1770    #[serde(rename = "chargingRateUnit")]
1771    pub charging_rate_unit: ChargingRateUnit,
1772    /// The `chargingSchedulePeriod` member.
1773    #[serde(rename = "chargingSchedulePeriod")]
1774    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
1775    /// The `limitAtSoC` member.
1776    #[serde(rename = "limitAtSoC")]
1777    #[serde(default, skip_serializing_if = "Option::is_none")]
1778    pub limit_at_so_c: Option<LimitAtSoC>,
1779    /// Starting point of an absolute schedule or recurring schedule.
1780    #[serde(rename = "startSchedule")]
1781    #[serde(default, skip_serializing_if = "Option::is_none")]
1782    pub start_schedule: Option<crate::types::DateTime>,
1783    /// 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.
1784    #[serde(default, skip_serializing_if = "Option::is_none")]
1785    pub duration: Option<i32>,
1786    /// 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.
1787    #[serde(rename = "minChargingRate")]
1788    #[serde(default, skip_serializing_if = "Option::is_none")]
1789    pub min_charging_rate: Option<crate::types::Decimal>,
1790    /// *(2.1)* Power tolerance when following EVPowerProfile.
1791    #[serde(rename = "powerTolerance")]
1792    #[serde(default, skip_serializing_if = "Option::is_none")]
1793    pub power_tolerance: Option<crate::types::Decimal>,
1794    /// *(2.1)* Id of this element for referencing in a signature.
1795    #[serde(rename = "signatureId")]
1796    #[serde(default, skip_serializing_if = "Option::is_none")]
1797    pub signature_id: Option<i32>,
1798    /// *(2.1)* Base64 encoded hash (SHA256 for ISO 15118-2, SHA512 for ISO 15118-20) of the EXI price schedule element. Used in signature.
1799    #[serde(rename = "digestValue")]
1800    #[serde(default, skip_serializing_if = "Option::is_none")]
1801    pub digest_value: Option<String>,
1802    /// *(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.
1803    ///  This allows the same `Absolute` or `Recurring` charging profile to be used in both summer and winter time.
1804    #[serde(rename = "useLocalTime")]
1805    #[serde(default, skip_serializing_if = "Option::is_none")]
1806    pub use_local_time: Option<bool>,
1807    /// *(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.
1808    #[serde(rename = "randomizedDelay")]
1809    #[serde(default, skip_serializing_if = "Option::is_none")]
1810    pub randomized_delay: Option<i32>,
1811    /// The `salesTariff` member.
1812    #[serde(rename = "salesTariff")]
1813    #[serde(default, skip_serializing_if = "Option::is_none")]
1814    pub sales_tariff: Option<SalesTariff>,
1815    /// The `absolutePriceSchedule` member.
1816    #[serde(rename = "absolutePriceSchedule")]
1817    #[serde(default, skip_serializing_if = "Option::is_none")]
1818    pub absolute_price_schedule: Option<AbsolutePriceSchedule>,
1819    /// The `priceLevelSchedule` member.
1820    #[serde(rename = "priceLevelSchedule")]
1821    #[serde(default, skip_serializing_if = "Option::is_none")]
1822    pub price_level_schedule: Option<PriceLevelSchedule>,
1823    /// The `customData` member.
1824    #[serde(rename = "customData")]
1825    #[serde(default, skip_serializing_if = "Option::is_none")]
1826    pub custom_data: Option<crate::types::CustomData>,
1827}
1828
1829impl ChargingSchedule {
1830    /// Creates a `ChargingSchedule` from its required fields.
1831    #[must_use]
1832    pub fn new(
1833        id: i32,
1834        charging_rate_unit: ChargingRateUnit,
1835        charging_schedule_period: Vec<ChargingSchedulePeriod>,
1836    ) -> Self {
1837        Self {
1838            id,
1839            charging_rate_unit,
1840            charging_schedule_period,
1841            limit_at_so_c: None,
1842            start_schedule: None,
1843            duration: None,
1844            min_charging_rate: None,
1845            power_tolerance: None,
1846            signature_id: None,
1847            digest_value: None,
1848            use_local_time: None,
1849            randomized_delay: None,
1850            sales_tariff: None,
1851            absolute_price_schedule: None,
1852            price_level_schedule: None,
1853            custom_data: None,
1854        }
1855    }
1856
1857    /// Sets the optional `limitAtSoC` field.
1858    #[must_use]
1859    pub fn with_limit_at_so_c(mut self, value: LimitAtSoC) -> Self {
1860        self.limit_at_so_c = Some(value);
1861        self
1862    }
1863
1864    /// Sets the optional `startSchedule` field.
1865    #[must_use]
1866    pub fn with_start_schedule(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1867        self.start_schedule = Some(value.into());
1868        self
1869    }
1870
1871    /// Sets the optional `duration` field.
1872    #[must_use]
1873    pub fn with_duration(mut self, value: i32) -> Self {
1874        self.duration = Some(value);
1875        self
1876    }
1877
1878    /// Sets the optional `minChargingRate` field.
1879    #[must_use]
1880    pub fn with_min_charging_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1881        self.min_charging_rate = Some(value.into());
1882        self
1883    }
1884
1885    /// Sets the optional `powerTolerance` field.
1886    #[must_use]
1887    pub fn with_power_tolerance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
1888        self.power_tolerance = Some(value.into());
1889        self
1890    }
1891
1892    /// Sets the optional `signatureId` field.
1893    #[must_use]
1894    pub fn with_signature_id(mut self, value: i32) -> Self {
1895        self.signature_id = Some(value);
1896        self
1897    }
1898
1899    /// Sets the optional `digestValue` field.
1900    #[must_use]
1901    pub fn with_digest_value(mut self, value: impl Into<String>) -> Self {
1902        self.digest_value = Some(value.into());
1903        self
1904    }
1905
1906    /// Sets the optional `useLocalTime` field.
1907    #[must_use]
1908    pub fn with_use_local_time(mut self, value: bool) -> Self {
1909        self.use_local_time = Some(value);
1910        self
1911    }
1912
1913    /// Sets the optional `randomizedDelay` field.
1914    #[must_use]
1915    pub fn with_randomized_delay(mut self, value: i32) -> Self {
1916        self.randomized_delay = Some(value);
1917        self
1918    }
1919
1920    /// Sets the optional `salesTariff` field.
1921    #[must_use]
1922    pub fn with_sales_tariff(mut self, value: SalesTariff) -> Self {
1923        self.sales_tariff = Some(value);
1924        self
1925    }
1926
1927    /// Sets the optional `absolutePriceSchedule` field.
1928    #[must_use]
1929    pub fn with_absolute_price_schedule(mut self, value: AbsolutePriceSchedule) -> Self {
1930        self.absolute_price_schedule = Some(value);
1931        self
1932    }
1933
1934    /// Sets the optional `priceLevelSchedule` field.
1935    #[must_use]
1936    pub fn with_price_level_schedule(mut self, value: PriceLevelSchedule) -> Self {
1937        self.price_level_schedule = Some(value);
1938        self
1939    }
1940
1941    /// Sets the optional `customData` field.
1942    #[must_use]
1943    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1944        self.custom_data = Some(value);
1945        self
1946    }
1947}
1948
1949impl Validate for ChargingSchedule {
1950    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1951        path.push_key("chargingRateUnit");
1952        Validate::validate_at(&self.charging_rate_unit, path, out);
1953        path.pop();
1954        path.push_key("chargingSchedulePeriod");
1955        validate::list_len(
1956            self.charging_schedule_period.len(),
1957            Some(1),
1958            Some(1024),
1959            path,
1960            out,
1961        );
1962        for (index, item) in self.charging_schedule_period.iter().enumerate() {
1963            path.push_index(index);
1964            Validate::validate_at(item, path, out);
1965            path.pop();
1966        }
1967        path.pop();
1968        path.push_key("limitAtSoC");
1969        if let Some(value) = &self.limit_at_so_c {
1970            Validate::validate_at(value, path, out);
1971        }
1972        path.pop();
1973        path.push_key("signatureId");
1974        if let Some(value) = &self.signature_id {
1975            validate::int_range(i64::from(*value), Some(0), None, path, out);
1976        }
1977        path.pop();
1978        path.push_key("digestValue");
1979        if let Some(value) = &self.digest_value {
1980            validate::string(value.as_str(), None, Some(88), path, out);
1981        }
1982        path.pop();
1983        path.push_key("randomizedDelay");
1984        if let Some(value) = &self.randomized_delay {
1985            validate::int_range(i64::from(*value), Some(0), None, path, out);
1986        }
1987        path.pop();
1988        path.push_key("salesTariff");
1989        if let Some(value) = &self.sales_tariff {
1990            Validate::validate_at(value, path, out);
1991        }
1992        path.pop();
1993        path.push_key("absolutePriceSchedule");
1994        if let Some(value) = &self.absolute_price_schedule {
1995            Validate::validate_at(value, path, out);
1996        }
1997        path.pop();
1998        path.push_key("priceLevelSchedule");
1999        if let Some(value) = &self.price_level_schedule {
2000            Validate::validate_at(value, path, out);
2001        }
2002        path.pop();
2003        path.push_key("customData");
2004        if let Some(value) = &self.custom_data {
2005            Validate::validate_at(value, path, out);
2006        }
2007        path.pop();
2008    }
2009}
2010
2011/// 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.
2012///
2013/// The OCPP 2.1 `ChargingSchedulePeriod` data type.
2014#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2015pub struct ChargingSchedulePeriod {
2016    /// Start of the period, in seconds from the start of schedule. The value of StartPeriod also defines the stop time of the previous period.
2017    #[serde(rename = "startPeriod")]
2018    pub start_period: i32,
2019    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2020    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2021    /// 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.
2022    /// 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.
2023    #[serde(default, skip_serializing_if = "Option::is_none")]
2024    pub limit: Option<crate::types::Decimal>,
2025    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2026    #[serde(rename = "limit_L2")]
2027    #[serde(default, skip_serializing_if = "Option::is_none")]
2028    pub limit_l2: Option<crate::types::Decimal>,
2029    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2030    #[serde(rename = "limit_L3")]
2031    #[serde(default, skip_serializing_if = "Option::is_none")]
2032    pub limit_l3: Option<crate::types::Decimal>,
2033    /// The number of phases that can be used for charging. +
2034    /// For a DC EVSE this field should be omitted. +
2035    /// For an AC EVSE a default value of _numberPhases_ = 3 will be assumed if the field is absent.
2036    #[serde(rename = "numberPhases")]
2037    #[serde(default, skip_serializing_if = "Option::is_none")]
2038    pub number_phases: Option<i32>,
2039    /// 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.
2040    #[serde(rename = "phaseToUse")]
2041    #[serde(default, skip_serializing_if = "Option::is_none")]
2042    pub phase_to_use: Option<i32>,
2043    /// *(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.  +
2044    /// 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.
2045    #[serde(rename = "dischargeLimit")]
2046    #[serde(default, skip_serializing_if = "Option::is_none")]
2047    pub discharge_limit: Option<crate::types::Decimal>,
2048    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2049    #[serde(rename = "dischargeLimit_L2")]
2050    #[serde(default, skip_serializing_if = "Option::is_none")]
2051    pub discharge_limit_l2: Option<crate::types::Decimal>,
2052    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2053    #[serde(rename = "dischargeLimit_L3")]
2054    #[serde(default, skip_serializing_if = "Option::is_none")]
2055    pub discharge_limit_l3: Option<crate::types::Decimal>,
2056    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2057    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2058    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2059    #[serde(default, skip_serializing_if = "Option::is_none")]
2060    pub setpoint: Option<crate::types::Decimal>,
2061    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2062    #[serde(rename = "setpoint_L2")]
2063    #[serde(default, skip_serializing_if = "Option::is_none")]
2064    pub setpoint_l2: Option<crate::types::Decimal>,
2065    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2066    #[serde(rename = "setpoint_L3")]
2067    #[serde(default, skip_serializing_if = "Option::is_none")]
2068    pub setpoint_l3: Option<crate::types::Decimal>,
2069    /// *(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.  +
2070    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2071    #[serde(rename = "setpointReactive")]
2072    #[serde(default, skip_serializing_if = "Option::is_none")]
2073    pub setpoint_reactive: Option<crate::types::Decimal>,
2074    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2075    #[serde(rename = "setpointReactive_L2")]
2076    #[serde(default, skip_serializing_if = "Option::is_none")]
2077    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2078    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2079    #[serde(rename = "setpointReactive_L3")]
2080    #[serde(default, skip_serializing_if = "Option::is_none")]
2081    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2082    /// *(2.1)* If  true, the EV should attempt to keep the BMS preconditioned for this time interval.
2083    #[serde(rename = "preconditioningRequest")]
2084    #[serde(default, skip_serializing_if = "Option::is_none")]
2085    pub preconditioning_request: Option<bool>,
2086    /// *(2.1)* If true, the EVSE must turn off power electronics/modules associated with this transaction. Default value when absent is false.
2087    #[serde(rename = "evseSleep")]
2088    #[serde(default, skip_serializing_if = "Option::is_none")]
2089    pub evse_sleep: Option<bool>,
2090    /// *(2.1)* Power value that, when present, is used as a baseline on top of which values from _v2xFreqWattCurve_ and _v2xSignalWattCurve_ are added.
2091    #[serde(rename = "v2xBaseline")]
2092    #[serde(default, skip_serializing_if = "Option::is_none")]
2093    pub v2x_baseline: Option<crate::types::Decimal>,
2094    /// The `operationMode` member.
2095    #[serde(rename = "operationMode")]
2096    #[serde(default, skip_serializing_if = "Option::is_none")]
2097    pub operation_mode: Option<OperationMode>,
2098    /// The `v2xFreqWattCurve` member.
2099    #[serde(rename = "v2xFreqWattCurve")]
2100    #[serde(default, skip_serializing_if = "Option::is_none")]
2101    pub v2x_freq_watt_curve: Option<Vec<V2XFreqWattPoint>>,
2102    /// The `v2xSignalWattCurve` member.
2103    #[serde(rename = "v2xSignalWattCurve")]
2104    #[serde(default, skip_serializing_if = "Option::is_none")]
2105    pub v2x_signal_watt_curve: Option<Vec<V2XSignalWattPoint>>,
2106    /// The `customData` member.
2107    #[serde(rename = "customData")]
2108    #[serde(default, skip_serializing_if = "Option::is_none")]
2109    pub custom_data: Option<crate::types::CustomData>,
2110}
2111
2112impl ChargingSchedulePeriod {
2113    /// Creates a `ChargingSchedulePeriod` from its required fields.
2114    #[must_use]
2115    pub fn new(start_period: i32) -> Self {
2116        Self {
2117            start_period,
2118            limit: None,
2119            limit_l2: None,
2120            limit_l3: None,
2121            number_phases: None,
2122            phase_to_use: None,
2123            discharge_limit: None,
2124            discharge_limit_l2: None,
2125            discharge_limit_l3: None,
2126            setpoint: None,
2127            setpoint_l2: None,
2128            setpoint_l3: None,
2129            setpoint_reactive: None,
2130            setpoint_reactive_l2: None,
2131            setpoint_reactive_l3: None,
2132            preconditioning_request: None,
2133            evse_sleep: None,
2134            v2x_baseline: None,
2135            operation_mode: None,
2136            v2x_freq_watt_curve: None,
2137            v2x_signal_watt_curve: None,
2138            custom_data: None,
2139        }
2140    }
2141
2142    /// Sets the optional `limit` field.
2143    #[must_use]
2144    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2145        self.limit = Some(value.into());
2146        self
2147    }
2148
2149    /// Sets the optional `limit_L2` field.
2150    #[must_use]
2151    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2152        self.limit_l2 = Some(value.into());
2153        self
2154    }
2155
2156    /// Sets the optional `limit_L3` field.
2157    #[must_use]
2158    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2159        self.limit_l3 = Some(value.into());
2160        self
2161    }
2162
2163    /// Sets the optional `numberPhases` field.
2164    #[must_use]
2165    pub fn with_number_phases(mut self, value: i32) -> Self {
2166        self.number_phases = Some(value);
2167        self
2168    }
2169
2170    /// Sets the optional `phaseToUse` field.
2171    #[must_use]
2172    pub fn with_phase_to_use(mut self, value: i32) -> Self {
2173        self.phase_to_use = Some(value);
2174        self
2175    }
2176
2177    /// Sets the optional `dischargeLimit` field.
2178    #[must_use]
2179    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2180        self.discharge_limit = Some(value.into());
2181        self
2182    }
2183
2184    /// Sets the optional `dischargeLimit_L2` field.
2185    #[must_use]
2186    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2187        self.discharge_limit_l2 = Some(value.into());
2188        self
2189    }
2190
2191    /// Sets the optional `dischargeLimit_L3` field.
2192    #[must_use]
2193    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2194        self.discharge_limit_l3 = Some(value.into());
2195        self
2196    }
2197
2198    /// Sets the optional `setpoint` field.
2199    #[must_use]
2200    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2201        self.setpoint = Some(value.into());
2202        self
2203    }
2204
2205    /// Sets the optional `setpoint_L2` field.
2206    #[must_use]
2207    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2208        self.setpoint_l2 = Some(value.into());
2209        self
2210    }
2211
2212    /// Sets the optional `setpoint_L3` field.
2213    #[must_use]
2214    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2215        self.setpoint_l3 = Some(value.into());
2216        self
2217    }
2218
2219    /// Sets the optional `setpointReactive` field.
2220    #[must_use]
2221    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2222        self.setpoint_reactive = Some(value.into());
2223        self
2224    }
2225
2226    /// Sets the optional `setpointReactive_L2` field.
2227    #[must_use]
2228    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2229        self.setpoint_reactive_l2 = Some(value.into());
2230        self
2231    }
2232
2233    /// Sets the optional `setpointReactive_L3` field.
2234    #[must_use]
2235    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2236        self.setpoint_reactive_l3 = Some(value.into());
2237        self
2238    }
2239
2240    /// Sets the optional `preconditioningRequest` field.
2241    #[must_use]
2242    pub fn with_preconditioning_request(mut self, value: bool) -> Self {
2243        self.preconditioning_request = Some(value);
2244        self
2245    }
2246
2247    /// Sets the optional `evseSleep` field.
2248    #[must_use]
2249    pub fn with_evse_sleep(mut self, value: bool) -> Self {
2250        self.evse_sleep = Some(value);
2251        self
2252    }
2253
2254    /// Sets the optional `v2xBaseline` field.
2255    #[must_use]
2256    pub fn with_v2x_baseline(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2257        self.v2x_baseline = Some(value.into());
2258        self
2259    }
2260
2261    /// Sets the optional `operationMode` field.
2262    #[must_use]
2263    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
2264        self.operation_mode = Some(value);
2265        self
2266    }
2267
2268    /// Sets the optional `v2xFreqWattCurve` field.
2269    #[must_use]
2270    pub fn with_v2x_freq_watt_curve(mut self, value: Vec<V2XFreqWattPoint>) -> Self {
2271        self.v2x_freq_watt_curve = Some(value);
2272        self
2273    }
2274
2275    /// Sets the optional `v2xSignalWattCurve` field.
2276    #[must_use]
2277    pub fn with_v2x_signal_watt_curve(mut self, value: Vec<V2XSignalWattPoint>) -> Self {
2278        self.v2x_signal_watt_curve = Some(value);
2279        self
2280    }
2281
2282    /// Sets the optional `customData` field.
2283    #[must_use]
2284    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2285        self.custom_data = Some(value);
2286        self
2287    }
2288}
2289
2290impl Validate for ChargingSchedulePeriod {
2291    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2292        path.push_key("numberPhases");
2293        if let Some(value) = &self.number_phases {
2294            validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
2295        }
2296        path.pop();
2297        path.push_key("phaseToUse");
2298        if let Some(value) = &self.phase_to_use {
2299            validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
2300        }
2301        path.pop();
2302        path.push_key("dischargeLimit");
2303        if let Some(value) = &self.discharge_limit {
2304            validate::range(
2305                *value,
2306                None,
2307                Some(crate::types::Decimal::new(0, 0)),
2308                path,
2309                out,
2310            );
2311        }
2312        path.pop();
2313        path.push_key("dischargeLimit_L2");
2314        if let Some(value) = &self.discharge_limit_l2 {
2315            validate::range(
2316                *value,
2317                None,
2318                Some(crate::types::Decimal::new(0, 0)),
2319                path,
2320                out,
2321            );
2322        }
2323        path.pop();
2324        path.push_key("dischargeLimit_L3");
2325        if let Some(value) = &self.discharge_limit_l3 {
2326            validate::range(
2327                *value,
2328                None,
2329                Some(crate::types::Decimal::new(0, 0)),
2330                path,
2331                out,
2332            );
2333        }
2334        path.pop();
2335        path.push_key("operationMode");
2336        if let Some(value) = &self.operation_mode {
2337            Validate::validate_at(value, path, out);
2338        }
2339        path.pop();
2340        path.push_key("v2xFreqWattCurve");
2341        if let Some(value) = &self.v2x_freq_watt_curve {
2342            validate::list_len(value.len(), Some(1), Some(20), path, out);
2343            for (index, item) in value.iter().enumerate() {
2344                path.push_index(index);
2345                Validate::validate_at(item, path, out);
2346                path.pop();
2347            }
2348        }
2349        path.pop();
2350        path.push_key("v2xSignalWattCurve");
2351        if let Some(value) = &self.v2x_signal_watt_curve {
2352            validate::list_len(value.len(), Some(1), Some(20), path, out);
2353            for (index, item) in value.iter().enumerate() {
2354                path.push_index(index);
2355                Validate::validate_at(item, path, out);
2356                path.pop();
2357            }
2358        }
2359        path.pop();
2360        path.push_key("customData");
2361        if let Some(value) = &self.custom_data {
2362            Validate::validate_at(value, path, out);
2363        }
2364        path.pop();
2365    }
2366}
2367
2368/// Updates to a ChargingSchedulePeriodType for dynamic charging profiles.
2369///
2370/// The OCPP 2.1 `ChargingScheduleUpdate` data type.
2371#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2372pub struct ChargingScheduleUpdate {
2373    /// Optional only when not required by the _operationMode_, as in CentralSetpoint, ExternalSetpoint, ExternalLimits, LocalFrequency,  LocalLoadBalancing. +
2374    /// Charging rate limit during the schedule period, in the applicable _chargingRateUnit_.
2375    /// 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.
2376    /// 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.
2377    #[serde(default, skip_serializing_if = "Option::is_none")]
2378    pub limit: Option<crate::types::Decimal>,
2379    /// *(2.1)* Charging rate limit on phase L2  in the applicable _chargingRateUnit_.
2380    #[serde(rename = "limit_L2")]
2381    #[serde(default, skip_serializing_if = "Option::is_none")]
2382    pub limit_l2: Option<crate::types::Decimal>,
2383    /// *(2.1)* Charging rate limit on phase L3  in the applicable _chargingRateUnit_.
2384    #[serde(rename = "limit_L3")]
2385    #[serde(default, skip_serializing_if = "Option::is_none")]
2386    pub limit_l3: Option<crate::types::Decimal>,
2387    /// *(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.  +
2388    /// 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.
2389    #[serde(rename = "dischargeLimit")]
2390    #[serde(default, skip_serializing_if = "Option::is_none")]
2391    pub discharge_limit: Option<crate::types::Decimal>,
2392    /// *(2.1)* Limit in _chargingRateUnit_ on phase L2 that the EV is allowed to discharge with.
2393    #[serde(rename = "dischargeLimit_L2")]
2394    #[serde(default, skip_serializing_if = "Option::is_none")]
2395    pub discharge_limit_l2: Option<crate::types::Decimal>,
2396    /// *(2.1)* Limit in _chargingRateUnit_ on phase L3 that the EV is allowed to discharge with.
2397    #[serde(rename = "dischargeLimit_L3")]
2398    #[serde(default, skip_serializing_if = "Option::is_none")]
2399    pub discharge_limit_l3: Option<crate::types::Decimal>,
2400    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow as close as possible. Use negative values for discharging. +
2401    /// When a limit and/or _dischargeLimit_ are given the overshoot when following _setpoint_ must remain within these values.
2402    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2403    #[serde(default, skip_serializing_if = "Option::is_none")]
2404    pub setpoint: Option<crate::types::Decimal>,
2405    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L2 as close as possible.
2406    #[serde(rename = "setpoint_L2")]
2407    #[serde(default, skip_serializing_if = "Option::is_none")]
2408    pub setpoint_l2: Option<crate::types::Decimal>,
2409    /// *(2.1)* Setpoint in _chargingRateUnit_ that the EV should follow on phase L3 as close as possible.
2410    #[serde(rename = "setpoint_L3")]
2411    #[serde(default, skip_serializing_if = "Option::is_none")]
2412    pub setpoint_l3: Option<crate::types::Decimal>,
2413    /// *(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.  +
2414    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
2415    #[serde(rename = "setpointReactive")]
2416    #[serde(default, skip_serializing_if = "Option::is_none")]
2417    pub setpoint_reactive: Option<crate::types::Decimal>,
2418    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L2 as closely as possible.
2419    #[serde(rename = "setpointReactive_L2")]
2420    #[serde(default, skip_serializing_if = "Option::is_none")]
2421    pub setpoint_reactive_l2: Option<crate::types::Decimal>,
2422    /// *(2.1)* Setpoint for reactive power (or current) in _chargingRateUnit_ that the EV should follow on phase L3 as closely as possible.
2423    #[serde(rename = "setpointReactive_L3")]
2424    #[serde(default, skip_serializing_if = "Option::is_none")]
2425    pub setpoint_reactive_l3: Option<crate::types::Decimal>,
2426    /// The `customData` member.
2427    #[serde(rename = "customData")]
2428    #[serde(default, skip_serializing_if = "Option::is_none")]
2429    pub custom_data: Option<crate::types::CustomData>,
2430}
2431
2432impl ChargingScheduleUpdate {
2433    /// Creates an empty `ChargingScheduleUpdate`. Every field of this type is optional.
2434    #[must_use]
2435    pub fn new() -> Self {
2436        Self::default()
2437    }
2438
2439    /// Sets the optional `limit` field.
2440    #[must_use]
2441    pub fn with_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2442        self.limit = Some(value.into());
2443        self
2444    }
2445
2446    /// Sets the optional `limit_L2` field.
2447    #[must_use]
2448    pub fn with_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2449        self.limit_l2 = Some(value.into());
2450        self
2451    }
2452
2453    /// Sets the optional `limit_L3` field.
2454    #[must_use]
2455    pub fn with_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2456        self.limit_l3 = Some(value.into());
2457        self
2458    }
2459
2460    /// Sets the optional `dischargeLimit` field.
2461    #[must_use]
2462    pub fn with_discharge_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2463        self.discharge_limit = Some(value.into());
2464        self
2465    }
2466
2467    /// Sets the optional `dischargeLimit_L2` field.
2468    #[must_use]
2469    pub fn with_discharge_limit_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2470        self.discharge_limit_l2 = Some(value.into());
2471        self
2472    }
2473
2474    /// Sets the optional `dischargeLimit_L3` field.
2475    #[must_use]
2476    pub fn with_discharge_limit_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2477        self.discharge_limit_l3 = Some(value.into());
2478        self
2479    }
2480
2481    /// Sets the optional `setpoint` field.
2482    #[must_use]
2483    pub fn with_setpoint(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2484        self.setpoint = Some(value.into());
2485        self
2486    }
2487
2488    /// Sets the optional `setpoint_L2` field.
2489    #[must_use]
2490    pub fn with_setpoint_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2491        self.setpoint_l2 = Some(value.into());
2492        self
2493    }
2494
2495    /// Sets the optional `setpoint_L3` field.
2496    #[must_use]
2497    pub fn with_setpoint_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2498        self.setpoint_l3 = Some(value.into());
2499        self
2500    }
2501
2502    /// Sets the optional `setpointReactive` field.
2503    #[must_use]
2504    pub fn with_setpoint_reactive(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2505        self.setpoint_reactive = Some(value.into());
2506        self
2507    }
2508
2509    /// Sets the optional `setpointReactive_L2` field.
2510    #[must_use]
2511    pub fn with_setpoint_reactive_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2512        self.setpoint_reactive_l2 = Some(value.into());
2513        self
2514    }
2515
2516    /// Sets the optional `setpointReactive_L3` field.
2517    #[must_use]
2518    pub fn with_setpoint_reactive_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
2519        self.setpoint_reactive_l3 = Some(value.into());
2520        self
2521    }
2522
2523    /// Sets the optional `customData` field.
2524    #[must_use]
2525    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2526        self.custom_data = Some(value);
2527        self
2528    }
2529}
2530
2531impl Validate for ChargingScheduleUpdate {
2532    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2533        path.push_key("dischargeLimit");
2534        if let Some(value) = &self.discharge_limit {
2535            validate::range(
2536                *value,
2537                None,
2538                Some(crate::types::Decimal::new(0, 0)),
2539                path,
2540                out,
2541            );
2542        }
2543        path.pop();
2544        path.push_key("dischargeLimit_L2");
2545        if let Some(value) = &self.discharge_limit_l2 {
2546            validate::range(
2547                *value,
2548                None,
2549                Some(crate::types::Decimal::new(0, 0)),
2550                path,
2551                out,
2552            );
2553        }
2554        path.pop();
2555        path.push_key("dischargeLimit_L3");
2556        if let Some(value) = &self.discharge_limit_l3 {
2557            validate::range(
2558                *value,
2559                None,
2560                Some(crate::types::Decimal::new(0, 0)),
2561                path,
2562                out,
2563            );
2564        }
2565        path.pop();
2566        path.push_key("customData");
2567        if let Some(value) = &self.custom_data {
2568            Validate::validate_at(value, path, out);
2569        }
2570        path.pop();
2571    }
2572}
2573
2574/// The physical system where an Electrical Vehicle (EV) can be charged.
2575///
2576/// The OCPP 2.1 `ChargingStation` data type.
2577#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2578pub struct ChargingStation {
2579    /// Defines the model of the device.
2580    pub model: String,
2581    /// Identifies the vendor (not necessarily in a unique manner).
2582    #[serde(rename = "vendorName")]
2583    pub vendor_name: String,
2584    /// Vendor-specific device identifier.
2585    #[serde(rename = "serialNumber")]
2586    #[serde(default, skip_serializing_if = "Option::is_none")]
2587    pub serial_number: Option<String>,
2588    /// The `modem` member.
2589    #[serde(default, skip_serializing_if = "Option::is_none")]
2590    pub modem: Option<Modem>,
2591    /// This contains the firmware version of the Charging Station.
2592    #[serde(rename = "firmwareVersion")]
2593    #[serde(default, skip_serializing_if = "Option::is_none")]
2594    pub firmware_version: Option<String>,
2595    /// The `customData` member.
2596    #[serde(rename = "customData")]
2597    #[serde(default, skip_serializing_if = "Option::is_none")]
2598    pub custom_data: Option<crate::types::CustomData>,
2599}
2600
2601impl ChargingStation {
2602    /// Creates a `ChargingStation` from its required fields.
2603    #[must_use]
2604    pub fn new(model: impl Into<String>, vendor_name: impl Into<String>) -> Self {
2605        Self {
2606            model: model.into(),
2607            vendor_name: vendor_name.into(),
2608            serial_number: None,
2609            modem: None,
2610            firmware_version: None,
2611            custom_data: None,
2612        }
2613    }
2614
2615    /// Sets the optional `serialNumber` field.
2616    #[must_use]
2617    pub fn with_serial_number(mut self, value: impl Into<String>) -> Self {
2618        self.serial_number = Some(value.into());
2619        self
2620    }
2621
2622    /// Sets the optional `modem` field.
2623    #[must_use]
2624    pub fn with_modem(mut self, value: Modem) -> Self {
2625        self.modem = Some(value);
2626        self
2627    }
2628
2629    /// Sets the optional `firmwareVersion` field.
2630    #[must_use]
2631    pub fn with_firmware_version(mut self, value: impl Into<String>) -> Self {
2632        self.firmware_version = Some(value.into());
2633        self
2634    }
2635
2636    /// Sets the optional `customData` field.
2637    #[must_use]
2638    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2639        self.custom_data = Some(value);
2640        self
2641    }
2642}
2643
2644impl Validate for ChargingStation {
2645    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2646        path.push_key("model");
2647        validate::string(self.model.as_str(), None, Some(20), path, out);
2648        path.pop();
2649        path.push_key("vendorName");
2650        validate::string(self.vendor_name.as_str(), None, Some(50), path, out);
2651        path.pop();
2652        path.push_key("serialNumber");
2653        if let Some(value) = &self.serial_number {
2654            validate::string(value.as_str(), None, Some(25), path, out);
2655        }
2656        path.pop();
2657        path.push_key("modem");
2658        if let Some(value) = &self.modem {
2659            Validate::validate_at(value, path, out);
2660        }
2661        path.pop();
2662        path.push_key("firmwareVersion");
2663        if let Some(value) = &self.firmware_version {
2664            validate::string(value.as_str(), None, Some(50), path, out);
2665        }
2666        path.pop();
2667        path.push_key("customData");
2668        if let Some(value) = &self.custom_data {
2669            Validate::validate_at(value, path, out);
2670        }
2671        path.pop();
2672    }
2673}
2674
2675/// A ClearChargingProfileType is a filter for charging profiles to be cleared by ClearChargingProfileRequest.
2676///
2677/// The OCPP 2.1 `ClearChargingProfile` data type.
2678#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2679pub struct ClearChargingProfile {
2680    /// 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.
2681    #[serde(rename = "evseId")]
2682    #[serde(default, skip_serializing_if = "Option::is_none")]
2683    pub evse_id: Option<i32>,
2684    /// The `chargingProfilePurpose` member.
2685    #[serde(rename = "chargingProfilePurpose")]
2686    #[serde(default, skip_serializing_if = "Option::is_none")]
2687    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
2688    /// Specifies the stackLevel for which charging profiles will be cleared, if they meet the other criteria in the request.
2689    #[serde(rename = "stackLevel")]
2690    #[serde(default, skip_serializing_if = "Option::is_none")]
2691    pub stack_level: Option<i32>,
2692    /// The `customData` member.
2693    #[serde(rename = "customData")]
2694    #[serde(default, skip_serializing_if = "Option::is_none")]
2695    pub custom_data: Option<crate::types::CustomData>,
2696}
2697
2698impl ClearChargingProfile {
2699    /// Creates an empty `ClearChargingProfile`. Every field of this type is optional.
2700    #[must_use]
2701    pub fn new() -> Self {
2702        Self::default()
2703    }
2704
2705    /// Sets the optional `evseId` field.
2706    #[must_use]
2707    pub fn with_evse_id(mut self, value: i32) -> Self {
2708        self.evse_id = Some(value);
2709        self
2710    }
2711
2712    /// Sets the optional `chargingProfilePurpose` field.
2713    #[must_use]
2714    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
2715        self.charging_profile_purpose = Some(value);
2716        self
2717    }
2718
2719    /// Sets the optional `stackLevel` field.
2720    #[must_use]
2721    pub fn with_stack_level(mut self, value: i32) -> Self {
2722        self.stack_level = Some(value);
2723        self
2724    }
2725
2726    /// Sets the optional `customData` field.
2727    #[must_use]
2728    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2729        self.custom_data = Some(value);
2730        self
2731    }
2732}
2733
2734impl Validate for ClearChargingProfile {
2735    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2736        path.push_key("evseId");
2737        if let Some(value) = &self.evse_id {
2738            validate::int_range(i64::from(*value), Some(0), None, path, out);
2739        }
2740        path.pop();
2741        path.push_key("chargingProfilePurpose");
2742        if let Some(value) = &self.charging_profile_purpose {
2743            Validate::validate_at(value, path, out);
2744        }
2745        path.pop();
2746        path.push_key("stackLevel");
2747        if let Some(value) = &self.stack_level {
2748            validate::int_range(i64::from(*value), Some(0), None, path, out);
2749        }
2750        path.pop();
2751        path.push_key("customData");
2752        if let Some(value) = &self.custom_data {
2753            Validate::validate_at(value, path, out);
2754        }
2755        path.pop();
2756    }
2757}
2758
2759/// The OCPP 2.1 `ClearMonitoringResult` data type.
2760#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2761pub struct ClearMonitoringResult {
2762    /// The `status` member.
2763    pub status: ClearMonitoringStatus,
2764    /// Id of the monitor of which a clear was requested.
2765    pub id: i32,
2766    /// The `statusInfo` member.
2767    #[serde(rename = "statusInfo")]
2768    #[serde(default, skip_serializing_if = "Option::is_none")]
2769    pub status_info: Option<StatusInfo>,
2770    /// The `customData` member.
2771    #[serde(rename = "customData")]
2772    #[serde(default, skip_serializing_if = "Option::is_none")]
2773    pub custom_data: Option<crate::types::CustomData>,
2774}
2775
2776impl ClearMonitoringResult {
2777    /// Creates a `ClearMonitoringResult` from its required fields.
2778    #[must_use]
2779    pub fn new(status: ClearMonitoringStatus, id: i32) -> Self {
2780        Self {
2781            status,
2782            id,
2783            status_info: None,
2784            custom_data: None,
2785        }
2786    }
2787
2788    /// Sets the optional `statusInfo` field.
2789    #[must_use]
2790    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2791        self.status_info = Some(value);
2792        self
2793    }
2794
2795    /// Sets the optional `customData` field.
2796    #[must_use]
2797    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2798        self.custom_data = Some(value);
2799        self
2800    }
2801}
2802
2803impl Validate for ClearMonitoringResult {
2804    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2805        path.push_key("status");
2806        Validate::validate_at(&self.status, path, out);
2807        path.pop();
2808        path.push_key("id");
2809        validate::int_range(i64::from(self.id), Some(0), None, path, out);
2810        path.pop();
2811        path.push_key("statusInfo");
2812        if let Some(value) = &self.status_info {
2813            Validate::validate_at(value, path, out);
2814        }
2815        path.pop();
2816        path.push_key("customData");
2817        if let Some(value) = &self.custom_data {
2818            Validate::validate_at(value, path, out);
2819        }
2820        path.pop();
2821    }
2822}
2823
2824/// The OCPP 2.1 `ClearTariffsResult` data type.
2825#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2826pub struct ClearTariffsResult {
2827    /// The `status` member.
2828    pub status: TariffClearStatus,
2829    /// The `statusInfo` member.
2830    #[serde(rename = "statusInfo")]
2831    #[serde(default, skip_serializing_if = "Option::is_none")]
2832    pub status_info: Option<StatusInfo>,
2833    /// Id of tariff for which _status_ is reported. If no tariffs were found, then this field is absent, and _status_ will be `NoTariff`.
2834    #[serde(rename = "tariffId")]
2835    #[serde(default, skip_serializing_if = "Option::is_none")]
2836    pub tariff_id: Option<String>,
2837    /// The `customData` member.
2838    #[serde(rename = "customData")]
2839    #[serde(default, skip_serializing_if = "Option::is_none")]
2840    pub custom_data: Option<crate::types::CustomData>,
2841}
2842
2843impl ClearTariffsResult {
2844    /// Creates a `ClearTariffsResult` from its required fields.
2845    #[must_use]
2846    pub fn new(status: TariffClearStatus) -> Self {
2847        Self {
2848            status,
2849            status_info: None,
2850            tariff_id: None,
2851            custom_data: None,
2852        }
2853    }
2854
2855    /// Sets the optional `statusInfo` field.
2856    #[must_use]
2857    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2858        self.status_info = Some(value);
2859        self
2860    }
2861
2862    /// Sets the optional `tariffId` field.
2863    #[must_use]
2864    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
2865        self.tariff_id = Some(value.into());
2866        self
2867    }
2868
2869    /// Sets the optional `customData` field.
2870    #[must_use]
2871    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2872        self.custom_data = Some(value);
2873        self
2874    }
2875}
2876
2877impl Validate for ClearTariffsResult {
2878    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2879        path.push_key("status");
2880        Validate::validate_at(&self.status, path, out);
2881        path.pop();
2882        path.push_key("statusInfo");
2883        if let Some(value) = &self.status_info {
2884            Validate::validate_at(value, path, out);
2885        }
2886        path.pop();
2887        path.push_key("tariffId");
2888        if let Some(value) = &self.tariff_id {
2889            validate::string(value.as_str(), None, Some(60), path, out);
2890        }
2891        path.pop();
2892        path.push_key("customData");
2893        if let Some(value) = &self.custom_data {
2894            Validate::validate_at(value, path, out);
2895        }
2896        path.pop();
2897    }
2898}
2899
2900/// A physical or logical component
2901///
2902/// The OCPP 2.1 `Component` data type.
2903#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2904pub struct Component {
2905    /// 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.
2906    pub name: String,
2907    /// The `evse` member.
2908    #[serde(default, skip_serializing_if = "Option::is_none")]
2909    pub evse: Option<EVSE>,
2910    /// Name of instance in case the component exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
2911    #[serde(default, skip_serializing_if = "Option::is_none")]
2912    pub instance: Option<String>,
2913    /// The `customData` member.
2914    #[serde(rename = "customData")]
2915    #[serde(default, skip_serializing_if = "Option::is_none")]
2916    pub custom_data: Option<crate::types::CustomData>,
2917}
2918
2919impl Component {
2920    /// Creates a `Component` from its required fields.
2921    #[must_use]
2922    pub fn new(name: impl Into<String>) -> Self {
2923        Self {
2924            name: name.into(),
2925            evse: None,
2926            instance: None,
2927            custom_data: None,
2928        }
2929    }
2930
2931    /// Sets the optional `evse` field.
2932    #[must_use]
2933    pub fn with_evse(mut self, value: EVSE) -> Self {
2934        self.evse = Some(value);
2935        self
2936    }
2937
2938    /// Sets the optional `instance` field.
2939    #[must_use]
2940    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
2941        self.instance = Some(value.into());
2942        self
2943    }
2944
2945    /// Sets the optional `customData` field.
2946    #[must_use]
2947    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2948        self.custom_data = Some(value);
2949        self
2950    }
2951}
2952
2953impl Validate for Component {
2954    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2955        path.push_key("name");
2956        validate::string(self.name.as_str(), None, Some(50), path, out);
2957        path.pop();
2958        path.push_key("evse");
2959        if let Some(value) = &self.evse {
2960            Validate::validate_at(value, path, out);
2961        }
2962        path.pop();
2963        path.push_key("instance");
2964        if let Some(value) = &self.instance {
2965            validate::string(value.as_str(), None, Some(50), path, out);
2966        }
2967        path.pop();
2968        path.push_key("customData");
2969        if let Some(value) = &self.custom_data {
2970            Validate::validate_at(value, path, out);
2971        }
2972        path.pop();
2973    }
2974}
2975
2976/// Class to report components, variables and variable attributes and characteristics.
2977///
2978/// The OCPP 2.1 `ComponentVariable` data type.
2979#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2980pub struct ComponentVariable {
2981    /// The `component` member.
2982    pub component: Component,
2983    /// The `variable` member.
2984    #[serde(default, skip_serializing_if = "Option::is_none")]
2985    pub variable: Option<Variable>,
2986    /// The `customData` member.
2987    #[serde(rename = "customData")]
2988    #[serde(default, skip_serializing_if = "Option::is_none")]
2989    pub custom_data: Option<crate::types::CustomData>,
2990}
2991
2992impl ComponentVariable {
2993    /// Creates a `ComponentVariable` from its required fields.
2994    #[must_use]
2995    pub fn new(component: Component) -> Self {
2996        Self {
2997            component,
2998            variable: None,
2999            custom_data: None,
3000        }
3001    }
3002
3003    /// Sets the optional `variable` field.
3004    #[must_use]
3005    pub fn with_variable(mut self, value: Variable) -> Self {
3006        self.variable = Some(value);
3007        self
3008    }
3009
3010    /// Sets the optional `customData` field.
3011    #[must_use]
3012    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3013        self.custom_data = Some(value);
3014        self
3015    }
3016}
3017
3018impl Validate for ComponentVariable {
3019    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3020        path.push_key("component");
3021        Validate::validate_at(&self.component, path, out);
3022        path.pop();
3023        path.push_key("variable");
3024        if let Some(value) = &self.variable {
3025            Validate::validate_at(value, path, out);
3026        }
3027        path.pop();
3028        path.push_key("customData");
3029        if let Some(value) = &self.custom_data {
3030            Validate::validate_at(value, path, out);
3031        }
3032        path.pop();
3033    }
3034}
3035
3036/// The OCPP 2.1 `CompositeSchedule` data type.
3037#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3038pub struct CompositeSchedule {
3039    /// The `evseId` member.
3040    #[serde(rename = "evseId")]
3041    pub evse_id: i32,
3042    /// The `duration` member.
3043    pub duration: i32,
3044    /// The `scheduleStart` member.
3045    #[serde(rename = "scheduleStart")]
3046    pub schedule_start: crate::types::DateTime,
3047    /// The `chargingRateUnit` member.
3048    #[serde(rename = "chargingRateUnit")]
3049    pub charging_rate_unit: ChargingRateUnit,
3050    /// The `chargingSchedulePeriod` member.
3051    #[serde(rename = "chargingSchedulePeriod")]
3052    pub charging_schedule_period: Vec<ChargingSchedulePeriod>,
3053    /// The `customData` member.
3054    #[serde(rename = "customData")]
3055    #[serde(default, skip_serializing_if = "Option::is_none")]
3056    pub custom_data: Option<crate::types::CustomData>,
3057}
3058
3059impl CompositeSchedule {
3060    /// Creates a `CompositeSchedule` from its required fields.
3061    #[must_use]
3062    pub fn new(
3063        evse_id: i32,
3064        duration: i32,
3065        schedule_start: impl Into<crate::types::DateTime>,
3066        charging_rate_unit: ChargingRateUnit,
3067        charging_schedule_period: Vec<ChargingSchedulePeriod>,
3068    ) -> Self {
3069        Self {
3070            evse_id,
3071            duration,
3072            schedule_start: schedule_start.into(),
3073            charging_rate_unit,
3074            charging_schedule_period,
3075            custom_data: None,
3076        }
3077    }
3078
3079    /// Sets the optional `customData` field.
3080    #[must_use]
3081    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3082        self.custom_data = Some(value);
3083        self
3084    }
3085}
3086
3087impl Validate for CompositeSchedule {
3088    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3089        path.push_key("evseId");
3090        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
3091        path.pop();
3092        path.push_key("chargingRateUnit");
3093        Validate::validate_at(&self.charging_rate_unit, path, out);
3094        path.pop();
3095        path.push_key("chargingSchedulePeriod");
3096        validate::list_len(
3097            self.charging_schedule_period.len(),
3098            Some(1),
3099            None,
3100            path,
3101            out,
3102        );
3103        for (index, item) in self.charging_schedule_period.iter().enumerate() {
3104            path.push_index(index);
3105            Validate::validate_at(item, path, out);
3106            path.pop();
3107        }
3108        path.pop();
3109        path.push_key("customData");
3110        if let Some(value) = &self.custom_data {
3111            Validate::validate_at(value, path, out);
3112        }
3113        path.pop();
3114    }
3115}
3116
3117/// The OCPP 2.1 `ConstantStreamData` data type.
3118#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3119pub struct ConstantStreamData {
3120    /// Uniquely identifies the stream
3121    pub id: i32,
3122    /// The `params` member.
3123    pub params: PeriodicEventStreamParams,
3124    /// Id of monitor used to report his event. It can be a preconfigured or hardwired monitor.
3125    #[serde(rename = "variableMonitoringId")]
3126    pub variable_monitoring_id: i32,
3127    /// The `customData` member.
3128    #[serde(rename = "customData")]
3129    #[serde(default, skip_serializing_if = "Option::is_none")]
3130    pub custom_data: Option<crate::types::CustomData>,
3131}
3132
3133impl ConstantStreamData {
3134    /// Creates a `ConstantStreamData` from its required fields.
3135    #[must_use]
3136    pub fn new(id: i32, params: PeriodicEventStreamParams, variable_monitoring_id: i32) -> Self {
3137        Self {
3138            id,
3139            params,
3140            variable_monitoring_id,
3141            custom_data: None,
3142        }
3143    }
3144
3145    /// Sets the optional `customData` field.
3146    #[must_use]
3147    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3148        self.custom_data = Some(value);
3149        self
3150    }
3151}
3152
3153impl Validate for ConstantStreamData {
3154    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3155        path.push_key("id");
3156        validate::int_range(i64::from(self.id), Some(0), None, path, out);
3157        path.pop();
3158        path.push_key("params");
3159        Validate::validate_at(&self.params, path, out);
3160        path.pop();
3161        path.push_key("variableMonitoringId");
3162        validate::int_range(
3163            i64::from(self.variable_monitoring_id),
3164            Some(0),
3165            None,
3166            path,
3167            out,
3168        );
3169        path.pop();
3170        path.push_key("customData");
3171        if let Some(value) = &self.custom_data {
3172            Validate::validate_at(value, path, out);
3173        }
3174        path.pop();
3175    }
3176}
3177
3178/// The OCPP 2.1 `ConsumptionCost` data type.
3179#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3180pub struct ConsumptionCost {
3181    /// 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.
3182    #[serde(rename = "startValue")]
3183    pub start_value: crate::types::Decimal,
3184    /// The `cost` member.
3185    pub cost: Vec<Cost>,
3186    /// The `customData` member.
3187    #[serde(rename = "customData")]
3188    #[serde(default, skip_serializing_if = "Option::is_none")]
3189    pub custom_data: Option<crate::types::CustomData>,
3190}
3191
3192impl ConsumptionCost {
3193    /// Creates a `ConsumptionCost` from its required fields.
3194    #[must_use]
3195    pub fn new(start_value: impl Into<crate::types::Decimal>, cost: Vec<Cost>) -> Self {
3196        Self {
3197            start_value: start_value.into(),
3198            cost,
3199            custom_data: None,
3200        }
3201    }
3202
3203    /// Sets the optional `customData` field.
3204    #[must_use]
3205    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3206        self.custom_data = Some(value);
3207        self
3208    }
3209}
3210
3211impl Validate for ConsumptionCost {
3212    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3213        path.push_key("cost");
3214        validate::list_len(self.cost.len(), Some(1), Some(3), path, out);
3215        for (index, item) in self.cost.iter().enumerate() {
3216            path.push_index(index);
3217            Validate::validate_at(item, path, out);
3218            path.pop();
3219        }
3220        path.pop();
3221        path.push_key("customData");
3222        if let Some(value) = &self.custom_data {
3223            Validate::validate_at(value, path, out);
3224        }
3225        path.pop();
3226    }
3227}
3228
3229/// The OCPP 2.1 `Cost` data type.
3230#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3231pub struct Cost {
3232    /// The `costKind` member.
3233    #[serde(rename = "costKind")]
3234    pub cost_kind: CostKind,
3235    /// The estimated or actual cost per kWh
3236    pub amount: i32,
3237    /// Values: -3..3, The amountMultiplier defines the exponent to base 10 (dec). The final value is determined by: amount * 10 ^ amountMultiplier
3238    #[serde(rename = "amountMultiplier")]
3239    #[serde(default, skip_serializing_if = "Option::is_none")]
3240    pub amount_multiplier: Option<i32>,
3241    /// The `customData` member.
3242    #[serde(rename = "customData")]
3243    #[serde(default, skip_serializing_if = "Option::is_none")]
3244    pub custom_data: Option<crate::types::CustomData>,
3245}
3246
3247impl Cost {
3248    /// Creates a `Cost` from its required fields.
3249    #[must_use]
3250    pub fn new(cost_kind: CostKind, amount: i32) -> Self {
3251        Self {
3252            cost_kind,
3253            amount,
3254            amount_multiplier: None,
3255            custom_data: None,
3256        }
3257    }
3258
3259    /// Sets the optional `amountMultiplier` field.
3260    #[must_use]
3261    pub fn with_amount_multiplier(mut self, value: i32) -> Self {
3262        self.amount_multiplier = Some(value);
3263        self
3264    }
3265
3266    /// Sets the optional `customData` field.
3267    #[must_use]
3268    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3269        self.custom_data = Some(value);
3270        self
3271    }
3272}
3273
3274impl Validate for Cost {
3275    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3276        path.push_key("costKind");
3277        Validate::validate_at(&self.cost_kind, path, out);
3278        path.pop();
3279        path.push_key("customData");
3280        if let Some(value) = &self.custom_data {
3281            Validate::validate_at(value, path, out);
3282        }
3283        path.pop();
3284    }
3285}
3286
3287/// CostDetailsType contains the cost as calculated by Charging Station based on provided TariffType.
3288///
3289/// NOTE: Reservation is not shown as a _chargingPeriod_, because it took place outside of the transaction.
3290///
3291/// The OCPP 2.1 `CostDetails` data type.
3292#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3293pub struct CostDetails {
3294    /// The `totalCost` member.
3295    #[serde(rename = "totalCost")]
3296    pub total_cost: TotalCost,
3297    /// The `totalUsage` member.
3298    #[serde(rename = "totalUsage")]
3299    pub total_usage: TotalUsage,
3300    /// The `chargingPeriods` member.
3301    #[serde(rename = "chargingPeriods")]
3302    #[serde(default, skip_serializing_if = "Option::is_none")]
3303    pub charging_periods: Option<Vec<ChargingPeriod>>,
3304    /// If set to true, then Charging Station has failed to calculate the cost.
3305    #[serde(rename = "failureToCalculate")]
3306    #[serde(default, skip_serializing_if = "Option::is_none")]
3307    pub failure_to_calculate: Option<bool>,
3308    /// Optional human-readable reason text in case of failure to calculate.
3309    #[serde(rename = "failureReason")]
3310    #[serde(default, skip_serializing_if = "Option::is_none")]
3311    pub failure_reason: Option<String>,
3312    /// The `customData` member.
3313    #[serde(rename = "customData")]
3314    #[serde(default, skip_serializing_if = "Option::is_none")]
3315    pub custom_data: Option<crate::types::CustomData>,
3316}
3317
3318impl CostDetails {
3319    /// Creates a `CostDetails` from its required fields.
3320    #[must_use]
3321    pub fn new(total_cost: TotalCost, total_usage: TotalUsage) -> Self {
3322        Self {
3323            total_cost,
3324            total_usage,
3325            charging_periods: None,
3326            failure_to_calculate: None,
3327            failure_reason: None,
3328            custom_data: None,
3329        }
3330    }
3331
3332    /// Sets the optional `chargingPeriods` field.
3333    #[must_use]
3334    pub fn with_charging_periods(mut self, value: Vec<ChargingPeriod>) -> Self {
3335        self.charging_periods = Some(value);
3336        self
3337    }
3338
3339    /// Sets the optional `failureToCalculate` field.
3340    #[must_use]
3341    pub fn with_failure_to_calculate(mut self, value: bool) -> Self {
3342        self.failure_to_calculate = Some(value);
3343        self
3344    }
3345
3346    /// Sets the optional `failureReason` field.
3347    #[must_use]
3348    pub fn with_failure_reason(mut self, value: impl Into<String>) -> Self {
3349        self.failure_reason = Some(value.into());
3350        self
3351    }
3352
3353    /// Sets the optional `customData` field.
3354    #[must_use]
3355    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3356        self.custom_data = Some(value);
3357        self
3358    }
3359}
3360
3361impl Validate for CostDetails {
3362    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3363        path.push_key("totalCost");
3364        Validate::validate_at(&self.total_cost, path, out);
3365        path.pop();
3366        path.push_key("totalUsage");
3367        Validate::validate_at(&self.total_usage, path, out);
3368        path.pop();
3369        path.push_key("chargingPeriods");
3370        if let Some(value) = &self.charging_periods {
3371            validate::list_len(value.len(), Some(1), None, path, out);
3372            for (index, item) in value.iter().enumerate() {
3373                path.push_index(index);
3374                Validate::validate_at(item, path, out);
3375                path.pop();
3376            }
3377        }
3378        path.pop();
3379        path.push_key("failureReason");
3380        if let Some(value) = &self.failure_reason {
3381            validate::string(value.as_str(), None, Some(500), path, out);
3382        }
3383        path.pop();
3384        path.push_key("customData");
3385        if let Some(value) = &self.custom_data {
3386            Validate::validate_at(value, path, out);
3387        }
3388        path.pop();
3389    }
3390}
3391
3392/// Volume consumed of cost dimension.
3393///
3394/// The OCPP 2.1 `CostDimension` data type.
3395#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3396pub struct CostDimension {
3397    /// The `type` member.
3398    pub r#type: CostDimensionEnum,
3399    /// Volume of the dimension consumed, measured according to the dimension type.
3400    pub volume: crate::types::Decimal,
3401    /// The `customData` member.
3402    #[serde(rename = "customData")]
3403    #[serde(default, skip_serializing_if = "Option::is_none")]
3404    pub custom_data: Option<crate::types::CustomData>,
3405}
3406
3407impl CostDimension {
3408    /// Creates a `CostDimension` from its required fields.
3409    #[must_use]
3410    pub fn new(r#type: CostDimensionEnum, volume: impl Into<crate::types::Decimal>) -> Self {
3411        Self {
3412            r#type,
3413            volume: volume.into(),
3414            custom_data: None,
3415        }
3416    }
3417
3418    /// Sets the optional `customData` field.
3419    #[must_use]
3420    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3421        self.custom_data = Some(value);
3422        self
3423    }
3424}
3425
3426impl Validate for CostDimension {
3427    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3428        path.push_key("type");
3429        Validate::validate_at(&self.r#type, path, out);
3430        path.pop();
3431        path.push_key("customData");
3432        if let Some(value) = &self.custom_data {
3433            Validate::validate_at(value, path, out);
3434        }
3435        path.pop();
3436    }
3437}
3438
3439/// EV DC charging parameters for ISO 15118-2
3440///
3441/// The OCPP 2.1 `DCChargingParameters` data type.
3442#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3443pub struct DCChargingParameters {
3444    /// Maximum current (in A) supported by the electric vehicle. Includes cable capacity.
3445    /// Relates to: +
3446    /// *ISO 15118-2*: DC_EVChargeParameterType:EVMaximumCurrentLimit
3447    #[serde(rename = "evMaxCurrent")]
3448    pub ev_max_current: crate::types::Decimal,
3449    /// Maximum voltage supported by the electric vehicle.
3450    /// Relates to: +
3451    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumVoltageLimit
3452    #[serde(rename = "evMaxVoltage")]
3453    pub ev_max_voltage: crate::types::Decimal,
3454    /// Maximum power (in W) supported by the electric vehicle. Required for DC charging.
3455    /// Relates to: +
3456    /// *ISO 15118-2*: DC_EVChargeParameterType: EVMaximumPowerLimit
3457    #[serde(rename = "evMaxPower")]
3458    #[serde(default, skip_serializing_if = "Option::is_none")]
3459    pub ev_max_power: Option<crate::types::Decimal>,
3460    /// Capacity of the electric vehicle battery (in Wh).
3461    /// Relates to: +
3462    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyCapacity
3463    #[serde(rename = "evEnergyCapacity")]
3464    #[serde(default, skip_serializing_if = "Option::is_none")]
3465    pub ev_energy_capacity: Option<crate::types::Decimal>,
3466    /// Amount of energy requested (in Wh). This inludes energy required for preconditioning.
3467    /// Relates to: +
3468    /// *ISO 15118-2*: DC_EVChargeParameterType: EVEnergyRequest
3469    #[serde(rename = "energyAmount")]
3470    #[serde(default, skip_serializing_if = "Option::is_none")]
3471    pub energy_amount: Option<crate::types::Decimal>,
3472    /// Energy available in the battery (in percent of the battery capacity)
3473    /// Relates to: +
3474    /// *ISO 15118-2*: DC_EVChargeParameterType: DC_EVStatus: EVRESSSOC
3475    #[serde(rename = "stateOfCharge")]
3476    #[serde(default, skip_serializing_if = "Option::is_none")]
3477    pub state_of_charge: Option<i32>,
3478    /// Percentage of SoC at which the EV considers the battery fully charged. (possible values: 0 - 100)
3479    /// Relates to: +
3480    /// *ISO 15118-2*: DC_EVChargeParameterType: FullSOC
3481    #[serde(rename = "fullSoC")]
3482    #[serde(default, skip_serializing_if = "Option::is_none")]
3483    pub full_so_c: Option<i32>,
3484    /// Percentage of SoC at which the EV considers a fast charging process to end. (possible values: 0 - 100)
3485    /// Relates to: +
3486    /// *ISO 15118-2*: DC_EVChargeParameterType: BulkSOC
3487    #[serde(rename = "bulkSoC")]
3488    #[serde(default, skip_serializing_if = "Option::is_none")]
3489    pub bulk_so_c: Option<i32>,
3490    /// The `customData` member.
3491    #[serde(rename = "customData")]
3492    #[serde(default, skip_serializing_if = "Option::is_none")]
3493    pub custom_data: Option<crate::types::CustomData>,
3494}
3495
3496impl DCChargingParameters {
3497    /// Creates a `DCChargingParameters` from its required fields.
3498    #[must_use]
3499    pub fn new(
3500        ev_max_current: impl Into<crate::types::Decimal>,
3501        ev_max_voltage: impl Into<crate::types::Decimal>,
3502    ) -> Self {
3503        Self {
3504            ev_max_current: ev_max_current.into(),
3505            ev_max_voltage: ev_max_voltage.into(),
3506            ev_max_power: None,
3507            ev_energy_capacity: None,
3508            energy_amount: None,
3509            state_of_charge: None,
3510            full_so_c: None,
3511            bulk_so_c: None,
3512            custom_data: None,
3513        }
3514    }
3515
3516    /// Sets the optional `evMaxPower` field.
3517    #[must_use]
3518    pub fn with_ev_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3519        self.ev_max_power = Some(value.into());
3520        self
3521    }
3522
3523    /// Sets the optional `evEnergyCapacity` field.
3524    #[must_use]
3525    pub fn with_ev_energy_capacity(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3526        self.ev_energy_capacity = Some(value.into());
3527        self
3528    }
3529
3530    /// Sets the optional `energyAmount` field.
3531    #[must_use]
3532    pub fn with_energy_amount(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3533        self.energy_amount = Some(value.into());
3534        self
3535    }
3536
3537    /// Sets the optional `stateOfCharge` field.
3538    #[must_use]
3539    pub fn with_state_of_charge(mut self, value: i32) -> Self {
3540        self.state_of_charge = Some(value);
3541        self
3542    }
3543
3544    /// Sets the optional `fullSoC` field.
3545    #[must_use]
3546    pub fn with_full_so_c(mut self, value: i32) -> Self {
3547        self.full_so_c = Some(value);
3548        self
3549    }
3550
3551    /// Sets the optional `bulkSoC` field.
3552    #[must_use]
3553    pub fn with_bulk_so_c(mut self, value: i32) -> Self {
3554        self.bulk_so_c = Some(value);
3555        self
3556    }
3557
3558    /// Sets the optional `customData` field.
3559    #[must_use]
3560    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3561        self.custom_data = Some(value);
3562        self
3563    }
3564}
3565
3566impl Validate for DCChargingParameters {
3567    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3568        path.push_key("stateOfCharge");
3569        if let Some(value) = &self.state_of_charge {
3570            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3571        }
3572        path.pop();
3573        path.push_key("fullSoC");
3574        if let Some(value) = &self.full_so_c {
3575            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3576        }
3577        path.pop();
3578        path.push_key("bulkSoC");
3579        if let Some(value) = &self.bulk_so_c {
3580            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
3581        }
3582        path.pop();
3583        path.push_key("customData");
3584        if let Some(value) = &self.custom_data {
3585            Validate::validate_at(value, path, out);
3586        }
3587        path.pop();
3588    }
3589}
3590
3591/// *(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.
3592///
3593/// Fields starting with "ev" contain values from the EV.
3594/// Other fields contain a value that is supported by both EV and EVSE.
3595///
3596/// DERChargingParametersType type is only relevant in case of an ISO 15118-20 AC_BPT_DER/AC_DER charging session.
3597///
3598/// NOTE: All these fields have values greater or equal to zero (i.e. are non-negative)
3599///
3600/// The OCPP 2.1 `DERChargingParameters` data type.
3601#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3602pub struct DERChargingParameters {
3603    /// DER control functions supported by EV. +
3604    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType:DERControlFunctions (bitmap)
3605    #[serde(rename = "evSupportedDERControl")]
3606    #[serde(default, skip_serializing_if = "Option::is_none")]
3607    pub ev_supported_der_control: Option<Vec<DERControl>>,
3608    /// Rated maximum injected active power by EV, at specified over-excited power factor (overExcitedPowerFactor). +
3609    /// 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. +
3610    /// Corresponds to the WOvPF attribute in IEC 61850. +
3611    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedMaximumDischargePower
3612    #[serde(rename = "evOverExcitedMaxDischargePower")]
3613    #[serde(default, skip_serializing_if = "Option::is_none")]
3614    pub ev_over_excited_max_discharge_power: Option<crate::types::Decimal>,
3615    /// EV power factor when injecting (over excited) the minimum reactive power. +
3616    /// Corresponds to the OvPF attribute in IEC 61850. +
3617    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVOverExcitedPowerFactor
3618    #[serde(rename = "evOverExcitedPowerFactor")]
3619    #[serde(default, skip_serializing_if = "Option::is_none")]
3620    pub ev_over_excited_power_factor: Option<crate::types::Decimal>,
3621    /// Rated maximum injected active power by EV supported at specified under-excited power factor (EVUnderExcitedPowerFactor). +
3622    /// It can also be defined as the rated maximum dischargePower at the rated minimum absorbed reactive power value.
3623    /// 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. +
3624    /// This corresponds to the WUnPF attribute in the IEC 61850. +
3625    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedMaximumDischargePower
3626    #[serde(rename = "evUnderExcitedMaxDischargePower")]
3627    #[serde(default, skip_serializing_if = "Option::is_none")]
3628    pub ev_under_excited_max_discharge_power: Option<crate::types::Decimal>,
3629    /// EV power factor when injecting (under excited) the minimum reactive power. +
3630    /// Corresponds to the OvPF attribute in IEC 61850. +
3631    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVUnderExcitedPowerFactor
3632    #[serde(rename = "evUnderExcitedPowerFactor")]
3633    #[serde(default, skip_serializing_if = "Option::is_none")]
3634    pub ev_under_excited_power_factor: Option<crate::types::Decimal>,
3635    /// Rated maximum total apparent power, defined by min(EV, EVSE) in va.
3636    /// Corresponds to the VAMaxRtg in IEC 61850. +
3637    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumApparentPower
3638    #[serde(rename = "maxApparentPower")]
3639    #[serde(default, skip_serializing_if = "Option::is_none")]
3640    pub max_apparent_power: Option<crate::types::Decimal>,
3641    /// Rated maximum absorbed apparent power, defined by min(EV, EVSE) in va. +
3642    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3643    ///     in which case this field represents phase L1. +
3644    ///     Corresponds to the ChaVAMaxRtg in IEC 61850. +
3645    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower
3646    #[serde(rename = "maxChargeApparentPower")]
3647    #[serde(default, skip_serializing_if = "Option::is_none")]
3648    pub max_charge_apparent_power: Option<crate::types::Decimal>,
3649    /// Rated maximum absorbed apparent power on phase L2, defined by min(EV, EVSE) in va.
3650    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3651    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L2
3652    #[serde(rename = "maxChargeApparentPower_L2")]
3653    #[serde(default, skip_serializing_if = "Option::is_none")]
3654    pub max_charge_apparent_power_l2: Option<crate::types::Decimal>,
3655    /// Rated maximum absorbed apparent power on phase L3, defined by min(EV, EVSE) in va.
3656    /// Corresponds to the ChaVAMaxRtg in IEC 61850. +
3657    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeApparentPower_L3
3658    #[serde(rename = "maxChargeApparentPower_L3")]
3659    #[serde(default, skip_serializing_if = "Option::is_none")]
3660    pub max_charge_apparent_power_l3: Option<crate::types::Decimal>,
3661    /// Rated maximum injected apparent power, defined by min(EV, EVSE) in va. +
3662    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3663    ///     in which case this field represents phase L1. +
3664    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3665    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower
3666    #[serde(rename = "maxDischargeApparentPower")]
3667    #[serde(default, skip_serializing_if = "Option::is_none")]
3668    pub max_discharge_apparent_power: Option<crate::types::Decimal>,
3669    /// Rated maximum injected apparent power on phase L2, defined by min(EV, EVSE) in va. +
3670    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3671    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L2
3672    #[serde(rename = "maxDischargeApparentPower_L2")]
3673    #[serde(default, skip_serializing_if = "Option::is_none")]
3674    pub max_discharge_apparent_power_l2: Option<crate::types::Decimal>,
3675    /// Rated maximum injected apparent power on phase L3, defined by min(EV, EVSE) in va. +
3676    ///     Corresponds to the DisVAMaxRtg in IEC 61850. +
3677    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeApparentPower_L3
3678    #[serde(rename = "maxDischargeApparentPower_L3")]
3679    #[serde(default, skip_serializing_if = "Option::is_none")]
3680    pub max_discharge_apparent_power_l3: Option<crate::types::Decimal>,
3681    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars. +
3682    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3683    ///     in which case this field represents phase L1. +
3684    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3685    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower
3686    #[serde(rename = "maxChargeReactivePower")]
3687    #[serde(default, skip_serializing_if = "Option::is_none")]
3688    pub max_charge_reactive_power: Option<crate::types::Decimal>,
3689    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3690    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3691    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L2
3692    #[serde(rename = "maxChargeReactivePower_L2")]
3693    #[serde(default, skip_serializing_if = "Option::is_none")]
3694    pub max_charge_reactive_power_l2: Option<crate::types::Decimal>,
3695    /// Rated maximum absorbed reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3696    /// Corresponds to the AvarMax attribute in the IEC 61850. +
3697    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumChargeReactivePower_L3
3698    #[serde(rename = "maxChargeReactivePower_L3")]
3699    #[serde(default, skip_serializing_if = "Option::is_none")]
3700    pub max_charge_reactive_power_l3: Option<crate::types::Decimal>,
3701    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars. +
3702    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3703    ///     in which case this field represents phase L1. +
3704    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower
3705    #[serde(rename = "minChargeReactivePower")]
3706    #[serde(default, skip_serializing_if = "Option::is_none")]
3707    pub min_charge_reactive_power: Option<crate::types::Decimal>,
3708    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L2. +
3709    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L2
3710    #[serde(rename = "minChargeReactivePower_L2")]
3711    #[serde(default, skip_serializing_if = "Option::is_none")]
3712    pub min_charge_reactive_power_l2: Option<crate::types::Decimal>,
3713    /// Rated minimum absorbed reactive power, defined by max(EV, EVSE), in vars on phase L3. +
3714    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumChargeReactivePower_L3
3715    #[serde(rename = "minChargeReactivePower_L3")]
3716    #[serde(default, skip_serializing_if = "Option::is_none")]
3717    pub min_charge_reactive_power_l3: Option<crate::types::Decimal>,
3718    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars. +
3719    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3720    ///     in which case this field represents phase L1. +
3721    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3722    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower
3723    #[serde(rename = "maxDischargeReactivePower")]
3724    #[serde(default, skip_serializing_if = "Option::is_none")]
3725    pub max_discharge_reactive_power: Option<crate::types::Decimal>,
3726    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L2. +
3727    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3728    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L2
3729    #[serde(rename = "maxDischargeReactivePower_L2")]
3730    #[serde(default, skip_serializing_if = "Option::is_none")]
3731    pub max_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3732    /// Rated maximum injected reactive power, defined by min(EV, EVSE), in vars on phase L3. +
3733    /// Corresponds to the IvarMax attribute in the IEC 61850. +
3734    ///     *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumDischargeReactivePower_L3
3735    #[serde(rename = "maxDischargeReactivePower_L3")]
3736    #[serde(default, skip_serializing_if = "Option::is_none")]
3737    pub max_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3738    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in vars. +
3739    ///     This field represents the sum of all phases, unless values are provided for L2 and L3,
3740    ///     in which case this field represents phase L1. +
3741    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower
3742    #[serde(rename = "minDischargeReactivePower")]
3743    #[serde(default, skip_serializing_if = "Option::is_none")]
3744    pub min_discharge_reactive_power: Option<crate::types::Decimal>,
3745    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L2. +
3746    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L2
3747    #[serde(rename = "minDischargeReactivePower_L2")]
3748    #[serde(default, skip_serializing_if = "Option::is_none")]
3749    pub min_discharge_reactive_power_l2: Option<crate::types::Decimal>,
3750    /// Rated minimum injected reactive power, defined by max(EV, EVSE), in var on phase L3. +
3751    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumDischargeReactivePower_L3
3752    #[serde(rename = "minDischargeReactivePower_L3")]
3753    #[serde(default, skip_serializing_if = "Option::is_none")]
3754    pub min_discharge_reactive_power_l3: Option<crate::types::Decimal>,
3755    /// Line voltage supported by EVSE and EV.
3756    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltage
3757    #[serde(rename = "nominalVoltage")]
3758    #[serde(default, skip_serializing_if = "Option::is_none")]
3759    pub nominal_voltage: Option<crate::types::Decimal>,
3760    /// The nominal AC voltage (rms) offset between the Charging Station's electrical connection point and the utility’s point of common coupling. +
3761    ///         *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVNominalVoltageOffset
3762    #[serde(rename = "nominalVoltageOffset")]
3763    #[serde(default, skip_serializing_if = "Option::is_none")]
3764    pub nominal_voltage_offset: Option<crate::types::Decimal>,
3765    /// Maximum AC rms voltage, as defined by min(EV, EVSE)  to operate with. +
3766    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumNominalVoltage
3767    #[serde(rename = "maxNominalVoltage")]
3768    #[serde(default, skip_serializing_if = "Option::is_none")]
3769    pub max_nominal_voltage: Option<crate::types::Decimal>,
3770    /// Minimum AC rms voltage, as defined by max(EV, EVSE)  to operate with. +
3771    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMinimumNominalVoltage
3772    #[serde(rename = "minNominalVoltage")]
3773    #[serde(default, skip_serializing_if = "Option::is_none")]
3774    pub min_nominal_voltage: Option<crate::types::Decimal>,
3775    /// Manufacturer of the EV inverter. +
3776    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterManufacturer
3777    #[serde(rename = "evInverterManufacturer")]
3778    #[serde(default, skip_serializing_if = "Option::is_none")]
3779    pub ev_inverter_manufacturer: Option<String>,
3780    /// Model name of the EV inverter. +
3781    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterModel
3782    #[serde(rename = "evInverterModel")]
3783    #[serde(default, skip_serializing_if = "Option::is_none")]
3784    pub ev_inverter_model: Option<String>,
3785    /// Serial number of the EV inverter. +
3786    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSerialNumber
3787    #[serde(rename = "evInverterSerialNumber")]
3788    #[serde(default, skip_serializing_if = "Option::is_none")]
3789    pub ev_inverter_serial_number: Option<String>,
3790    /// Software version of EV inverter. +
3791    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterSwVersion
3792    #[serde(rename = "evInverterSwVersion")]
3793    #[serde(default, skip_serializing_if = "Option::is_none")]
3794    pub ev_inverter_sw_version: Option<String>,
3795    /// Hardware version of EV inverter. +
3796    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVInverterHwVersion
3797    #[serde(rename = "evInverterHwVersion")]
3798    #[serde(default, skip_serializing_if = "Option::is_none")]
3799    pub ev_inverter_hw_version: Option<String>,
3800    /// Type of islanding detection method. Only mandatory when islanding detection is required at the site, as set in the ISO 15118 Service Details configuration. +
3801    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingDetectionMethod
3802    #[serde(rename = "evIslandingDetectionMethod")]
3803    #[serde(default, skip_serializing_if = "Option::is_none")]
3804    pub ev_islanding_detection_method: Option<Vec<IslandingDetection>>,
3805    /// Time after which EV will trip if an island has been detected. +
3806    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVIslandingTripTime
3807    #[serde(rename = "evIslandingTripTime")]
3808    #[serde(default, skip_serializing_if = "Option::is_none")]
3809    pub ev_islanding_trip_time: Option<crate::types::Decimal>,
3810    /// Maximum injected DC current allowed at level 1 charging. +
3811    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel1DCInjection
3812    #[serde(rename = "evMaximumLevel1DCInjection")]
3813    #[serde(default, skip_serializing_if = "Option::is_none")]
3814    pub ev_maximum_level1_dc_injection: Option<crate::types::Decimal>,
3815    /// Maximum allowed duration of DC injection at level 1 charging. +
3816    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel1DCInjection
3817    #[serde(rename = "evDurationLevel1DCInjection")]
3818    #[serde(default, skip_serializing_if = "Option::is_none")]
3819    pub ev_duration_level1_dc_injection: Option<crate::types::Decimal>,
3820    /// Maximum injected DC current allowed at level 2 charging. +
3821    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVMaximumLevel2DCInjection
3822    #[serde(rename = "evMaximumLevel2DCInjection")]
3823    #[serde(default, skip_serializing_if = "Option::is_none")]
3824    pub ev_maximum_level2_dc_injection: Option<crate::types::Decimal>,
3825    /// Maximum allowed duration of DC injection at level 2 charging. +
3826    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVDurationLevel2DCInjection
3827    #[serde(rename = "evDurationLevel2DCInjection")]
3828    #[serde(default, skip_serializing_if = "Option::is_none")]
3829    pub ev_duration_level2_dc_injection: Option<crate::types::Decimal>,
3830    ///     Measure of the susceptibility of the circuit to reactance, in Siemens (S). +
3831    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVReactiveSusceptance
3832    #[serde(rename = "evReactiveSusceptance")]
3833    #[serde(default, skip_serializing_if = "Option::is_none")]
3834    pub ev_reactive_susceptance: Option<crate::types::Decimal>,
3835    /// 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.
3836    ///        *ISO 15118-20*: DER_BPT_AC_CPDReqEnergyTransferModeType: EVSessionTotalDischargeEnergyAvailable
3837    #[serde(rename = "evSessionTotalDischargeEnergyAvailable")]
3838    #[serde(default, skip_serializing_if = "Option::is_none")]
3839    pub ev_session_total_discharge_energy_available: Option<crate::types::Decimal>,
3840    /// The `customData` member.
3841    #[serde(rename = "customData")]
3842    #[serde(default, skip_serializing_if = "Option::is_none")]
3843    pub custom_data: Option<crate::types::CustomData>,
3844}
3845
3846impl DERChargingParameters {
3847    /// Creates an empty `DERChargingParameters`. Every field of this type is optional.
3848    #[must_use]
3849    pub fn new() -> Self {
3850        Self::default()
3851    }
3852
3853    /// Sets the optional `evSupportedDERControl` field.
3854    #[must_use]
3855    pub fn with_ev_supported_der_control(mut self, value: Vec<DERControl>) -> Self {
3856        self.ev_supported_der_control = Some(value);
3857        self
3858    }
3859
3860    /// Sets the optional `evOverExcitedMaxDischargePower` field.
3861    #[must_use]
3862    pub fn with_ev_over_excited_max_discharge_power(
3863        mut self,
3864        value: impl Into<crate::types::Decimal>,
3865    ) -> Self {
3866        self.ev_over_excited_max_discharge_power = Some(value.into());
3867        self
3868    }
3869
3870    /// Sets the optional `evOverExcitedPowerFactor` field.
3871    #[must_use]
3872    pub fn with_ev_over_excited_power_factor(
3873        mut self,
3874        value: impl Into<crate::types::Decimal>,
3875    ) -> Self {
3876        self.ev_over_excited_power_factor = Some(value.into());
3877        self
3878    }
3879
3880    /// Sets the optional `evUnderExcitedMaxDischargePower` field.
3881    #[must_use]
3882    pub fn with_ev_under_excited_max_discharge_power(
3883        mut self,
3884        value: impl Into<crate::types::Decimal>,
3885    ) -> Self {
3886        self.ev_under_excited_max_discharge_power = Some(value.into());
3887        self
3888    }
3889
3890    /// Sets the optional `evUnderExcitedPowerFactor` field.
3891    #[must_use]
3892    pub fn with_ev_under_excited_power_factor(
3893        mut self,
3894        value: impl Into<crate::types::Decimal>,
3895    ) -> Self {
3896        self.ev_under_excited_power_factor = Some(value.into());
3897        self
3898    }
3899
3900    /// Sets the optional `maxApparentPower` field.
3901    #[must_use]
3902    pub fn with_max_apparent_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
3903        self.max_apparent_power = Some(value.into());
3904        self
3905    }
3906
3907    /// Sets the optional `maxChargeApparentPower` field.
3908    #[must_use]
3909    pub fn with_max_charge_apparent_power(
3910        mut self,
3911        value: impl Into<crate::types::Decimal>,
3912    ) -> Self {
3913        self.max_charge_apparent_power = Some(value.into());
3914        self
3915    }
3916
3917    /// Sets the optional `maxChargeApparentPower_L2` field.
3918    #[must_use]
3919    pub fn with_max_charge_apparent_power_l2(
3920        mut self,
3921        value: impl Into<crate::types::Decimal>,
3922    ) -> Self {
3923        self.max_charge_apparent_power_l2 = Some(value.into());
3924        self
3925    }
3926
3927    /// Sets the optional `maxChargeApparentPower_L3` field.
3928    #[must_use]
3929    pub fn with_max_charge_apparent_power_l3(
3930        mut self,
3931        value: impl Into<crate::types::Decimal>,
3932    ) -> Self {
3933        self.max_charge_apparent_power_l3 = Some(value.into());
3934        self
3935    }
3936
3937    /// Sets the optional `maxDischargeApparentPower` field.
3938    #[must_use]
3939    pub fn with_max_discharge_apparent_power(
3940        mut self,
3941        value: impl Into<crate::types::Decimal>,
3942    ) -> Self {
3943        self.max_discharge_apparent_power = Some(value.into());
3944        self
3945    }
3946
3947    /// Sets the optional `maxDischargeApparentPower_L2` field.
3948    #[must_use]
3949    pub fn with_max_discharge_apparent_power_l2(
3950        mut self,
3951        value: impl Into<crate::types::Decimal>,
3952    ) -> Self {
3953        self.max_discharge_apparent_power_l2 = Some(value.into());
3954        self
3955    }
3956
3957    /// Sets the optional `maxDischargeApparentPower_L3` field.
3958    #[must_use]
3959    pub fn with_max_discharge_apparent_power_l3(
3960        mut self,
3961        value: impl Into<crate::types::Decimal>,
3962    ) -> Self {
3963        self.max_discharge_apparent_power_l3 = Some(value.into());
3964        self
3965    }
3966
3967    /// Sets the optional `maxChargeReactivePower` field.
3968    #[must_use]
3969    pub fn with_max_charge_reactive_power(
3970        mut self,
3971        value: impl Into<crate::types::Decimal>,
3972    ) -> Self {
3973        self.max_charge_reactive_power = Some(value.into());
3974        self
3975    }
3976
3977    /// Sets the optional `maxChargeReactivePower_L2` field.
3978    #[must_use]
3979    pub fn with_max_charge_reactive_power_l2(
3980        mut self,
3981        value: impl Into<crate::types::Decimal>,
3982    ) -> Self {
3983        self.max_charge_reactive_power_l2 = Some(value.into());
3984        self
3985    }
3986
3987    /// Sets the optional `maxChargeReactivePower_L3` field.
3988    #[must_use]
3989    pub fn with_max_charge_reactive_power_l3(
3990        mut self,
3991        value: impl Into<crate::types::Decimal>,
3992    ) -> Self {
3993        self.max_charge_reactive_power_l3 = Some(value.into());
3994        self
3995    }
3996
3997    /// Sets the optional `minChargeReactivePower` field.
3998    #[must_use]
3999    pub fn with_min_charge_reactive_power(
4000        mut self,
4001        value: impl Into<crate::types::Decimal>,
4002    ) -> Self {
4003        self.min_charge_reactive_power = Some(value.into());
4004        self
4005    }
4006
4007    /// Sets the optional `minChargeReactivePower_L2` field.
4008    #[must_use]
4009    pub fn with_min_charge_reactive_power_l2(
4010        mut self,
4011        value: impl Into<crate::types::Decimal>,
4012    ) -> Self {
4013        self.min_charge_reactive_power_l2 = Some(value.into());
4014        self
4015    }
4016
4017    /// Sets the optional `minChargeReactivePower_L3` field.
4018    #[must_use]
4019    pub fn with_min_charge_reactive_power_l3(
4020        mut self,
4021        value: impl Into<crate::types::Decimal>,
4022    ) -> Self {
4023        self.min_charge_reactive_power_l3 = Some(value.into());
4024        self
4025    }
4026
4027    /// Sets the optional `maxDischargeReactivePower` field.
4028    #[must_use]
4029    pub fn with_max_discharge_reactive_power(
4030        mut self,
4031        value: impl Into<crate::types::Decimal>,
4032    ) -> Self {
4033        self.max_discharge_reactive_power = Some(value.into());
4034        self
4035    }
4036
4037    /// Sets the optional `maxDischargeReactivePower_L2` field.
4038    #[must_use]
4039    pub fn with_max_discharge_reactive_power_l2(
4040        mut self,
4041        value: impl Into<crate::types::Decimal>,
4042    ) -> Self {
4043        self.max_discharge_reactive_power_l2 = Some(value.into());
4044        self
4045    }
4046
4047    /// Sets the optional `maxDischargeReactivePower_L3` field.
4048    #[must_use]
4049    pub fn with_max_discharge_reactive_power_l3(
4050        mut self,
4051        value: impl Into<crate::types::Decimal>,
4052    ) -> Self {
4053        self.max_discharge_reactive_power_l3 = Some(value.into());
4054        self
4055    }
4056
4057    /// Sets the optional `minDischargeReactivePower` field.
4058    #[must_use]
4059    pub fn with_min_discharge_reactive_power(
4060        mut self,
4061        value: impl Into<crate::types::Decimal>,
4062    ) -> Self {
4063        self.min_discharge_reactive_power = Some(value.into());
4064        self
4065    }
4066
4067    /// Sets the optional `minDischargeReactivePower_L2` field.
4068    #[must_use]
4069    pub fn with_min_discharge_reactive_power_l2(
4070        mut self,
4071        value: impl Into<crate::types::Decimal>,
4072    ) -> Self {
4073        self.min_discharge_reactive_power_l2 = Some(value.into());
4074        self
4075    }
4076
4077    /// Sets the optional `minDischargeReactivePower_L3` field.
4078    #[must_use]
4079    pub fn with_min_discharge_reactive_power_l3(
4080        mut self,
4081        value: impl Into<crate::types::Decimal>,
4082    ) -> Self {
4083        self.min_discharge_reactive_power_l3 = Some(value.into());
4084        self
4085    }
4086
4087    /// Sets the optional `nominalVoltage` field.
4088    #[must_use]
4089    pub fn with_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4090        self.nominal_voltage = Some(value.into());
4091        self
4092    }
4093
4094    /// Sets the optional `nominalVoltageOffset` field.
4095    #[must_use]
4096    pub fn with_nominal_voltage_offset(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4097        self.nominal_voltage_offset = Some(value.into());
4098        self
4099    }
4100
4101    /// Sets the optional `maxNominalVoltage` field.
4102    #[must_use]
4103    pub fn with_max_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4104        self.max_nominal_voltage = Some(value.into());
4105        self
4106    }
4107
4108    /// Sets the optional `minNominalVoltage` field.
4109    #[must_use]
4110    pub fn with_min_nominal_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4111        self.min_nominal_voltage = Some(value.into());
4112        self
4113    }
4114
4115    /// Sets the optional `evInverterManufacturer` field.
4116    #[must_use]
4117    pub fn with_ev_inverter_manufacturer(mut self, value: impl Into<String>) -> Self {
4118        self.ev_inverter_manufacturer = Some(value.into());
4119        self
4120    }
4121
4122    /// Sets the optional `evInverterModel` field.
4123    #[must_use]
4124    pub fn with_ev_inverter_model(mut self, value: impl Into<String>) -> Self {
4125        self.ev_inverter_model = Some(value.into());
4126        self
4127    }
4128
4129    /// Sets the optional `evInverterSerialNumber` field.
4130    #[must_use]
4131    pub fn with_ev_inverter_serial_number(mut self, value: impl Into<String>) -> Self {
4132        self.ev_inverter_serial_number = Some(value.into());
4133        self
4134    }
4135
4136    /// Sets the optional `evInverterSwVersion` field.
4137    #[must_use]
4138    pub fn with_ev_inverter_sw_version(mut self, value: impl Into<String>) -> Self {
4139        self.ev_inverter_sw_version = Some(value.into());
4140        self
4141    }
4142
4143    /// Sets the optional `evInverterHwVersion` field.
4144    #[must_use]
4145    pub fn with_ev_inverter_hw_version(mut self, value: impl Into<String>) -> Self {
4146        self.ev_inverter_hw_version = Some(value.into());
4147        self
4148    }
4149
4150    /// Sets the optional `evIslandingDetectionMethod` field.
4151    #[must_use]
4152    pub fn with_ev_islanding_detection_method(mut self, value: Vec<IslandingDetection>) -> Self {
4153        self.ev_islanding_detection_method = Some(value);
4154        self
4155    }
4156
4157    /// Sets the optional `evIslandingTripTime` field.
4158    #[must_use]
4159    pub fn with_ev_islanding_trip_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4160        self.ev_islanding_trip_time = Some(value.into());
4161        self
4162    }
4163
4164    /// Sets the optional `evMaximumLevel1DCInjection` field.
4165    #[must_use]
4166    pub fn with_ev_maximum_level1_dc_injection(
4167        mut self,
4168        value: impl Into<crate::types::Decimal>,
4169    ) -> Self {
4170        self.ev_maximum_level1_dc_injection = Some(value.into());
4171        self
4172    }
4173
4174    /// Sets the optional `evDurationLevel1DCInjection` field.
4175    #[must_use]
4176    pub fn with_ev_duration_level1_dc_injection(
4177        mut self,
4178        value: impl Into<crate::types::Decimal>,
4179    ) -> Self {
4180        self.ev_duration_level1_dc_injection = Some(value.into());
4181        self
4182    }
4183
4184    /// Sets the optional `evMaximumLevel2DCInjection` field.
4185    #[must_use]
4186    pub fn with_ev_maximum_level2_dc_injection(
4187        mut self,
4188        value: impl Into<crate::types::Decimal>,
4189    ) -> Self {
4190        self.ev_maximum_level2_dc_injection = Some(value.into());
4191        self
4192    }
4193
4194    /// Sets the optional `evDurationLevel2DCInjection` field.
4195    #[must_use]
4196    pub fn with_ev_duration_level2_dc_injection(
4197        mut self,
4198        value: impl Into<crate::types::Decimal>,
4199    ) -> Self {
4200        self.ev_duration_level2_dc_injection = Some(value.into());
4201        self
4202    }
4203
4204    /// Sets the optional `evReactiveSusceptance` field.
4205    #[must_use]
4206    pub fn with_ev_reactive_susceptance(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4207        self.ev_reactive_susceptance = Some(value.into());
4208        self
4209    }
4210
4211    /// Sets the optional `evSessionTotalDischargeEnergyAvailable` field.
4212    #[must_use]
4213    pub fn with_ev_session_total_discharge_energy_available(
4214        mut self,
4215        value: impl Into<crate::types::Decimal>,
4216    ) -> Self {
4217        self.ev_session_total_discharge_energy_available = Some(value.into());
4218        self
4219    }
4220
4221    /// Sets the optional `customData` field.
4222    #[must_use]
4223    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4224        self.custom_data = Some(value);
4225        self
4226    }
4227}
4228
4229impl Validate for DERChargingParameters {
4230    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4231        path.push_key("evSupportedDERControl");
4232        if let Some(value) = &self.ev_supported_der_control {
4233            validate::list_len(value.len(), Some(1), None, path, out);
4234            for (index, item) in value.iter().enumerate() {
4235                path.push_index(index);
4236                Validate::validate_at(item, path, out);
4237                path.pop();
4238            }
4239        }
4240        path.pop();
4241        path.push_key("evInverterManufacturer");
4242        if let Some(value) = &self.ev_inverter_manufacturer {
4243            validate::string(value.as_str(), None, Some(50), path, out);
4244        }
4245        path.pop();
4246        path.push_key("evInverterModel");
4247        if let Some(value) = &self.ev_inverter_model {
4248            validate::string(value.as_str(), None, Some(50), path, out);
4249        }
4250        path.pop();
4251        path.push_key("evInverterSerialNumber");
4252        if let Some(value) = &self.ev_inverter_serial_number {
4253            validate::string(value.as_str(), None, Some(50), path, out);
4254        }
4255        path.pop();
4256        path.push_key("evInverterSwVersion");
4257        if let Some(value) = &self.ev_inverter_sw_version {
4258            validate::string(value.as_str(), None, Some(50), path, out);
4259        }
4260        path.pop();
4261        path.push_key("evInverterHwVersion");
4262        if let Some(value) = &self.ev_inverter_hw_version {
4263            validate::string(value.as_str(), None, Some(50), path, out);
4264        }
4265        path.pop();
4266        path.push_key("evIslandingDetectionMethod");
4267        if let Some(value) = &self.ev_islanding_detection_method {
4268            validate::list_len(value.len(), Some(1), None, path, out);
4269            for (index, item) in value.iter().enumerate() {
4270                path.push_index(index);
4271                Validate::validate_at(item, path, out);
4272                path.pop();
4273            }
4274        }
4275        path.pop();
4276        path.push_key("customData");
4277        if let Some(value) = &self.custom_data {
4278            Validate::validate_at(value, path, out);
4279        }
4280        path.pop();
4281    }
4282}
4283
4284/// The OCPP 2.1 `DERCurve` data type.
4285#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4286pub struct DERCurve {
4287    /// The `curveData` member.
4288    #[serde(rename = "curveData")]
4289    pub curve_data: Vec<DERCurvePoints>,
4290    /// Priority of curve (0=highest)
4291    pub priority: i32,
4292    /// The `yUnit` member.
4293    #[serde(rename = "yUnit")]
4294    pub y_unit: DERUnit,
4295    /// The `hysteresis` member.
4296    #[serde(default, skip_serializing_if = "Option::is_none")]
4297    pub hysteresis: Option<Hysteresis>,
4298    /// The `reactivePowerParams` member.
4299    #[serde(rename = "reactivePowerParams")]
4300    #[serde(default, skip_serializing_if = "Option::is_none")]
4301    pub reactive_power_params: Option<ReactivePowerParams>,
4302    /// The `voltageParams` member.
4303    #[serde(rename = "voltageParams")]
4304    #[serde(default, skip_serializing_if = "Option::is_none")]
4305    pub voltage_params: Option<VoltageParams>,
4306    /// 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.
4307    #[serde(rename = "responseTime")]
4308    #[serde(default, skip_serializing_if = "Option::is_none")]
4309    pub response_time: Option<crate::types::Decimal>,
4310    /// Point in time when this curve will become activated. Only absent when _default_ is true.
4311    #[serde(rename = "startTime")]
4312    #[serde(default, skip_serializing_if = "Option::is_none")]
4313    pub start_time: Option<crate::types::DateTime>,
4314    /// Duration in seconds that this curve will be active. Only absent when _default_ is true.
4315    #[serde(default, skip_serializing_if = "Option::is_none")]
4316    pub duration: Option<crate::types::Decimal>,
4317    /// The `customData` member.
4318    #[serde(rename = "customData")]
4319    #[serde(default, skip_serializing_if = "Option::is_none")]
4320    pub custom_data: Option<crate::types::CustomData>,
4321}
4322
4323impl DERCurve {
4324    /// Creates a `DERCurve` from its required fields.
4325    #[must_use]
4326    pub fn new(curve_data: Vec<DERCurvePoints>, priority: i32, y_unit: DERUnit) -> Self {
4327        Self {
4328            curve_data,
4329            priority,
4330            y_unit,
4331            hysteresis: None,
4332            reactive_power_params: None,
4333            voltage_params: None,
4334            response_time: None,
4335            start_time: None,
4336            duration: None,
4337            custom_data: None,
4338        }
4339    }
4340
4341    /// Sets the optional `hysteresis` field.
4342    #[must_use]
4343    pub fn with_hysteresis(mut self, value: Hysteresis) -> Self {
4344        self.hysteresis = Some(value);
4345        self
4346    }
4347
4348    /// Sets the optional `reactivePowerParams` field.
4349    #[must_use]
4350    pub fn with_reactive_power_params(mut self, value: ReactivePowerParams) -> Self {
4351        self.reactive_power_params = Some(value);
4352        self
4353    }
4354
4355    /// Sets the optional `voltageParams` field.
4356    #[must_use]
4357    pub fn with_voltage_params(mut self, value: VoltageParams) -> Self {
4358        self.voltage_params = Some(value);
4359        self
4360    }
4361
4362    /// Sets the optional `responseTime` field.
4363    #[must_use]
4364    pub fn with_response_time(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4365        self.response_time = Some(value.into());
4366        self
4367    }
4368
4369    /// Sets the optional `startTime` field.
4370    #[must_use]
4371    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
4372        self.start_time = Some(value.into());
4373        self
4374    }
4375
4376    /// Sets the optional `duration` field.
4377    #[must_use]
4378    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
4379        self.duration = Some(value.into());
4380        self
4381    }
4382
4383    /// Sets the optional `customData` field.
4384    #[must_use]
4385    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4386        self.custom_data = Some(value);
4387        self
4388    }
4389}
4390
4391impl Validate for DERCurve {
4392    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4393        path.push_key("curveData");
4394        validate::list_len(self.curve_data.len(), Some(1), Some(10), path, out);
4395        for (index, item) in self.curve_data.iter().enumerate() {
4396            path.push_index(index);
4397            Validate::validate_at(item, path, out);
4398            path.pop();
4399        }
4400        path.pop();
4401        path.push_key("priority");
4402        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
4403        path.pop();
4404        path.push_key("yUnit");
4405        Validate::validate_at(&self.y_unit, path, out);
4406        path.pop();
4407        path.push_key("hysteresis");
4408        if let Some(value) = &self.hysteresis {
4409            Validate::validate_at(value, path, out);
4410        }
4411        path.pop();
4412        path.push_key("reactivePowerParams");
4413        if let Some(value) = &self.reactive_power_params {
4414            Validate::validate_at(value, path, out);
4415        }
4416        path.pop();
4417        path.push_key("voltageParams");
4418        if let Some(value) = &self.voltage_params {
4419            Validate::validate_at(value, path, out);
4420        }
4421        path.pop();
4422        path.push_key("customData");
4423        if let Some(value) = &self.custom_data {
4424            Validate::validate_at(value, path, out);
4425        }
4426        path.pop();
4427    }
4428}
4429
4430/// The OCPP 2.1 `DERCurveGet` data type.
4431#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4432pub struct DERCurveGet {
4433    /// The `curve` member.
4434    pub curve: DERCurve,
4435    /// Id of DER curve
4436    pub id: String,
4437    /// The `curveType` member.
4438    #[serde(rename = "curveType")]
4439    pub curve_type: DERControl,
4440    /// True if this is a default curve
4441    #[serde(rename = "isDefault")]
4442    pub is_default: bool,
4443    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
4444    #[serde(rename = "isSuperseded")]
4445    pub is_superseded: bool,
4446    /// The `customData` member.
4447    #[serde(rename = "customData")]
4448    #[serde(default, skip_serializing_if = "Option::is_none")]
4449    pub custom_data: Option<crate::types::CustomData>,
4450}
4451
4452impl DERCurveGet {
4453    /// Creates a `DERCurveGet` from its required fields.
4454    #[must_use]
4455    pub fn new(
4456        curve: DERCurve,
4457        id: impl Into<String>,
4458        curve_type: DERControl,
4459        is_default: bool,
4460        is_superseded: bool,
4461    ) -> Self {
4462        Self {
4463            curve,
4464            id: id.into(),
4465            curve_type,
4466            is_default,
4467            is_superseded,
4468            custom_data: None,
4469        }
4470    }
4471
4472    /// Sets the optional `customData` field.
4473    #[must_use]
4474    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4475        self.custom_data = Some(value);
4476        self
4477    }
4478}
4479
4480impl Validate for DERCurveGet {
4481    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4482        path.push_key("curve");
4483        Validate::validate_at(&self.curve, path, out);
4484        path.pop();
4485        path.push_key("id");
4486        validate::string(self.id.as_str(), None, Some(36), path, out);
4487        path.pop();
4488        path.push_key("curveType");
4489        Validate::validate_at(&self.curve_type, path, out);
4490        path.pop();
4491        path.push_key("customData");
4492        if let Some(value) = &self.custom_data {
4493            Validate::validate_at(value, path, out);
4494        }
4495        path.pop();
4496    }
4497}
4498
4499/// The OCPP 2.1 `DERCurvePoints` data type.
4500#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4501pub struct DERCurvePoints {
4502    /// The data value of the X-axis (independent) variable, depending on the curve type.
4503    pub x: crate::types::Decimal,
4504    /// 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).
4505    pub y: crate::types::Decimal,
4506    /// The `customData` member.
4507    #[serde(rename = "customData")]
4508    #[serde(default, skip_serializing_if = "Option::is_none")]
4509    pub custom_data: Option<crate::types::CustomData>,
4510}
4511
4512impl DERCurvePoints {
4513    /// Creates a `DERCurvePoints` from its required fields.
4514    #[must_use]
4515    pub fn new(x: impl Into<crate::types::Decimal>, y: impl Into<crate::types::Decimal>) -> Self {
4516        Self {
4517            x: x.into(),
4518            y: y.into(),
4519            custom_data: None,
4520        }
4521    }
4522
4523    /// Sets the optional `customData` field.
4524    #[must_use]
4525    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4526        self.custom_data = Some(value);
4527        self
4528    }
4529}
4530
4531impl Validate for DERCurvePoints {
4532    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4533        path.push_key("customData");
4534        if let Some(value) = &self.custom_data {
4535            Validate::validate_at(value, path, out);
4536        }
4537        path.pop();
4538    }
4539}
4540
4541/// *(2.1)* Price schedule of EV energy offer.
4542///
4543/// The OCPP 2.1 `EVAbsolutePriceSchedule` data type.
4544#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4545pub struct EVAbsolutePriceSchedule {
4546    /// Starting point in time of the EVEnergyOffer.
4547    #[serde(rename = "timeAnchor")]
4548    pub time_anchor: crate::types::DateTime,
4549    /// Currency code according to ISO 4217.
4550    pub currency: String,
4551    /// The `evAbsolutePriceScheduleEntries` member.
4552    #[serde(rename = "evAbsolutePriceScheduleEntries")]
4553    pub ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4554    /// ISO 15118-20 URN of price algorithm: Power, PeakPower, StackedEnergy.
4555    #[serde(rename = "priceAlgorithm")]
4556    pub price_algorithm: String,
4557    /// The `customData` member.
4558    #[serde(rename = "customData")]
4559    #[serde(default, skip_serializing_if = "Option::is_none")]
4560    pub custom_data: Option<crate::types::CustomData>,
4561}
4562
4563impl EVAbsolutePriceSchedule {
4564    /// Creates a `EVAbsolutePriceSchedule` from its required fields.
4565    #[must_use]
4566    pub fn new(
4567        time_anchor: impl Into<crate::types::DateTime>,
4568        currency: impl Into<String>,
4569        ev_absolute_price_schedule_entries: Vec<EVAbsolutePriceScheduleEntry>,
4570        price_algorithm: impl Into<String>,
4571    ) -> Self {
4572        Self {
4573            time_anchor: time_anchor.into(),
4574            currency: currency.into(),
4575            ev_absolute_price_schedule_entries,
4576            price_algorithm: price_algorithm.into(),
4577            custom_data: None,
4578        }
4579    }
4580
4581    /// Sets the optional `customData` field.
4582    #[must_use]
4583    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4584        self.custom_data = Some(value);
4585        self
4586    }
4587}
4588
4589impl Validate for EVAbsolutePriceSchedule {
4590    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4591        path.push_key("currency");
4592        validate::string(self.currency.as_str(), None, Some(3), path, out);
4593        path.pop();
4594        path.push_key("evAbsolutePriceScheduleEntries");
4595        validate::list_len(
4596            self.ev_absolute_price_schedule_entries.len(),
4597            Some(1),
4598            Some(1024),
4599            path,
4600            out,
4601        );
4602        for (index, item) in self.ev_absolute_price_schedule_entries.iter().enumerate() {
4603            path.push_index(index);
4604            Validate::validate_at(item, path, out);
4605            path.pop();
4606        }
4607        path.pop();
4608        path.push_key("priceAlgorithm");
4609        validate::string(self.price_algorithm.as_str(), None, Some(2000), path, out);
4610        path.pop();
4611        path.push_key("customData");
4612        if let Some(value) = &self.custom_data {
4613            Validate::validate_at(value, path, out);
4614        }
4615        path.pop();
4616    }
4617}
4618
4619/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4620///
4621/// The OCPP 2.1 `EVAbsolutePriceScheduleEntry` data type.
4622#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4623pub struct EVAbsolutePriceScheduleEntry {
4624    /// The amount of seconds of this entry.
4625    pub duration: i32,
4626    /// The `evPriceRule` member.
4627    #[serde(rename = "evPriceRule")]
4628    pub ev_price_rule: Vec<EVPriceRule>,
4629    /// The `customData` member.
4630    #[serde(rename = "customData")]
4631    #[serde(default, skip_serializing_if = "Option::is_none")]
4632    pub custom_data: Option<crate::types::CustomData>,
4633}
4634
4635impl EVAbsolutePriceScheduleEntry {
4636    /// Creates a `EVAbsolutePriceScheduleEntry` from its required fields.
4637    #[must_use]
4638    pub fn new(duration: i32, ev_price_rule: Vec<EVPriceRule>) -> Self {
4639        Self {
4640            duration,
4641            ev_price_rule,
4642            custom_data: None,
4643        }
4644    }
4645
4646    /// Sets the optional `customData` field.
4647    #[must_use]
4648    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4649        self.custom_data = Some(value);
4650        self
4651    }
4652}
4653
4654impl Validate for EVAbsolutePriceScheduleEntry {
4655    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4656        path.push_key("evPriceRule");
4657        validate::list_len(self.ev_price_rule.len(), Some(1), Some(8), path, out);
4658        for (index, item) in self.ev_price_rule.iter().enumerate() {
4659            path.push_index(index);
4660            Validate::validate_at(item, path, out);
4661            path.pop();
4662        }
4663        path.pop();
4664        path.push_key("customData");
4665        if let Some(value) = &self.custom_data {
4666            Validate::validate_at(value, path, out);
4667        }
4668        path.pop();
4669    }
4670}
4671
4672/// *(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.
4673///
4674/// The OCPP 2.1 `EVEnergyOffer` data type.
4675#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4676pub struct EVEnergyOffer {
4677    /// The `evPowerSchedule` member.
4678    #[serde(rename = "evPowerSchedule")]
4679    pub ev_power_schedule: EVPowerSchedule,
4680    /// The `evAbsolutePriceSchedule` member.
4681    #[serde(rename = "evAbsolutePriceSchedule")]
4682    #[serde(default, skip_serializing_if = "Option::is_none")]
4683    pub ev_absolute_price_schedule: Option<EVAbsolutePriceSchedule>,
4684    /// The `customData` member.
4685    #[serde(rename = "customData")]
4686    #[serde(default, skip_serializing_if = "Option::is_none")]
4687    pub custom_data: Option<crate::types::CustomData>,
4688}
4689
4690impl EVEnergyOffer {
4691    /// Creates a `EVEnergyOffer` from its required fields.
4692    #[must_use]
4693    pub fn new(ev_power_schedule: EVPowerSchedule) -> Self {
4694        Self {
4695            ev_power_schedule,
4696            ev_absolute_price_schedule: None,
4697            custom_data: None,
4698        }
4699    }
4700
4701    /// Sets the optional `evAbsolutePriceSchedule` field.
4702    #[must_use]
4703    pub fn with_ev_absolute_price_schedule(mut self, value: EVAbsolutePriceSchedule) -> Self {
4704        self.ev_absolute_price_schedule = Some(value);
4705        self
4706    }
4707
4708    /// Sets the optional `customData` field.
4709    #[must_use]
4710    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4711        self.custom_data = Some(value);
4712        self
4713    }
4714}
4715
4716impl Validate for EVEnergyOffer {
4717    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4718        path.push_key("evPowerSchedule");
4719        Validate::validate_at(&self.ev_power_schedule, path, out);
4720        path.pop();
4721        path.push_key("evAbsolutePriceSchedule");
4722        if let Some(value) = &self.ev_absolute_price_schedule {
4723            Validate::validate_at(value, path, out);
4724        }
4725        path.pop();
4726        path.push_key("customData");
4727        if let Some(value) = &self.custom_data {
4728            Validate::validate_at(value, path, out);
4729        }
4730        path.pop();
4731    }
4732}
4733
4734/// *(2.1)* Schedule of EV energy offer.
4735///
4736/// The OCPP 2.1 `EVPowerSchedule` data type.
4737#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4738pub struct EVPowerSchedule {
4739    /// The `evPowerScheduleEntries` member.
4740    #[serde(rename = "evPowerScheduleEntries")]
4741    pub ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4742    /// The time that defines the starting point for the EVEnergyOffer.
4743    #[serde(rename = "timeAnchor")]
4744    pub time_anchor: crate::types::DateTime,
4745    /// The `customData` member.
4746    #[serde(rename = "customData")]
4747    #[serde(default, skip_serializing_if = "Option::is_none")]
4748    pub custom_data: Option<crate::types::CustomData>,
4749}
4750
4751impl EVPowerSchedule {
4752    /// Creates a `EVPowerSchedule` from its required fields.
4753    #[must_use]
4754    pub fn new(
4755        ev_power_schedule_entries: Vec<EVPowerScheduleEntry>,
4756        time_anchor: impl Into<crate::types::DateTime>,
4757    ) -> Self {
4758        Self {
4759            ev_power_schedule_entries,
4760            time_anchor: time_anchor.into(),
4761            custom_data: None,
4762        }
4763    }
4764
4765    /// Sets the optional `customData` field.
4766    #[must_use]
4767    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4768        self.custom_data = Some(value);
4769        self
4770    }
4771}
4772
4773impl Validate for EVPowerSchedule {
4774    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4775        path.push_key("evPowerScheduleEntries");
4776        validate::list_len(
4777            self.ev_power_schedule_entries.len(),
4778            Some(1),
4779            Some(1024),
4780            path,
4781            out,
4782        );
4783        for (index, item) in self.ev_power_schedule_entries.iter().enumerate() {
4784            path.push_index(index);
4785            Validate::validate_at(item, path, out);
4786            path.pop();
4787        }
4788        path.pop();
4789        path.push_key("customData");
4790        if let Some(value) = &self.custom_data {
4791            Validate::validate_at(value, path, out);
4792        }
4793        path.pop();
4794    }
4795}
4796
4797/// *(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.
4798///
4799/// The OCPP 2.1 `EVPowerScheduleEntry` data type.
4800#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4801pub struct EVPowerScheduleEntry {
4802    /// The duration of this entry.
4803    pub duration: i32,
4804    /// 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.
4805    pub power: crate::types::Decimal,
4806    /// The `customData` member.
4807    #[serde(rename = "customData")]
4808    #[serde(default, skip_serializing_if = "Option::is_none")]
4809    pub custom_data: Option<crate::types::CustomData>,
4810}
4811
4812impl EVPowerScheduleEntry {
4813    /// Creates a `EVPowerScheduleEntry` from its required fields.
4814    #[must_use]
4815    pub fn new(duration: i32, power: impl Into<crate::types::Decimal>) -> Self {
4816        Self {
4817            duration,
4818            power: power.into(),
4819            custom_data: None,
4820        }
4821    }
4822
4823    /// Sets the optional `customData` field.
4824    #[must_use]
4825    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4826        self.custom_data = Some(value);
4827        self
4828    }
4829}
4830
4831impl Validate for EVPowerScheduleEntry {
4832    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4833        path.push_key("customData");
4834        if let Some(value) = &self.custom_data {
4835            Validate::validate_at(value, path, out);
4836        }
4837        path.pop();
4838    }
4839}
4840
4841/// *(2.1)* An entry in price schedule over time for which EV is willing to discharge.
4842///
4843/// The OCPP 2.1 `EVPriceRule` data type.
4844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4845pub struct EVPriceRule {
4846    /// Cost per kWh.
4847    #[serde(rename = "energyFee")]
4848    pub energy_fee: crate::types::Decimal,
4849    /// 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.
4850    #[serde(rename = "powerRangeStart")]
4851    pub power_range_start: crate::types::Decimal,
4852    /// The `customData` member.
4853    #[serde(rename = "customData")]
4854    #[serde(default, skip_serializing_if = "Option::is_none")]
4855    pub custom_data: Option<crate::types::CustomData>,
4856}
4857
4858impl EVPriceRule {
4859    /// Creates a `EVPriceRule` from its required fields.
4860    #[must_use]
4861    pub fn new(
4862        energy_fee: impl Into<crate::types::Decimal>,
4863        power_range_start: impl Into<crate::types::Decimal>,
4864    ) -> Self {
4865        Self {
4866            energy_fee: energy_fee.into(),
4867            power_range_start: power_range_start.into(),
4868            custom_data: None,
4869        }
4870    }
4871
4872    /// Sets the optional `customData` field.
4873    #[must_use]
4874    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4875        self.custom_data = Some(value);
4876        self
4877    }
4878}
4879
4880impl Validate for EVPriceRule {
4881    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4882        path.push_key("customData");
4883        if let Some(value) = &self.custom_data {
4884            Validate::validate_at(value, path, out);
4885        }
4886        path.pop();
4887    }
4888}
4889
4890/// Electric Vehicle Supply Equipment
4891///
4892/// The OCPP 2.1 `EVSE` data type.
4893#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4894pub struct EVSE {
4895    /// EVSE Identifier. This contains a number (&gt; 0) designating an EVSE of the Charging Station.
4896    pub id: i32,
4897    /// An id to designate a specific connector (on an EVSE) by connector index number.
4898    #[serde(rename = "connectorId")]
4899    #[serde(default, skip_serializing_if = "Option::is_none")]
4900    pub connector_id: Option<i32>,
4901    /// The `customData` member.
4902    #[serde(rename = "customData")]
4903    #[serde(default, skip_serializing_if = "Option::is_none")]
4904    pub custom_data: Option<crate::types::CustomData>,
4905}
4906
4907impl EVSE {
4908    /// Creates a `EVSE` from its required fields.
4909    #[must_use]
4910    pub fn new(id: i32) -> Self {
4911        Self {
4912            id,
4913            connector_id: None,
4914            custom_data: None,
4915        }
4916    }
4917
4918    /// Sets the optional `connectorId` field.
4919    #[must_use]
4920    pub fn with_connector_id(mut self, value: i32) -> Self {
4921        self.connector_id = Some(value);
4922        self
4923    }
4924
4925    /// Sets the optional `customData` field.
4926    #[must_use]
4927    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4928        self.custom_data = Some(value);
4929        self
4930    }
4931}
4932
4933impl Validate for EVSE {
4934    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4935        path.push_key("id");
4936        validate::int_range(i64::from(self.id), Some(0), None, path, out);
4937        path.pop();
4938        path.push_key("connectorId");
4939        if let Some(value) = &self.connector_id {
4940            validate::int_range(i64::from(*value), Some(0), None, path, out);
4941        }
4942        path.pop();
4943        path.push_key("customData");
4944        if let Some(value) = &self.custom_data {
4945            Validate::validate_at(value, path, out);
4946        }
4947        path.pop();
4948    }
4949}
4950
4951/// The OCPP 2.1 `EnterService` data type.
4952#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4953pub struct EnterService {
4954    /// Priority of setting (0=highest)
4955    pub priority: i32,
4956    /// Enter service voltage high
4957    #[serde(rename = "highVoltage")]
4958    pub high_voltage: crate::types::Decimal,
4959    /// Enter service voltage low
4960    #[serde(rename = "lowVoltage")]
4961    pub low_voltage: crate::types::Decimal,
4962    /// Enter service frequency high
4963    #[serde(rename = "highFreq")]
4964    pub high_freq: crate::types::Decimal,
4965    /// Enter service frequency low
4966    #[serde(rename = "lowFreq")]
4967    pub low_freq: crate::types::Decimal,
4968    /// Enter service delay
4969    #[serde(default, skip_serializing_if = "Option::is_none")]
4970    pub delay: Option<crate::types::Decimal>,
4971    /// Enter service randomized delay
4972    #[serde(rename = "randomDelay")]
4973    #[serde(default, skip_serializing_if = "Option::is_none")]
4974    pub random_delay: Option<crate::types::Decimal>,
4975    /// Enter service ramp rate in seconds
4976    #[serde(rename = "rampRate")]
4977    #[serde(default, skip_serializing_if = "Option::is_none")]
4978    pub ramp_rate: Option<crate::types::Decimal>,
4979    /// The `customData` member.
4980    #[serde(rename = "customData")]
4981    #[serde(default, skip_serializing_if = "Option::is_none")]
4982    pub custom_data: Option<crate::types::CustomData>,
4983}
4984
4985impl EnterService {
4986    /// Creates a `EnterService` from its required fields.
4987    #[must_use]
4988    pub fn new(
4989        priority: i32,
4990        high_voltage: impl Into<crate::types::Decimal>,
4991        low_voltage: impl Into<crate::types::Decimal>,
4992        high_freq: impl Into<crate::types::Decimal>,
4993        low_freq: impl Into<crate::types::Decimal>,
4994    ) -> Self {
4995        Self {
4996            priority,
4997            high_voltage: high_voltage.into(),
4998            low_voltage: low_voltage.into(),
4999            high_freq: high_freq.into(),
5000            low_freq: low_freq.into(),
5001            delay: None,
5002            random_delay: None,
5003            ramp_rate: None,
5004            custom_data: None,
5005        }
5006    }
5007
5008    /// Sets the optional `delay` field.
5009    #[must_use]
5010    pub fn with_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5011        self.delay = Some(value.into());
5012        self
5013    }
5014
5015    /// Sets the optional `randomDelay` field.
5016    #[must_use]
5017    pub fn with_random_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5018        self.random_delay = Some(value.into());
5019        self
5020    }
5021
5022    /// Sets the optional `rampRate` field.
5023    #[must_use]
5024    pub fn with_ramp_rate(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5025        self.ramp_rate = Some(value.into());
5026        self
5027    }
5028
5029    /// Sets the optional `customData` field.
5030    #[must_use]
5031    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5032        self.custom_data = Some(value);
5033        self
5034    }
5035}
5036
5037impl Validate for EnterService {
5038    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5039        path.push_key("priority");
5040        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5041        path.pop();
5042        path.push_key("customData");
5043        if let Some(value) = &self.custom_data {
5044            Validate::validate_at(value, path, out);
5045        }
5046        path.pop();
5047    }
5048}
5049
5050/// The OCPP 2.1 `EnterServiceGet` data type.
5051#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5052pub struct EnterServiceGet {
5053    /// The `enterService` member.
5054    #[serde(rename = "enterService")]
5055    pub enter_service: EnterService,
5056    /// Id of setting
5057    pub id: String,
5058    /// The `customData` member.
5059    #[serde(rename = "customData")]
5060    #[serde(default, skip_serializing_if = "Option::is_none")]
5061    pub custom_data: Option<crate::types::CustomData>,
5062}
5063
5064impl EnterServiceGet {
5065    /// Creates a `EnterServiceGet` from its required fields.
5066    #[must_use]
5067    pub fn new(enter_service: EnterService, id: impl Into<String>) -> Self {
5068        Self {
5069            enter_service,
5070            id: id.into(),
5071            custom_data: None,
5072        }
5073    }
5074
5075    /// Sets the optional `customData` field.
5076    #[must_use]
5077    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5078        self.custom_data = Some(value);
5079        self
5080    }
5081}
5082
5083impl Validate for EnterServiceGet {
5084    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5085        path.push_key("enterService");
5086        Validate::validate_at(&self.enter_service, path, out);
5087        path.pop();
5088        path.push_key("id");
5089        validate::string(self.id.as_str(), None, Some(36), path, out);
5090        path.pop();
5091        path.push_key("customData");
5092        if let Some(value) = &self.custom_data {
5093            Validate::validate_at(value, path, out);
5094        }
5095        path.pop();
5096    }
5097}
5098
5099/// Class to report an event notification for a component-variable.
5100///
5101/// The OCPP 2.1 `EventData` data type.
5102#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5103pub struct EventData {
5104    /// Identifies the event. This field can be referred to as a cause by other events.
5105    #[serde(rename = "eventId")]
5106    pub event_id: i32,
5107    /// Timestamp of the moment the report was generated.
5108    pub timestamp: crate::types::DateTime,
5109    /// The `trigger` member.
5110    pub trigger: EventTrigger,
5111    /// Actual value (_attributeType_ Actual) of the variable.
5112    ///
5113    /// 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.
5114    #[serde(rename = "actualValue")]
5115    pub actual_value: String,
5116    /// The `component` member.
5117    pub component: Component,
5118    /// The `eventNotificationType` member.
5119    #[serde(rename = "eventNotificationType")]
5120    pub event_notification_type: EventNotification,
5121    /// The `variable` member.
5122    pub variable: Variable,
5123    /// Refers to the Id of an event that is considered to be the cause for this event.
5124    #[serde(default, skip_serializing_if = "Option::is_none")]
5125    pub cause: Option<i32>,
5126    /// Technical (error) code as reported by component.
5127    #[serde(rename = "techCode")]
5128    #[serde(default, skip_serializing_if = "Option::is_none")]
5129    pub tech_code: Option<String>,
5130    /// Technical detail information as reported by component.
5131    #[serde(rename = "techInfo")]
5132    #[serde(default, skip_serializing_if = "Option::is_none")]
5133    pub tech_info: Option<String>,
5134    /// _Cleared_ is set to true to report the clearing of a monitored situation, i.e. a 'return to normal'.
5135    #[serde(default, skip_serializing_if = "Option::is_none")]
5136    pub cleared: Option<bool>,
5137    /// If an event notification is linked to a specific transaction, this field can be used to specify its transactionId.
5138    #[serde(rename = "transactionId")]
5139    #[serde(default, skip_serializing_if = "Option::is_none")]
5140    pub transaction_id: Option<String>,
5141    /// Identifies the VariableMonitoring which triggered the event.
5142    #[serde(rename = "variableMonitoringId")]
5143    #[serde(default, skip_serializing_if = "Option::is_none")]
5144    pub variable_monitoring_id: Option<i32>,
5145    /// *(2.1)* Severity associated with the monitor in _variableMonitoringId_ or with the hardwired notification.
5146    #[serde(default, skip_serializing_if = "Option::is_none")]
5147    pub severity: Option<i32>,
5148    /// The `customData` member.
5149    #[serde(rename = "customData")]
5150    #[serde(default, skip_serializing_if = "Option::is_none")]
5151    pub custom_data: Option<crate::types::CustomData>,
5152}
5153
5154impl EventData {
5155    /// Creates a `EventData` from its required fields.
5156    #[must_use]
5157    pub fn new(
5158        event_id: i32,
5159        timestamp: impl Into<crate::types::DateTime>,
5160        trigger: EventTrigger,
5161        actual_value: impl Into<String>,
5162        component: Component,
5163        event_notification_type: EventNotification,
5164        variable: Variable,
5165    ) -> Self {
5166        Self {
5167            event_id,
5168            timestamp: timestamp.into(),
5169            trigger,
5170            actual_value: actual_value.into(),
5171            component,
5172            event_notification_type,
5173            variable,
5174            cause: None,
5175            tech_code: None,
5176            tech_info: None,
5177            cleared: None,
5178            transaction_id: None,
5179            variable_monitoring_id: None,
5180            severity: None,
5181            custom_data: None,
5182        }
5183    }
5184
5185    /// Sets the optional `cause` field.
5186    #[must_use]
5187    pub fn with_cause(mut self, value: i32) -> Self {
5188        self.cause = Some(value);
5189        self
5190    }
5191
5192    /// Sets the optional `techCode` field.
5193    #[must_use]
5194    pub fn with_tech_code(mut self, value: impl Into<String>) -> Self {
5195        self.tech_code = Some(value.into());
5196        self
5197    }
5198
5199    /// Sets the optional `techInfo` field.
5200    #[must_use]
5201    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
5202        self.tech_info = Some(value.into());
5203        self
5204    }
5205
5206    /// Sets the optional `cleared` field.
5207    #[must_use]
5208    pub fn with_cleared(mut self, value: bool) -> Self {
5209        self.cleared = Some(value);
5210        self
5211    }
5212
5213    /// Sets the optional `transactionId` field.
5214    #[must_use]
5215    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5216        self.transaction_id = Some(value.into());
5217        self
5218    }
5219
5220    /// Sets the optional `variableMonitoringId` field.
5221    #[must_use]
5222    pub fn with_variable_monitoring_id(mut self, value: i32) -> Self {
5223        self.variable_monitoring_id = Some(value);
5224        self
5225    }
5226
5227    /// Sets the optional `severity` field.
5228    #[must_use]
5229    pub fn with_severity(mut self, value: i32) -> Self {
5230        self.severity = Some(value);
5231        self
5232    }
5233
5234    /// Sets the optional `customData` field.
5235    #[must_use]
5236    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5237        self.custom_data = Some(value);
5238        self
5239    }
5240}
5241
5242impl Validate for EventData {
5243    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5244        path.push_key("eventId");
5245        validate::int_range(i64::from(self.event_id), Some(0), None, path, out);
5246        path.pop();
5247        path.push_key("trigger");
5248        Validate::validate_at(&self.trigger, path, out);
5249        path.pop();
5250        path.push_key("actualValue");
5251        validate::string(self.actual_value.as_str(), None, Some(2500), path, out);
5252        path.pop();
5253        path.push_key("component");
5254        Validate::validate_at(&self.component, path, out);
5255        path.pop();
5256        path.push_key("eventNotificationType");
5257        Validate::validate_at(&self.event_notification_type, path, out);
5258        path.pop();
5259        path.push_key("variable");
5260        Validate::validate_at(&self.variable, path, out);
5261        path.pop();
5262        path.push_key("cause");
5263        if let Some(value) = &self.cause {
5264            validate::int_range(i64::from(*value), Some(0), None, path, out);
5265        }
5266        path.pop();
5267        path.push_key("techCode");
5268        if let Some(value) = &self.tech_code {
5269            validate::string(value.as_str(), None, Some(50), path, out);
5270        }
5271        path.pop();
5272        path.push_key("techInfo");
5273        if let Some(value) = &self.tech_info {
5274            validate::string(value.as_str(), None, Some(500), path, out);
5275        }
5276        path.pop();
5277        path.push_key("transactionId");
5278        if let Some(value) = &self.transaction_id {
5279            validate::string(value.as_str(), None, Some(36), path, out);
5280        }
5281        path.pop();
5282        path.push_key("variableMonitoringId");
5283        if let Some(value) = &self.variable_monitoring_id {
5284            validate::int_range(i64::from(*value), Some(0), None, path, out);
5285        }
5286        path.pop();
5287        path.push_key("severity");
5288        if let Some(value) = &self.severity {
5289            validate::int_range(i64::from(*value), Some(0), None, path, out);
5290        }
5291        path.pop();
5292        path.push_key("customData");
5293        if let Some(value) = &self.custom_data {
5294            Validate::validate_at(value, path, out);
5295        }
5296        path.pop();
5297    }
5298}
5299
5300/// Represents a copy of the firmware that can be loaded/updated on the Charging Station.
5301///
5302/// The OCPP 2.1 `Firmware` data type.
5303#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5304pub struct Firmware {
5305    /// URI defining the origin of the firmware.
5306    pub location: String,
5307    /// Date and time at which the firmware shall be retrieved.
5308    #[serde(rename = "retrieveDateTime")]
5309    pub retrieve_date_time: crate::types::DateTime,
5310    /// Date and time at which the firmware shall be installed.
5311    #[serde(rename = "installDateTime")]
5312    #[serde(default, skip_serializing_if = "Option::is_none")]
5313    pub install_date_time: Option<crate::types::DateTime>,
5314    /// Certificate with which the firmware was signed.
5315    /// PEM encoded X.509 certificate.
5316    #[serde(rename = "signingCertificate")]
5317    #[serde(default, skip_serializing_if = "Option::is_none")]
5318    pub signing_certificate: Option<String>,
5319    /// Base64 encoded firmware signature.
5320    #[serde(default, skip_serializing_if = "Option::is_none")]
5321    pub signature: Option<String>,
5322    /// The `customData` member.
5323    #[serde(rename = "customData")]
5324    #[serde(default, skip_serializing_if = "Option::is_none")]
5325    pub custom_data: Option<crate::types::CustomData>,
5326}
5327
5328impl Firmware {
5329    /// Creates a `Firmware` from its required fields.
5330    #[must_use]
5331    pub fn new(
5332        location: impl Into<String>,
5333        retrieve_date_time: impl Into<crate::types::DateTime>,
5334    ) -> Self {
5335        Self {
5336            location: location.into(),
5337            retrieve_date_time: retrieve_date_time.into(),
5338            install_date_time: None,
5339            signing_certificate: None,
5340            signature: None,
5341            custom_data: None,
5342        }
5343    }
5344
5345    /// Sets the optional `installDateTime` field.
5346    #[must_use]
5347    pub fn with_install_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5348        self.install_date_time = Some(value.into());
5349        self
5350    }
5351
5352    /// Sets the optional `signingCertificate` field.
5353    #[must_use]
5354    pub fn with_signing_certificate(mut self, value: impl Into<String>) -> Self {
5355        self.signing_certificate = Some(value.into());
5356        self
5357    }
5358
5359    /// Sets the optional `signature` field.
5360    #[must_use]
5361    pub fn with_signature(mut self, value: impl Into<String>) -> Self {
5362        self.signature = Some(value.into());
5363        self
5364    }
5365
5366    /// Sets the optional `customData` field.
5367    #[must_use]
5368    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5369        self.custom_data = Some(value);
5370        self
5371    }
5372}
5373
5374impl Validate for Firmware {
5375    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5376        path.push_key("location");
5377        validate::string(self.location.as_str(), None, Some(2000), path, out);
5378        path.pop();
5379        path.push_key("signingCertificate");
5380        if let Some(value) = &self.signing_certificate {
5381            validate::string(value.as_str(), None, Some(5500), path, out);
5382        }
5383        path.pop();
5384        path.push_key("signature");
5385        if let Some(value) = &self.signature {
5386            validate::string(value.as_str(), None, Some(800), path, out);
5387        }
5388        path.pop();
5389        path.push_key("customData");
5390        if let Some(value) = &self.custom_data {
5391            Validate::validate_at(value, path, out);
5392        }
5393        path.pop();
5394    }
5395}
5396
5397/// The OCPP 2.1 `FixedPF` data type.
5398#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5399pub struct FixedPF {
5400    /// Priority of setting (0=highest)
5401    pub priority: i32,
5402    /// Power factor, cos(phi), as value between 0..1.
5403    pub displacement: crate::types::Decimal,
5404    /// True when absorbing reactive power (under-excited), false when injecting reactive power (over-excited).
5405    pub excitation: bool,
5406    /// Time when this setting becomes active
5407    #[serde(rename = "startTime")]
5408    #[serde(default, skip_serializing_if = "Option::is_none")]
5409    pub start_time: Option<crate::types::DateTime>,
5410    /// Duration in seconds that this setting is active.
5411    #[serde(default, skip_serializing_if = "Option::is_none")]
5412    pub duration: Option<crate::types::Decimal>,
5413    /// The `customData` member.
5414    #[serde(rename = "customData")]
5415    #[serde(default, skip_serializing_if = "Option::is_none")]
5416    pub custom_data: Option<crate::types::CustomData>,
5417}
5418
5419impl FixedPF {
5420    /// Creates a `FixedPF` from its required fields.
5421    #[must_use]
5422    pub fn new(
5423        priority: i32,
5424        displacement: impl Into<crate::types::Decimal>,
5425        excitation: bool,
5426    ) -> Self {
5427        Self {
5428            priority,
5429            displacement: displacement.into(),
5430            excitation,
5431            start_time: None,
5432            duration: None,
5433            custom_data: None,
5434        }
5435    }
5436
5437    /// Sets the optional `startTime` field.
5438    #[must_use]
5439    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5440        self.start_time = Some(value.into());
5441        self
5442    }
5443
5444    /// Sets the optional `duration` field.
5445    #[must_use]
5446    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5447        self.duration = Some(value.into());
5448        self
5449    }
5450
5451    /// Sets the optional `customData` field.
5452    #[must_use]
5453    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5454        self.custom_data = Some(value);
5455        self
5456    }
5457}
5458
5459impl Validate for FixedPF {
5460    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5461        path.push_key("priority");
5462        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5463        path.pop();
5464        path.push_key("customData");
5465        if let Some(value) = &self.custom_data {
5466            Validate::validate_at(value, path, out);
5467        }
5468        path.pop();
5469    }
5470}
5471
5472/// The OCPP 2.1 `FixedPFGet` data type.
5473#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5474pub struct FixedPFGet {
5475    /// The `fixedPF` member.
5476    #[serde(rename = "fixedPF")]
5477    pub fixed_pf: FixedPF,
5478    /// Id of setting.
5479    pub id: String,
5480    /// True if setting is a default control.
5481    #[serde(rename = "isDefault")]
5482    pub is_default: bool,
5483    /// True if this setting is superseded by a lower priority setting.
5484    #[serde(rename = "isSuperseded")]
5485    pub is_superseded: bool,
5486    /// The `customData` member.
5487    #[serde(rename = "customData")]
5488    #[serde(default, skip_serializing_if = "Option::is_none")]
5489    pub custom_data: Option<crate::types::CustomData>,
5490}
5491
5492impl FixedPFGet {
5493    /// Creates a `FixedPFGet` from its required fields.
5494    #[must_use]
5495    pub fn new(
5496        fixed_pf: FixedPF,
5497        id: impl Into<String>,
5498        is_default: bool,
5499        is_superseded: bool,
5500    ) -> Self {
5501        Self {
5502            fixed_pf,
5503            id: id.into(),
5504            is_default,
5505            is_superseded,
5506            custom_data: None,
5507        }
5508    }
5509
5510    /// Sets the optional `customData` field.
5511    #[must_use]
5512    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5513        self.custom_data = Some(value);
5514        self
5515    }
5516}
5517
5518impl Validate for FixedPFGet {
5519    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5520        path.push_key("fixedPF");
5521        Validate::validate_at(&self.fixed_pf, path, out);
5522        path.pop();
5523        path.push_key("id");
5524        validate::string(self.id.as_str(), None, Some(36), path, out);
5525        path.pop();
5526        path.push_key("customData");
5527        if let Some(value) = &self.custom_data {
5528            Validate::validate_at(value, path, out);
5529        }
5530        path.pop();
5531    }
5532}
5533
5534/// The OCPP 2.1 `FixedVar` data type.
5535#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5536pub struct FixedVar {
5537    /// Priority of setting (0=highest)
5538    pub priority: i32,
5539    /// The value specifies a target var output interpreted as a signed percentage (-100 to 100).
5540    ///     A negative value refers to charging, whereas a positive one refers to discharging.
5541    ///     The value type is determined by the unit field.
5542    pub setpoint: crate::types::Decimal,
5543    /// The `unit` member.
5544    pub unit: DERUnit,
5545    /// Time when this setting becomes active.
5546    #[serde(rename = "startTime")]
5547    #[serde(default, skip_serializing_if = "Option::is_none")]
5548    pub start_time: Option<crate::types::DateTime>,
5549    /// Duration in seconds that this setting is active.
5550    #[serde(default, skip_serializing_if = "Option::is_none")]
5551    pub duration: Option<crate::types::Decimal>,
5552    /// The `customData` member.
5553    #[serde(rename = "customData")]
5554    #[serde(default, skip_serializing_if = "Option::is_none")]
5555    pub custom_data: Option<crate::types::CustomData>,
5556}
5557
5558impl FixedVar {
5559    /// Creates a `FixedVar` from its required fields.
5560    #[must_use]
5561    pub fn new(priority: i32, setpoint: impl Into<crate::types::Decimal>, unit: DERUnit) -> Self {
5562        Self {
5563            priority,
5564            setpoint: setpoint.into(),
5565            unit,
5566            start_time: None,
5567            duration: None,
5568            custom_data: None,
5569        }
5570    }
5571
5572    /// Sets the optional `startTime` field.
5573    #[must_use]
5574    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5575        self.start_time = Some(value.into());
5576        self
5577    }
5578
5579    /// Sets the optional `duration` field.
5580    #[must_use]
5581    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5582        self.duration = Some(value.into());
5583        self
5584    }
5585
5586    /// Sets the optional `customData` field.
5587    #[must_use]
5588    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5589        self.custom_data = Some(value);
5590        self
5591    }
5592}
5593
5594impl Validate for FixedVar {
5595    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5596        path.push_key("priority");
5597        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5598        path.pop();
5599        path.push_key("unit");
5600        Validate::validate_at(&self.unit, path, out);
5601        path.pop();
5602        path.push_key("customData");
5603        if let Some(value) = &self.custom_data {
5604            Validate::validate_at(value, path, out);
5605        }
5606        path.pop();
5607    }
5608}
5609
5610/// The OCPP 2.1 `FixedVarGet` data type.
5611#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5612pub struct FixedVarGet {
5613    /// The `fixedVar` member.
5614    #[serde(rename = "fixedVar")]
5615    pub fixed_var: FixedVar,
5616    /// Id of setting
5617    pub id: String,
5618    /// True if setting is a default control.
5619    #[serde(rename = "isDefault")]
5620    pub is_default: bool,
5621    /// True if this setting is superseded by a lower priority setting
5622    #[serde(rename = "isSuperseded")]
5623    pub is_superseded: bool,
5624    /// The `customData` member.
5625    #[serde(rename = "customData")]
5626    #[serde(default, skip_serializing_if = "Option::is_none")]
5627    pub custom_data: Option<crate::types::CustomData>,
5628}
5629
5630impl FixedVarGet {
5631    /// Creates a `FixedVarGet` from its required fields.
5632    #[must_use]
5633    pub fn new(
5634        fixed_var: FixedVar,
5635        id: impl Into<String>,
5636        is_default: bool,
5637        is_superseded: bool,
5638    ) -> Self {
5639        Self {
5640            fixed_var,
5641            id: id.into(),
5642            is_default,
5643            is_superseded,
5644            custom_data: None,
5645        }
5646    }
5647
5648    /// Sets the optional `customData` field.
5649    #[must_use]
5650    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5651        self.custom_data = Some(value);
5652        self
5653    }
5654}
5655
5656impl Validate for FixedVarGet {
5657    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5658        path.push_key("fixedVar");
5659        Validate::validate_at(&self.fixed_var, path, out);
5660        path.pop();
5661        path.push_key("id");
5662        validate::string(self.id.as_str(), None, Some(36), path, out);
5663        path.pop();
5664        path.push_key("customData");
5665        if let Some(value) = &self.custom_data {
5666            Validate::validate_at(value, path, out);
5667        }
5668        path.pop();
5669    }
5670}
5671
5672/// The OCPP 2.1 `FreqDroop` data type.
5673#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5674pub struct FreqDroop {
5675    /// Priority of setting (0=highest)
5676    pub priority: i32,
5677    /// Over-frequency start of droop
5678    #[serde(rename = "overFreq")]
5679    pub over_freq: crate::types::Decimal,
5680    /// Under-frequency start of droop
5681    #[serde(rename = "underFreq")]
5682    pub under_freq: crate::types::Decimal,
5683    /// Over-frequency droop per unit, oFDroop
5684    #[serde(rename = "overDroop")]
5685    pub over_droop: crate::types::Decimal,
5686    /// Under-frequency droop per unit, uFDroop
5687    #[serde(rename = "underDroop")]
5688    pub under_droop: crate::types::Decimal,
5689    /// Open loop response time in seconds
5690    #[serde(rename = "responseTime")]
5691    pub response_time: crate::types::Decimal,
5692    /// Time when this setting becomes active
5693    #[serde(rename = "startTime")]
5694    #[serde(default, skip_serializing_if = "Option::is_none")]
5695    pub start_time: Option<crate::types::DateTime>,
5696    /// Duration in seconds that this setting is active
5697    #[serde(default, skip_serializing_if = "Option::is_none")]
5698    pub duration: Option<crate::types::Decimal>,
5699    /// The `customData` member.
5700    #[serde(rename = "customData")]
5701    #[serde(default, skip_serializing_if = "Option::is_none")]
5702    pub custom_data: Option<crate::types::CustomData>,
5703}
5704
5705impl FreqDroop {
5706    /// Creates a `FreqDroop` from its required fields.
5707    #[must_use]
5708    pub fn new(
5709        priority: i32,
5710        over_freq: impl Into<crate::types::Decimal>,
5711        under_freq: impl Into<crate::types::Decimal>,
5712        over_droop: impl Into<crate::types::Decimal>,
5713        under_droop: impl Into<crate::types::Decimal>,
5714        response_time: impl Into<crate::types::Decimal>,
5715    ) -> Self {
5716        Self {
5717            priority,
5718            over_freq: over_freq.into(),
5719            under_freq: under_freq.into(),
5720            over_droop: over_droop.into(),
5721            under_droop: under_droop.into(),
5722            response_time: response_time.into(),
5723            start_time: None,
5724            duration: None,
5725            custom_data: None,
5726        }
5727    }
5728
5729    /// Sets the optional `startTime` field.
5730    #[must_use]
5731    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
5732        self.start_time = Some(value.into());
5733        self
5734    }
5735
5736    /// Sets the optional `duration` field.
5737    #[must_use]
5738    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
5739        self.duration = Some(value.into());
5740        self
5741    }
5742
5743    /// Sets the optional `customData` field.
5744    #[must_use]
5745    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5746        self.custom_data = Some(value);
5747        self
5748    }
5749}
5750
5751impl Validate for FreqDroop {
5752    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5753        path.push_key("priority");
5754        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
5755        path.pop();
5756        path.push_key("customData");
5757        if let Some(value) = &self.custom_data {
5758            Validate::validate_at(value, path, out);
5759        }
5760        path.pop();
5761    }
5762}
5763
5764/// The OCPP 2.1 `FreqDroopGet` data type.
5765#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5766pub struct FreqDroopGet {
5767    /// The `freqDroop` member.
5768    #[serde(rename = "freqDroop")]
5769    pub freq_droop: FreqDroop,
5770    /// Id of setting
5771    pub id: String,
5772    /// True if setting is a default control.
5773    #[serde(rename = "isDefault")]
5774    pub is_default: bool,
5775    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
5776    #[serde(rename = "isSuperseded")]
5777    pub is_superseded: bool,
5778    /// The `customData` member.
5779    #[serde(rename = "customData")]
5780    #[serde(default, skip_serializing_if = "Option::is_none")]
5781    pub custom_data: Option<crate::types::CustomData>,
5782}
5783
5784impl FreqDroopGet {
5785    /// Creates a `FreqDroopGet` from its required fields.
5786    #[must_use]
5787    pub fn new(
5788        freq_droop: FreqDroop,
5789        id: impl Into<String>,
5790        is_default: bool,
5791        is_superseded: bool,
5792    ) -> Self {
5793        Self {
5794            freq_droop,
5795            id: id.into(),
5796            is_default,
5797            is_superseded,
5798            custom_data: None,
5799        }
5800    }
5801
5802    /// Sets the optional `customData` field.
5803    #[must_use]
5804    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5805        self.custom_data = Some(value);
5806        self
5807    }
5808}
5809
5810impl Validate for FreqDroopGet {
5811    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5812        path.push_key("freqDroop");
5813        Validate::validate_at(&self.freq_droop, path, out);
5814        path.pop();
5815        path.push_key("id");
5816        validate::string(self.id.as_str(), None, Some(36), path, out);
5817        path.pop();
5818        path.push_key("customData");
5819        if let Some(value) = &self.custom_data {
5820            Validate::validate_at(value, path, out);
5821        }
5822        path.pop();
5823    }
5824}
5825
5826/// Class to hold parameters for GetVariables request.
5827///
5828/// The OCPP 2.1 `GetVariableData` data type.
5829#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5830pub struct GetVariableData {
5831    /// The `component` member.
5832    pub component: Component,
5833    /// The `variable` member.
5834    pub variable: Variable,
5835    /// The `attributeType` member.
5836    #[serde(rename = "attributeType")]
5837    #[serde(default, skip_serializing_if = "Option::is_none")]
5838    pub attribute_type: Option<Attribute>,
5839    /// The `customData` member.
5840    #[serde(rename = "customData")]
5841    #[serde(default, skip_serializing_if = "Option::is_none")]
5842    pub custom_data: Option<crate::types::CustomData>,
5843}
5844
5845impl GetVariableData {
5846    /// Creates a `GetVariableData` from its required fields.
5847    #[must_use]
5848    pub fn new(component: Component, variable: Variable) -> Self {
5849        Self {
5850            component,
5851            variable,
5852            attribute_type: None,
5853            custom_data: None,
5854        }
5855    }
5856
5857    /// Sets the optional `attributeType` field.
5858    #[must_use]
5859    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5860        self.attribute_type = Some(value);
5861        self
5862    }
5863
5864    /// Sets the optional `customData` field.
5865    #[must_use]
5866    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5867        self.custom_data = Some(value);
5868        self
5869    }
5870}
5871
5872impl Validate for GetVariableData {
5873    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5874        path.push_key("component");
5875        Validate::validate_at(&self.component, path, out);
5876        path.pop();
5877        path.push_key("variable");
5878        Validate::validate_at(&self.variable, path, out);
5879        path.pop();
5880        path.push_key("attributeType");
5881        if let Some(value) = &self.attribute_type {
5882            Validate::validate_at(value, path, out);
5883        }
5884        path.pop();
5885        path.push_key("customData");
5886        if let Some(value) = &self.custom_data {
5887            Validate::validate_at(value, path, out);
5888        }
5889        path.pop();
5890    }
5891}
5892
5893/// Class to hold results of GetVariables request.
5894///
5895/// The OCPP 2.1 `GetVariableResult` data type.
5896#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5897pub struct GetVariableResult {
5898    /// The `attributeStatus` member.
5899    #[serde(rename = "attributeStatus")]
5900    pub attribute_status: GetVariableStatus,
5901    /// The `component` member.
5902    pub component: Component,
5903    /// The `variable` member.
5904    pub variable: Variable,
5905    /// The `attributeStatusInfo` member.
5906    #[serde(rename = "attributeStatusInfo")]
5907    #[serde(default, skip_serializing_if = "Option::is_none")]
5908    pub attribute_status_info: Option<StatusInfo>,
5909    /// The `attributeType` member.
5910    #[serde(rename = "attributeType")]
5911    #[serde(default, skip_serializing_if = "Option::is_none")]
5912    pub attribute_type: Option<Attribute>,
5913    /// Value of requested attribute type of component-variable. This field can only be empty when the given status is NOT accepted.
5914    ///
5915    /// 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.
5916    #[serde(rename = "attributeValue")]
5917    #[serde(default, skip_serializing_if = "Option::is_none")]
5918    pub attribute_value: Option<String>,
5919    /// The `customData` member.
5920    #[serde(rename = "customData")]
5921    #[serde(default, skip_serializing_if = "Option::is_none")]
5922    pub custom_data: Option<crate::types::CustomData>,
5923}
5924
5925impl GetVariableResult {
5926    /// Creates a `GetVariableResult` from its required fields.
5927    #[must_use]
5928    pub fn new(
5929        attribute_status: GetVariableStatus,
5930        component: Component,
5931        variable: Variable,
5932    ) -> Self {
5933        Self {
5934            attribute_status,
5935            component,
5936            variable,
5937            attribute_status_info: None,
5938            attribute_type: None,
5939            attribute_value: None,
5940            custom_data: None,
5941        }
5942    }
5943
5944    /// Sets the optional `attributeStatusInfo` field.
5945    #[must_use]
5946    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
5947        self.attribute_status_info = Some(value);
5948        self
5949    }
5950
5951    /// Sets the optional `attributeType` field.
5952    #[must_use]
5953    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
5954        self.attribute_type = Some(value);
5955        self
5956    }
5957
5958    /// Sets the optional `attributeValue` field.
5959    #[must_use]
5960    pub fn with_attribute_value(mut self, value: impl Into<String>) -> Self {
5961        self.attribute_value = Some(value.into());
5962        self
5963    }
5964
5965    /// Sets the optional `customData` field.
5966    #[must_use]
5967    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5968        self.custom_data = Some(value);
5969        self
5970    }
5971}
5972
5973impl Validate for GetVariableResult {
5974    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5975        path.push_key("attributeStatus");
5976        Validate::validate_at(&self.attribute_status, path, out);
5977        path.pop();
5978        path.push_key("component");
5979        Validate::validate_at(&self.component, path, out);
5980        path.pop();
5981        path.push_key("variable");
5982        Validate::validate_at(&self.variable, path, out);
5983        path.pop();
5984        path.push_key("attributeStatusInfo");
5985        if let Some(value) = &self.attribute_status_info {
5986            Validate::validate_at(value, path, out);
5987        }
5988        path.pop();
5989        path.push_key("attributeType");
5990        if let Some(value) = &self.attribute_type {
5991            Validate::validate_at(value, path, out);
5992        }
5993        path.pop();
5994        path.push_key("attributeValue");
5995        if let Some(value) = &self.attribute_value {
5996            validate::string(value.as_str(), None, Some(2500), path, out);
5997        }
5998        path.pop();
5999        path.push_key("customData");
6000        if let Some(value) = &self.custom_data {
6001            Validate::validate_at(value, path, out);
6002        }
6003        path.pop();
6004    }
6005}
6006
6007/// The OCPP 2.1 `Gradient` data type.
6008#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6009pub struct Gradient {
6010    /// Id of setting
6011    pub priority: i32,
6012    /// Default ramp rate in seconds (0 if not applicable)
6013    pub gradient: crate::types::Decimal,
6014    /// Soft-start ramp rate in seconds (0 if not applicable)
6015    #[serde(rename = "softGradient")]
6016    pub soft_gradient: crate::types::Decimal,
6017    /// The `customData` member.
6018    #[serde(rename = "customData")]
6019    #[serde(default, skip_serializing_if = "Option::is_none")]
6020    pub custom_data: Option<crate::types::CustomData>,
6021}
6022
6023impl Gradient {
6024    /// Creates a `Gradient` from its required fields.
6025    #[must_use]
6026    pub fn new(
6027        priority: i32,
6028        gradient: impl Into<crate::types::Decimal>,
6029        soft_gradient: impl Into<crate::types::Decimal>,
6030    ) -> Self {
6031        Self {
6032            priority,
6033            gradient: gradient.into(),
6034            soft_gradient: soft_gradient.into(),
6035            custom_data: None,
6036        }
6037    }
6038
6039    /// Sets the optional `customData` field.
6040    #[must_use]
6041    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6042        self.custom_data = Some(value);
6043        self
6044    }
6045}
6046
6047impl Validate for Gradient {
6048    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6049        path.push_key("priority");
6050        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
6051        path.pop();
6052        path.push_key("customData");
6053        if let Some(value) = &self.custom_data {
6054            Validate::validate_at(value, path, out);
6055        }
6056        path.pop();
6057    }
6058}
6059
6060/// The OCPP 2.1 `GradientGet` data type.
6061#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6062pub struct GradientGet {
6063    /// The `gradient` member.
6064    pub gradient: Gradient,
6065    /// Id of setting
6066    pub id: String,
6067    /// The `customData` member.
6068    #[serde(rename = "customData")]
6069    #[serde(default, skip_serializing_if = "Option::is_none")]
6070    pub custom_data: Option<crate::types::CustomData>,
6071}
6072
6073impl GradientGet {
6074    /// Creates a `GradientGet` from its required fields.
6075    #[must_use]
6076    pub fn new(gradient: Gradient, id: impl Into<String>) -> Self {
6077        Self {
6078            gradient,
6079            id: id.into(),
6080            custom_data: None,
6081        }
6082    }
6083
6084    /// Sets the optional `customData` field.
6085    #[must_use]
6086    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6087        self.custom_data = Some(value);
6088        self
6089    }
6090}
6091
6092impl Validate for GradientGet {
6093    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6094        path.push_key("gradient");
6095        Validate::validate_at(&self.gradient, path, out);
6096        path.pop();
6097        path.push_key("id");
6098        validate::string(self.id.as_str(), None, Some(36), path, out);
6099        path.pop();
6100        path.push_key("customData");
6101        if let Some(value) = &self.custom_data {
6102            Validate::validate_at(value, path, out);
6103        }
6104        path.pop();
6105    }
6106}
6107
6108/// The OCPP 2.1 `Hysteresis` data type.
6109#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6110pub struct Hysteresis {
6111    /// High value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6112    #[serde(rename = "hysteresisHigh")]
6113    #[serde(default, skip_serializing_if = "Option::is_none")]
6114    pub hysteresis_high: Option<crate::types::Decimal>,
6115    /// Low value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
6116    #[serde(rename = "hysteresisLow")]
6117    #[serde(default, skip_serializing_if = "Option::is_none")]
6118    pub hysteresis_low: Option<crate::types::Decimal>,
6119    /// Delay in seconds, once grid parameter within HysteresisLow and HysteresisHigh, for the EV to return to normal operation after a grid event.
6120    #[serde(rename = "hysteresisDelay")]
6121    #[serde(default, skip_serializing_if = "Option::is_none")]
6122    pub hysteresis_delay: Option<crate::types::Decimal>,
6123    /// Set default rate of change (ramp rate %/s) for the EV to return to normal operation after a grid event
6124    #[serde(rename = "hysteresisGradient")]
6125    #[serde(default, skip_serializing_if = "Option::is_none")]
6126    pub hysteresis_gradient: Option<crate::types::Decimal>,
6127    /// The `customData` member.
6128    #[serde(rename = "customData")]
6129    #[serde(default, skip_serializing_if = "Option::is_none")]
6130    pub custom_data: Option<crate::types::CustomData>,
6131}
6132
6133impl Hysteresis {
6134    /// Creates an empty `Hysteresis`. Every field of this type is optional.
6135    #[must_use]
6136    pub fn new() -> Self {
6137        Self::default()
6138    }
6139
6140    /// Sets the optional `hysteresisHigh` field.
6141    #[must_use]
6142    pub fn with_hysteresis_high(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6143        self.hysteresis_high = Some(value.into());
6144        self
6145    }
6146
6147    /// Sets the optional `hysteresisLow` field.
6148    #[must_use]
6149    pub fn with_hysteresis_low(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6150        self.hysteresis_low = Some(value.into());
6151        self
6152    }
6153
6154    /// Sets the optional `hysteresisDelay` field.
6155    #[must_use]
6156    pub fn with_hysteresis_delay(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6157        self.hysteresis_delay = Some(value.into());
6158        self
6159    }
6160
6161    /// Sets the optional `hysteresisGradient` field.
6162    #[must_use]
6163    pub fn with_hysteresis_gradient(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6164        self.hysteresis_gradient = Some(value.into());
6165        self
6166    }
6167
6168    /// Sets the optional `customData` field.
6169    #[must_use]
6170    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6171        self.custom_data = Some(value);
6172        self
6173    }
6174}
6175
6176impl Validate for Hysteresis {
6177    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6178        path.push_key("customData");
6179        if let Some(value) = &self.custom_data {
6180            Validate::validate_at(value, path, out);
6181        }
6182        path.pop();
6183    }
6184}
6185
6186/// Contains a case insensitive identifier to use for the authorization and the type of authorization to support multiple forms of identifiers.
6187///
6188/// The OCPP 2.1 `IdToken` data type.
6189#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6190pub struct IdToken {
6191    /// *(2.1)* IdToken is case insensitive. Might hold the hidden id of an RFID tag, but can for example also contain a UUID.
6192    #[serde(rename = "idToken")]
6193    pub id_token: String,
6194    /// *(2.1)* Enumeration of possible idToken types. Values defined in Appendix as IdTokenEnumStringType.
6195    pub r#type: String,
6196    /// The `additionalInfo` member.
6197    #[serde(rename = "additionalInfo")]
6198    #[serde(default, skip_serializing_if = "Option::is_none")]
6199    pub additional_info: Option<Vec<AdditionalInfo>>,
6200    /// The `customData` member.
6201    #[serde(rename = "customData")]
6202    #[serde(default, skip_serializing_if = "Option::is_none")]
6203    pub custom_data: Option<crate::types::CustomData>,
6204}
6205
6206impl IdToken {
6207    /// Creates a `IdToken` from its required fields.
6208    #[must_use]
6209    pub fn new(id_token: impl Into<String>, r#type: impl Into<String>) -> Self {
6210        Self {
6211            id_token: id_token.into(),
6212            r#type: r#type.into(),
6213            additional_info: None,
6214            custom_data: None,
6215        }
6216    }
6217
6218    /// Sets the optional `additionalInfo` field.
6219    #[must_use]
6220    pub fn with_additional_info(mut self, value: Vec<AdditionalInfo>) -> Self {
6221        self.additional_info = Some(value);
6222        self
6223    }
6224
6225    /// Sets the optional `customData` field.
6226    #[must_use]
6227    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6228        self.custom_data = Some(value);
6229        self
6230    }
6231}
6232
6233impl Validate for IdToken {
6234    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6235        path.push_key("idToken");
6236        validate::string(self.id_token.as_str(), None, Some(255), path, out);
6237        path.pop();
6238        path.push_key("type");
6239        validate::string(self.r#type.as_str(), None, Some(20), path, out);
6240        path.pop();
6241        path.push_key("additionalInfo");
6242        if let Some(value) = &self.additional_info {
6243            validate::list_len(value.len(), Some(1), None, path, out);
6244            for (index, item) in value.iter().enumerate() {
6245                path.push_index(index);
6246                Validate::validate_at(item, path, out);
6247                path.pop();
6248            }
6249        }
6250        path.pop();
6251        path.push_key("customData");
6252        if let Some(value) = &self.custom_data {
6253            Validate::validate_at(value, path, out);
6254        }
6255        path.pop();
6256    }
6257}
6258
6259/// Contains status information about an identifier.
6260/// 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.
6261///
6262/// The OCPP 2.1 `IdTokenInfo` data type.
6263#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6264pub struct IdTokenInfo {
6265    /// The `status` member.
6266    pub status: AuthorizationStatus,
6267    /// Date and Time after which the token must be considered invalid.
6268    #[serde(rename = "cacheExpiryDateTime")]
6269    #[serde(default, skip_serializing_if = "Option::is_none")]
6270    pub cache_expiry_date_time: Option<crate::types::DateTime>,
6271    /// 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.
6272    #[serde(rename = "chargingPriority")]
6273    #[serde(default, skip_serializing_if = "Option::is_none")]
6274    pub charging_priority: Option<i32>,
6275    /// The `groupIdToken` member.
6276    #[serde(rename = "groupIdToken")]
6277    #[serde(default, skip_serializing_if = "Option::is_none")]
6278    pub group_id_token: Option<IdToken>,
6279    /// Preferred user interface language of identifier user. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6280    #[serde(default, skip_serializing_if = "Option::is_none")]
6281    pub language1: Option<String>,
6282    /// 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;.
6283    #[serde(default, skip_serializing_if = "Option::is_none")]
6284    pub language2: Option<String>,
6285    /// Only used when the IdToken is only valid for one or more specific EVSEs, not for the entire Charging Station.
6286    #[serde(rename = "evseId")]
6287    #[serde(default, skip_serializing_if = "Option::is_none")]
6288    pub evse_id: Option<Vec<i32>>,
6289    /// The `personalMessage` member.
6290    #[serde(rename = "personalMessage")]
6291    #[serde(default, skip_serializing_if = "Option::is_none")]
6292    pub personal_message: Option<MessageContent>,
6293    /// The `customData` member.
6294    #[serde(rename = "customData")]
6295    #[serde(default, skip_serializing_if = "Option::is_none")]
6296    pub custom_data: Option<crate::types::CustomData>,
6297}
6298
6299impl IdTokenInfo {
6300    /// Creates a `IdTokenInfo` from its required fields.
6301    #[must_use]
6302    pub fn new(status: AuthorizationStatus) -> Self {
6303        Self {
6304            status,
6305            cache_expiry_date_time: None,
6306            charging_priority: None,
6307            group_id_token: None,
6308            language1: None,
6309            language2: None,
6310            evse_id: None,
6311            personal_message: None,
6312            custom_data: None,
6313        }
6314    }
6315
6316    /// Sets the optional `cacheExpiryDateTime` field.
6317    #[must_use]
6318    pub fn with_cache_expiry_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6319        self.cache_expiry_date_time = Some(value.into());
6320        self
6321    }
6322
6323    /// Sets the optional `chargingPriority` field.
6324    #[must_use]
6325    pub fn with_charging_priority(mut self, value: i32) -> Self {
6326        self.charging_priority = Some(value);
6327        self
6328    }
6329
6330    /// Sets the optional `groupIdToken` field.
6331    #[must_use]
6332    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
6333        self.group_id_token = Some(value);
6334        self
6335    }
6336
6337    /// Sets the optional `language1` field.
6338    #[must_use]
6339    pub fn with_language1(mut self, value: impl Into<String>) -> Self {
6340        self.language1 = Some(value.into());
6341        self
6342    }
6343
6344    /// Sets the optional `language2` field.
6345    #[must_use]
6346    pub fn with_language2(mut self, value: impl Into<String>) -> Self {
6347        self.language2 = Some(value.into());
6348        self
6349    }
6350
6351    /// Sets the optional `evseId` field.
6352    #[must_use]
6353    pub fn with_evse_id(mut self, value: Vec<i32>) -> Self {
6354        self.evse_id = Some(value);
6355        self
6356    }
6357
6358    /// Sets the optional `personalMessage` field.
6359    #[must_use]
6360    pub fn with_personal_message(mut self, value: MessageContent) -> Self {
6361        self.personal_message = Some(value);
6362        self
6363    }
6364
6365    /// Sets the optional `customData` field.
6366    #[must_use]
6367    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6368        self.custom_data = Some(value);
6369        self
6370    }
6371}
6372
6373impl Validate for IdTokenInfo {
6374    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6375        path.push_key("status");
6376        Validate::validate_at(&self.status, path, out);
6377        path.pop();
6378        path.push_key("groupIdToken");
6379        if let Some(value) = &self.group_id_token {
6380            Validate::validate_at(value, path, out);
6381        }
6382        path.pop();
6383        path.push_key("language1");
6384        if let Some(value) = &self.language1 {
6385            validate::string(value.as_str(), None, Some(8), path, out);
6386        }
6387        path.pop();
6388        path.push_key("language2");
6389        if let Some(value) = &self.language2 {
6390            validate::string(value.as_str(), None, Some(8), path, out);
6391        }
6392        path.pop();
6393        path.push_key("evseId");
6394        if let Some(value) = &self.evse_id {
6395            validate::list_len(value.len(), Some(1), None, path, out);
6396            for (index, item) in value.iter().enumerate() {
6397                path.push_index(index);
6398                validate::int_range(i64::from(*item), Some(0), None, path, out);
6399                path.pop();
6400            }
6401        }
6402        path.pop();
6403        path.push_key("personalMessage");
6404        if let Some(value) = &self.personal_message {
6405            Validate::validate_at(value, path, out);
6406        }
6407        path.pop();
6408        path.push_key("customData");
6409        if let Some(value) = &self.custom_data {
6410            Validate::validate_at(value, path, out);
6411        }
6412        path.pop();
6413    }
6414}
6415
6416/// The OCPP 2.1 `LimitAtSoC` data type.
6417#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6418pub struct LimitAtSoC {
6419    /// The SoC value beyond which the charging rate limit should be applied.
6420    pub soc: i32,
6421    /// Charging rate limit beyond the SoC value.
6422    /// The unit is defined by _chargingSchedule.chargingRateUnit_.
6423    pub limit: crate::types::Decimal,
6424    /// The `customData` member.
6425    #[serde(rename = "customData")]
6426    #[serde(default, skip_serializing_if = "Option::is_none")]
6427    pub custom_data: Option<crate::types::CustomData>,
6428}
6429
6430impl LimitAtSoC {
6431    /// Creates a `LimitAtSoC` from its required fields.
6432    #[must_use]
6433    pub fn new(soc: i32, limit: impl Into<crate::types::Decimal>) -> Self {
6434        Self {
6435            soc,
6436            limit: limit.into(),
6437            custom_data: None,
6438        }
6439    }
6440
6441    /// Sets the optional `customData` field.
6442    #[must_use]
6443    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6444        self.custom_data = Some(value);
6445        self
6446    }
6447}
6448
6449impl Validate for LimitAtSoC {
6450    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6451        path.push_key("soc");
6452        validate::int_range(i64::from(self.soc), Some(0), Some(100), path, out);
6453        path.pop();
6454        path.push_key("customData");
6455        if let Some(value) = &self.custom_data {
6456            Validate::validate_at(value, path, out);
6457        }
6458        path.pop();
6459    }
6460}
6461
6462/// The OCPP 2.1 `LimitMaxDischarge` data type.
6463#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6464pub struct LimitMaxDischarge {
6465    /// Priority of setting (0=highest)
6466    pub priority: i32,
6467    /// Only for PowerMonitoring. +
6468    ///     The value specifies a percentage (0 to 100) of the rated maximum discharge power of EV.
6469    ///     The PowerMonitoring curve becomes active when power exceeds this percentage.
6470    #[serde(rename = "pctMaxDischargePower")]
6471    #[serde(default, skip_serializing_if = "Option::is_none")]
6472    pub pct_max_discharge_power: Option<crate::types::Decimal>,
6473    /// The `powerMonitoringMustTrip` member.
6474    #[serde(rename = "powerMonitoringMustTrip")]
6475    #[serde(default, skip_serializing_if = "Option::is_none")]
6476    pub power_monitoring_must_trip: Option<DERCurve>,
6477    /// Time when this setting becomes active
6478    #[serde(rename = "startTime")]
6479    #[serde(default, skip_serializing_if = "Option::is_none")]
6480    pub start_time: Option<crate::types::DateTime>,
6481    /// Duration in seconds that this setting is active
6482    #[serde(default, skip_serializing_if = "Option::is_none")]
6483    pub duration: Option<crate::types::Decimal>,
6484    /// The `customData` member.
6485    #[serde(rename = "customData")]
6486    #[serde(default, skip_serializing_if = "Option::is_none")]
6487    pub custom_data: Option<crate::types::CustomData>,
6488}
6489
6490impl LimitMaxDischarge {
6491    /// Creates a `LimitMaxDischarge` from its required fields.
6492    #[must_use]
6493    pub fn new(priority: i32) -> Self {
6494        Self {
6495            priority,
6496            pct_max_discharge_power: None,
6497            power_monitoring_must_trip: None,
6498            start_time: None,
6499            duration: None,
6500            custom_data: None,
6501        }
6502    }
6503
6504    /// Sets the optional `pctMaxDischargePower` field.
6505    #[must_use]
6506    pub fn with_pct_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6507        self.pct_max_discharge_power = Some(value.into());
6508        self
6509    }
6510
6511    /// Sets the optional `powerMonitoringMustTrip` field.
6512    #[must_use]
6513    pub fn with_power_monitoring_must_trip(mut self, value: DERCurve) -> Self {
6514        self.power_monitoring_must_trip = Some(value);
6515        self
6516    }
6517
6518    /// Sets the optional `startTime` field.
6519    #[must_use]
6520    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6521        self.start_time = Some(value.into());
6522        self
6523    }
6524
6525    /// Sets the optional `duration` field.
6526    #[must_use]
6527    pub fn with_duration(mut self, value: impl Into<crate::types::Decimal>) -> Self {
6528        self.duration = Some(value.into());
6529        self
6530    }
6531
6532    /// Sets the optional `customData` field.
6533    #[must_use]
6534    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6535        self.custom_data = Some(value);
6536        self
6537    }
6538}
6539
6540impl Validate for LimitMaxDischarge {
6541    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6542        path.push_key("priority");
6543        validate::int_range(i64::from(self.priority), Some(0), None, path, out);
6544        path.pop();
6545        path.push_key("powerMonitoringMustTrip");
6546        if let Some(value) = &self.power_monitoring_must_trip {
6547            Validate::validate_at(value, path, out);
6548        }
6549        path.pop();
6550        path.push_key("customData");
6551        if let Some(value) = &self.custom_data {
6552            Validate::validate_at(value, path, out);
6553        }
6554        path.pop();
6555    }
6556}
6557
6558/// The OCPP 2.1 `LimitMaxDischargeGet` data type.
6559#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6560pub struct LimitMaxDischargeGet {
6561    /// Id of setting
6562    pub id: String,
6563    /// True if setting is a default control.
6564    #[serde(rename = "isDefault")]
6565    pub is_default: bool,
6566    /// True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
6567    #[serde(rename = "isSuperseded")]
6568    pub is_superseded: bool,
6569    /// The `limitMaxDischarge` member.
6570    #[serde(rename = "limitMaxDischarge")]
6571    pub limit_max_discharge: LimitMaxDischarge,
6572    /// The `customData` member.
6573    #[serde(rename = "customData")]
6574    #[serde(default, skip_serializing_if = "Option::is_none")]
6575    pub custom_data: Option<crate::types::CustomData>,
6576}
6577
6578impl LimitMaxDischargeGet {
6579    /// Creates a `LimitMaxDischargeGet` from its required fields.
6580    #[must_use]
6581    pub fn new(
6582        id: impl Into<String>,
6583        is_default: bool,
6584        is_superseded: bool,
6585        limit_max_discharge: LimitMaxDischarge,
6586    ) -> Self {
6587        Self {
6588            id: id.into(),
6589            is_default,
6590            is_superseded,
6591            limit_max_discharge,
6592            custom_data: None,
6593        }
6594    }
6595
6596    /// Sets the optional `customData` field.
6597    #[must_use]
6598    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6599        self.custom_data = Some(value);
6600        self
6601    }
6602}
6603
6604impl Validate for LimitMaxDischargeGet {
6605    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6606        path.push_key("id");
6607        validate::string(self.id.as_str(), None, Some(36), path, out);
6608        path.pop();
6609        path.push_key("limitMaxDischarge");
6610        Validate::validate_at(&self.limit_max_discharge, path, out);
6611        path.pop();
6612        path.push_key("customData");
6613        if let Some(value) = &self.custom_data {
6614            Validate::validate_at(value, path, out);
6615        }
6616        path.pop();
6617    }
6618}
6619
6620/// Generic class for the configuration of logging entries.
6621///
6622/// The OCPP 2.1 `LogParameters` data type.
6623#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6624pub struct LogParameters {
6625    /// The URL of the location at the remote system where the log should be stored.
6626    #[serde(rename = "remoteLocation")]
6627    pub remote_location: String,
6628    /// This contains the date and time of the oldest logging information to include in the diagnostics.
6629    #[serde(rename = "oldestTimestamp")]
6630    #[serde(default, skip_serializing_if = "Option::is_none")]
6631    pub oldest_timestamp: Option<crate::types::DateTime>,
6632    /// This contains the date and time of the latest logging information to include in the diagnostics.
6633    #[serde(rename = "latestTimestamp")]
6634    #[serde(default, skip_serializing_if = "Option::is_none")]
6635    pub latest_timestamp: Option<crate::types::DateTime>,
6636    /// The `customData` member.
6637    #[serde(rename = "customData")]
6638    #[serde(default, skip_serializing_if = "Option::is_none")]
6639    pub custom_data: Option<crate::types::CustomData>,
6640}
6641
6642impl LogParameters {
6643    /// Creates a `LogParameters` from its required fields.
6644    #[must_use]
6645    pub fn new(remote_location: impl Into<String>) -> Self {
6646        Self {
6647            remote_location: remote_location.into(),
6648            oldest_timestamp: None,
6649            latest_timestamp: None,
6650            custom_data: None,
6651        }
6652    }
6653
6654    /// Sets the optional `oldestTimestamp` field.
6655    #[must_use]
6656    pub fn with_oldest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6657        self.oldest_timestamp = Some(value.into());
6658        self
6659    }
6660
6661    /// Sets the optional `latestTimestamp` field.
6662    #[must_use]
6663    pub fn with_latest_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6664        self.latest_timestamp = Some(value.into());
6665        self
6666    }
6667
6668    /// Sets the optional `customData` field.
6669    #[must_use]
6670    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6671        self.custom_data = Some(value);
6672        self
6673    }
6674}
6675
6676impl Validate for LogParameters {
6677    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6678        path.push_key("remoteLocation");
6679        validate::string(self.remote_location.as_str(), None, Some(2000), path, out);
6680        path.pop();
6681        path.push_key("customData");
6682        if let Some(value) = &self.custom_data {
6683            Validate::validate_at(value, path, out);
6684        }
6685        path.pop();
6686    }
6687}
6688
6689/// Contains message details, for a message to be displayed on a Charging Station.
6690///
6691/// The OCPP 2.1 `MessageContent` data type.
6692#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6693pub struct MessageContent {
6694    /// The `format` member.
6695    pub format: MessageFormat,
6696    /// *(2.1)* Required. Message contents. +
6697    /// Maximum length supported by Charging Station is given in OCPPCommCtrlr.FieldLength\["MessageContentType.content"\].
6698    ///     Maximum length defaults to 1024.
6699    pub content: String,
6700    /// Message language identifier. Contains a language code as defined in &lt;&lt;ref-RFC5646,\[RFC5646\]&gt;&gt;.
6701    #[serde(default, skip_serializing_if = "Option::is_none")]
6702    pub language: Option<String>,
6703    /// The `customData` member.
6704    #[serde(rename = "customData")]
6705    #[serde(default, skip_serializing_if = "Option::is_none")]
6706    pub custom_data: Option<crate::types::CustomData>,
6707}
6708
6709impl MessageContent {
6710    /// Creates a `MessageContent` from its required fields.
6711    #[must_use]
6712    pub fn new(format: MessageFormat, content: impl Into<String>) -> Self {
6713        Self {
6714            format,
6715            content: content.into(),
6716            language: None,
6717            custom_data: None,
6718        }
6719    }
6720
6721    /// Sets the optional `language` field.
6722    #[must_use]
6723    pub fn with_language(mut self, value: impl Into<String>) -> Self {
6724        self.language = Some(value.into());
6725        self
6726    }
6727
6728    /// Sets the optional `customData` field.
6729    #[must_use]
6730    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6731        self.custom_data = Some(value);
6732        self
6733    }
6734}
6735
6736impl Validate for MessageContent {
6737    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6738        path.push_key("format");
6739        Validate::validate_at(&self.format, path, out);
6740        path.pop();
6741        path.push_key("content");
6742        validate::string(self.content.as_str(), None, Some(1024), path, out);
6743        path.pop();
6744        path.push_key("language");
6745        if let Some(value) = &self.language {
6746            validate::string(value.as_str(), None, Some(8), path, out);
6747        }
6748        path.pop();
6749        path.push_key("customData");
6750        if let Some(value) = &self.custom_data {
6751            Validate::validate_at(value, path, out);
6752        }
6753        path.pop();
6754    }
6755}
6756
6757/// Contains message details, for a message to be displayed on a Charging Station.
6758///
6759/// The OCPP 2.1 `MessageInfo` data type.
6760#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6761pub struct MessageInfo {
6762    /// Unique id within an exchange context. It is defined within the OCPP context as a positive Integer value (greater or equal to zero).
6763    pub id: i32,
6764    /// The `priority` member.
6765    pub priority: MessagePriority,
6766    /// The `message` member.
6767    pub message: MessageContent,
6768    /// The `display` member.
6769    #[serde(default, skip_serializing_if = "Option::is_none")]
6770    pub display: Option<Component>,
6771    /// The `state` member.
6772    #[serde(default, skip_serializing_if = "Option::is_none")]
6773    pub state: Option<MessageState>,
6774    /// From what date-time should this message be shown. If omitted: directly.
6775    #[serde(rename = "startDateTime")]
6776    #[serde(default, skip_serializing_if = "Option::is_none")]
6777    pub start_date_time: Option<crate::types::DateTime>,
6778    /// Until what date-time should this message be shown, after this date/time this message SHALL be removed.
6779    #[serde(rename = "endDateTime")]
6780    #[serde(default, skip_serializing_if = "Option::is_none")]
6781    pub end_date_time: Option<crate::types::DateTime>,
6782    /// During which transaction shall this message be shown.
6783    /// Message SHALL be removed by the Charging Station after transaction has
6784    /// ended.
6785    #[serde(rename = "transactionId")]
6786    #[serde(default, skip_serializing_if = "Option::is_none")]
6787    pub transaction_id: Option<String>,
6788    /// The `messageExtra` member.
6789    #[serde(rename = "messageExtra")]
6790    #[serde(default, skip_serializing_if = "Option::is_none")]
6791    pub message_extra: Option<Vec<MessageContent>>,
6792    /// The `customData` member.
6793    #[serde(rename = "customData")]
6794    #[serde(default, skip_serializing_if = "Option::is_none")]
6795    pub custom_data: Option<crate::types::CustomData>,
6796}
6797
6798impl MessageInfo {
6799    /// Creates a `MessageInfo` from its required fields.
6800    #[must_use]
6801    pub fn new(id: i32, priority: MessagePriority, message: MessageContent) -> Self {
6802        Self {
6803            id,
6804            priority,
6805            message,
6806            display: None,
6807            state: None,
6808            start_date_time: None,
6809            end_date_time: None,
6810            transaction_id: None,
6811            message_extra: None,
6812            custom_data: None,
6813        }
6814    }
6815
6816    /// Sets the optional `display` field.
6817    #[must_use]
6818    pub fn with_display(mut self, value: Component) -> Self {
6819        self.display = Some(value);
6820        self
6821    }
6822
6823    /// Sets the optional `state` field.
6824    #[must_use]
6825    pub fn with_state(mut self, value: MessageState) -> Self {
6826        self.state = Some(value);
6827        self
6828    }
6829
6830    /// Sets the optional `startDateTime` field.
6831    #[must_use]
6832    pub fn with_start_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6833        self.start_date_time = Some(value.into());
6834        self
6835    }
6836
6837    /// Sets the optional `endDateTime` field.
6838    #[must_use]
6839    pub fn with_end_date_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6840        self.end_date_time = Some(value.into());
6841        self
6842    }
6843
6844    /// Sets the optional `transactionId` field.
6845    #[must_use]
6846    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
6847        self.transaction_id = Some(value.into());
6848        self
6849    }
6850
6851    /// Sets the optional `messageExtra` field.
6852    #[must_use]
6853    pub fn with_message_extra(mut self, value: Vec<MessageContent>) -> Self {
6854        self.message_extra = Some(value);
6855        self
6856    }
6857
6858    /// Sets the optional `customData` field.
6859    #[must_use]
6860    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6861        self.custom_data = Some(value);
6862        self
6863    }
6864}
6865
6866impl Validate for MessageInfo {
6867    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6868        path.push_key("id");
6869        validate::int_range(i64::from(self.id), Some(0), None, path, out);
6870        path.pop();
6871        path.push_key("priority");
6872        Validate::validate_at(&self.priority, path, out);
6873        path.pop();
6874        path.push_key("message");
6875        Validate::validate_at(&self.message, path, out);
6876        path.pop();
6877        path.push_key("display");
6878        if let Some(value) = &self.display {
6879            Validate::validate_at(value, path, out);
6880        }
6881        path.pop();
6882        path.push_key("state");
6883        if let Some(value) = &self.state {
6884            Validate::validate_at(value, path, out);
6885        }
6886        path.pop();
6887        path.push_key("transactionId");
6888        if let Some(value) = &self.transaction_id {
6889            validate::string(value.as_str(), None, Some(36), path, out);
6890        }
6891        path.pop();
6892        path.push_key("messageExtra");
6893        if let Some(value) = &self.message_extra {
6894            validate::list_len(value.len(), Some(1), Some(4), path, out);
6895            for (index, item) in value.iter().enumerate() {
6896                path.push_index(index);
6897                Validate::validate_at(item, path, out);
6898                path.pop();
6899            }
6900        }
6901        path.pop();
6902        path.push_key("customData");
6903        if let Some(value) = &self.custom_data {
6904            Validate::validate_at(value, path, out);
6905        }
6906        path.pop();
6907    }
6908}
6909
6910/// 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.
6911///
6912/// The OCPP 2.1 `MeterValue` data type.
6913#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6914pub struct MeterValue {
6915    /// The `sampledValue` member.
6916    #[serde(rename = "sampledValue")]
6917    pub sampled_value: Vec<SampledValue>,
6918    /// Timestamp for measured value(s).
6919    pub timestamp: crate::types::DateTime,
6920    /// The `customData` member.
6921    #[serde(rename = "customData")]
6922    #[serde(default, skip_serializing_if = "Option::is_none")]
6923    pub custom_data: Option<crate::types::CustomData>,
6924}
6925
6926impl MeterValue {
6927    /// Creates a `MeterValue` from its required fields.
6928    #[must_use]
6929    pub fn new(
6930        sampled_value: Vec<SampledValue>,
6931        timestamp: impl Into<crate::types::DateTime>,
6932    ) -> Self {
6933        Self {
6934            sampled_value,
6935            timestamp: timestamp.into(),
6936            custom_data: None,
6937        }
6938    }
6939
6940    /// Sets the optional `customData` field.
6941    #[must_use]
6942    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6943        self.custom_data = Some(value);
6944        self
6945    }
6946}
6947
6948impl Validate for MeterValue {
6949    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6950        path.push_key("sampledValue");
6951        validate::list_len(self.sampled_value.len(), Some(1), None, path, out);
6952        for (index, item) in self.sampled_value.iter().enumerate() {
6953            path.push_index(index);
6954            Validate::validate_at(item, path, out);
6955            path.pop();
6956        }
6957        path.pop();
6958        path.push_key("customData");
6959        if let Some(value) = &self.custom_data {
6960            Validate::validate_at(value, path, out);
6961        }
6962        path.pop();
6963    }
6964}
6965
6966/// Defines parameters required for initiating and maintaining wireless communication with other devices.
6967///
6968/// The OCPP 2.1 `Modem` data type.
6969#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6970pub struct Modem {
6971    /// This contains the ICCID of the modem’s SIM card.
6972    #[serde(default, skip_serializing_if = "Option::is_none")]
6973    pub iccid: Option<String>,
6974    /// This contains the IMSI of the modem’s SIM card.
6975    #[serde(default, skip_serializing_if = "Option::is_none")]
6976    pub imsi: Option<String>,
6977    /// The `customData` member.
6978    #[serde(rename = "customData")]
6979    #[serde(default, skip_serializing_if = "Option::is_none")]
6980    pub custom_data: Option<crate::types::CustomData>,
6981}
6982
6983impl Modem {
6984    /// Creates an empty `Modem`. Every field of this type is optional.
6985    #[must_use]
6986    pub fn new() -> Self {
6987        Self::default()
6988    }
6989
6990    /// Sets the optional `iccid` field.
6991    #[must_use]
6992    pub fn with_iccid(mut self, value: impl Into<String>) -> Self {
6993        self.iccid = Some(value.into());
6994        self
6995    }
6996
6997    /// Sets the optional `imsi` field.
6998    #[must_use]
6999    pub fn with_imsi(mut self, value: impl Into<String>) -> Self {
7000        self.imsi = Some(value.into());
7001        self
7002    }
7003
7004    /// Sets the optional `customData` field.
7005    #[must_use]
7006    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7007        self.custom_data = Some(value);
7008        self
7009    }
7010}
7011
7012impl Validate for Modem {
7013    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7014        path.push_key("iccid");
7015        if let Some(value) = &self.iccid {
7016            validate::string(value.as_str(), None, Some(20), path, out);
7017        }
7018        path.pop();
7019        path.push_key("imsi");
7020        if let Some(value) = &self.imsi {
7021            validate::string(value.as_str(), None, Some(20), path, out);
7022        }
7023        path.pop();
7024        path.push_key("customData");
7025        if let Some(value) = &self.custom_data {
7026            Validate::validate_at(value, path, out);
7027        }
7028        path.pop();
7029    }
7030}
7031
7032/// Class to hold parameters of SetVariableMonitoring request.
7033///
7034/// The OCPP 2.1 `MonitoringData` data type.
7035#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7036pub struct MonitoringData {
7037    /// The `component` member.
7038    pub component: Component,
7039    /// The `variable` member.
7040    pub variable: Variable,
7041    /// The `variableMonitoring` member.
7042    #[serde(rename = "variableMonitoring")]
7043    pub variable_monitoring: Vec<VariableMonitoring>,
7044    /// The `customData` member.
7045    #[serde(rename = "customData")]
7046    #[serde(default, skip_serializing_if = "Option::is_none")]
7047    pub custom_data: Option<crate::types::CustomData>,
7048}
7049
7050impl MonitoringData {
7051    /// Creates a `MonitoringData` from its required fields.
7052    #[must_use]
7053    pub fn new(
7054        component: Component,
7055        variable: Variable,
7056        variable_monitoring: Vec<VariableMonitoring>,
7057    ) -> Self {
7058        Self {
7059            component,
7060            variable,
7061            variable_monitoring,
7062            custom_data: None,
7063        }
7064    }
7065
7066    /// Sets the optional `customData` field.
7067    #[must_use]
7068    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7069        self.custom_data = Some(value);
7070        self
7071    }
7072}
7073
7074impl Validate for MonitoringData {
7075    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7076        path.push_key("component");
7077        Validate::validate_at(&self.component, path, out);
7078        path.pop();
7079        path.push_key("variable");
7080        Validate::validate_at(&self.variable, path, out);
7081        path.pop();
7082        path.push_key("variableMonitoring");
7083        validate::list_len(self.variable_monitoring.len(), Some(1), None, path, out);
7084        for (index, item) in self.variable_monitoring.iter().enumerate() {
7085            path.push_index(index);
7086            Validate::validate_at(item, path, out);
7087            path.pop();
7088        }
7089        path.pop();
7090        path.push_key("customData");
7091        if let Some(value) = &self.custom_data {
7092            Validate::validate_at(value, path, out);
7093        }
7094        path.pop();
7095    }
7096}
7097
7098/// The NetworkConnectionProfile defines the functional and technical parameters of a communication link.
7099///
7100/// The OCPP 2.1 `NetworkConnectionProfile` data type.
7101#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7102pub struct NetworkConnectionProfile {
7103    /// The `ocppInterface` member.
7104    #[serde(rename = "ocppInterface")]
7105    pub ocpp_interface: OCPPInterface,
7106    /// The `ocppTransport` member.
7107    #[serde(rename = "ocppTransport")]
7108    pub ocpp_transport: OCPPTransport,
7109    /// Duration in seconds before a message send by the Charging Station via this network connection times-out.
7110    /// The best setting depends on the underlying network and response times of the CSMS.
7111    /// If you are looking for a some guideline: use 30 seconds as a starting point.
7112    #[serde(rename = "messageTimeout")]
7113    pub message_timeout: i32,
7114    /// URL of the CSMS(s) that this Charging Station communicates with, without the Charging Station identity part. +
7115    /// The SecurityCtrlr.Identity field is appended to _ocppCsmsUrl_ to provide the full websocket URL.
7116    #[serde(rename = "ocppCsmsUrl")]
7117    pub ocpp_csms_url: String,
7118    /// This field specifies the security profile used when connecting to the CSMS with this NetworkConnectionProfile.
7119    #[serde(rename = "securityProfile")]
7120    pub security_profile: i32,
7121    /// The `apn` member.
7122    #[serde(default, skip_serializing_if = "Option::is_none")]
7123    pub apn: Option<APN>,
7124    /// The `ocppVersion` member.
7125    #[serde(rename = "ocppVersion")]
7126    #[serde(default, skip_serializing_if = "Option::is_none")]
7127    pub ocpp_version: Option<OCPPVersion>,
7128    /// *(2.1)* Charging Station identity to be used as the basic authentication username.
7129    #[serde(default, skip_serializing_if = "Option::is_none")]
7130    pub identity: Option<String>,
7131    /// *(2.1)* BasicAuthPassword to use for security profile 1 or 2.
7132    #[serde(rename = "basicAuthPassword")]
7133    #[serde(default, skip_serializing_if = "Option::is_none")]
7134    pub basic_auth_password: Option<String>,
7135    /// The `vpn` member.
7136    #[serde(default, skip_serializing_if = "Option::is_none")]
7137    pub vpn: Option<VPN>,
7138    /// The `customData` member.
7139    #[serde(rename = "customData")]
7140    #[serde(default, skip_serializing_if = "Option::is_none")]
7141    pub custom_data: Option<crate::types::CustomData>,
7142}
7143
7144impl NetworkConnectionProfile {
7145    /// Creates a `NetworkConnectionProfile` from its required fields.
7146    #[must_use]
7147    pub fn new(
7148        ocpp_interface: OCPPInterface,
7149        ocpp_transport: OCPPTransport,
7150        message_timeout: i32,
7151        ocpp_csms_url: impl Into<String>,
7152        security_profile: i32,
7153    ) -> Self {
7154        Self {
7155            ocpp_interface,
7156            ocpp_transport,
7157            message_timeout,
7158            ocpp_csms_url: ocpp_csms_url.into(),
7159            security_profile,
7160            apn: None,
7161            ocpp_version: None,
7162            identity: None,
7163            basic_auth_password: None,
7164            vpn: None,
7165            custom_data: None,
7166        }
7167    }
7168
7169    /// Sets the optional `apn` field.
7170    #[must_use]
7171    pub fn with_apn(mut self, value: APN) -> Self {
7172        self.apn = Some(value);
7173        self
7174    }
7175
7176    /// Sets the optional `ocppVersion` field.
7177    #[must_use]
7178    pub fn with_ocpp_version(mut self, value: OCPPVersion) -> Self {
7179        self.ocpp_version = Some(value);
7180        self
7181    }
7182
7183    /// Sets the optional `identity` field.
7184    #[must_use]
7185    pub fn with_identity(mut self, value: impl Into<String>) -> Self {
7186        self.identity = Some(value.into());
7187        self
7188    }
7189
7190    /// Sets the optional `basicAuthPassword` field.
7191    #[must_use]
7192    pub fn with_basic_auth_password(mut self, value: impl Into<String>) -> Self {
7193        self.basic_auth_password = Some(value.into());
7194        self
7195    }
7196
7197    /// Sets the optional `vpn` field.
7198    #[must_use]
7199    pub fn with_vpn(mut self, value: VPN) -> Self {
7200        self.vpn = Some(value);
7201        self
7202    }
7203
7204    /// Sets the optional `customData` field.
7205    #[must_use]
7206    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7207        self.custom_data = Some(value);
7208        self
7209    }
7210}
7211
7212impl Validate for NetworkConnectionProfile {
7213    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7214        path.push_key("ocppInterface");
7215        Validate::validate_at(&self.ocpp_interface, path, out);
7216        path.pop();
7217        path.push_key("ocppTransport");
7218        Validate::validate_at(&self.ocpp_transport, path, out);
7219        path.pop();
7220        path.push_key("ocppCsmsUrl");
7221        validate::string(self.ocpp_csms_url.as_str(), None, Some(2000), path, out);
7222        path.pop();
7223        path.push_key("securityProfile");
7224        validate::int_range(i64::from(self.security_profile), Some(0), None, path, out);
7225        path.pop();
7226        path.push_key("apn");
7227        if let Some(value) = &self.apn {
7228            Validate::validate_at(value, path, out);
7229        }
7230        path.pop();
7231        path.push_key("ocppVersion");
7232        if let Some(value) = &self.ocpp_version {
7233            Validate::validate_at(value, path, out);
7234        }
7235        path.pop();
7236        path.push_key("identity");
7237        if let Some(value) = &self.identity {
7238            validate::string(value.as_str(), None, Some(48), path, out);
7239        }
7240        path.pop();
7241        path.push_key("basicAuthPassword");
7242        if let Some(value) = &self.basic_auth_password {
7243            validate::string(value.as_str(), None, Some(64), path, out);
7244        }
7245        path.pop();
7246        path.push_key("vpn");
7247        if let Some(value) = &self.vpn {
7248            Validate::validate_at(value, path, out);
7249        }
7250        path.pop();
7251        path.push_key("customData");
7252        if let Some(value) = &self.custom_data {
7253            Validate::validate_at(value, path, out);
7254        }
7255        path.pop();
7256    }
7257}
7258
7259/// Information about a certificate for an OCSP check.
7260///
7261/// The OCPP 2.1 `OCSPRequestData` data type.
7262#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7263pub struct OCSPRequestData {
7264    /// The `hashAlgorithm` member.
7265    #[serde(rename = "hashAlgorithm")]
7266    pub hash_algorithm: HashAlgorithm,
7267    /// The hash of the issuer’s distinguished
7268    /// name (DN), that must be calculated over the DER
7269    /// encoding of the issuer’s name field in the certificate
7270    /// being checked.
7271    #[serde(rename = "issuerNameHash")]
7272    pub issuer_name_hash: String,
7273    /// The hash of the DER encoded public key:
7274    /// the value (excluding tag and length) of the subject
7275    /// public key field in the issuer’s certificate.
7276    #[serde(rename = "issuerKeyHash")]
7277    pub issuer_key_hash: String,
7278    /// The string representation of the
7279    /// hexadecimal value of the serial number without the
7280    /// prefix "0x" and without leading zeroes.
7281    #[serde(rename = "serialNumber")]
7282    pub serial_number: String,
7283    /// This contains the responder URL (Case insensitive).
7284    #[serde(rename = "responderURL")]
7285    pub responder_url: String,
7286    /// The `customData` member.
7287    #[serde(rename = "customData")]
7288    #[serde(default, skip_serializing_if = "Option::is_none")]
7289    pub custom_data: Option<crate::types::CustomData>,
7290}
7291
7292impl OCSPRequestData {
7293    /// Creates a `OCSPRequestData` from its required fields.
7294    #[must_use]
7295    pub fn new(
7296        hash_algorithm: HashAlgorithm,
7297        issuer_name_hash: impl Into<String>,
7298        issuer_key_hash: impl Into<String>,
7299        serial_number: impl Into<String>,
7300        responder_url: impl Into<String>,
7301    ) -> Self {
7302        Self {
7303            hash_algorithm,
7304            issuer_name_hash: issuer_name_hash.into(),
7305            issuer_key_hash: issuer_key_hash.into(),
7306            serial_number: serial_number.into(),
7307            responder_url: responder_url.into(),
7308            custom_data: None,
7309        }
7310    }
7311
7312    /// Sets the optional `customData` field.
7313    #[must_use]
7314    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7315        self.custom_data = Some(value);
7316        self
7317    }
7318}
7319
7320impl Validate for OCSPRequestData {
7321    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7322        path.push_key("hashAlgorithm");
7323        Validate::validate_at(&self.hash_algorithm, path, out);
7324        path.pop();
7325        path.push_key("issuerNameHash");
7326        validate::string(self.issuer_name_hash.as_str(), None, Some(128), path, out);
7327        path.pop();
7328        path.push_key("issuerKeyHash");
7329        validate::string(self.issuer_key_hash.as_str(), None, Some(128), path, out);
7330        path.pop();
7331        path.push_key("serialNumber");
7332        validate::string(self.serial_number.as_str(), None, Some(40), path, out);
7333        path.pop();
7334        path.push_key("responderURL");
7335        validate::string(self.responder_url.as_str(), None, Some(2000), path, out);
7336        path.pop();
7337        path.push_key("customData");
7338        if let Some(value) = &self.custom_data {
7339            Validate::validate_at(value, path, out);
7340        }
7341        path.pop();
7342    }
7343}
7344
7345/// Part of ISO 15118-20 price schedule.
7346///
7347/// The OCPP 2.1 `OverstayRule` data type.
7348#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7349pub struct OverstayRule {
7350    /// The `overstayFee` member.
7351    #[serde(rename = "overstayFee")]
7352    pub overstay_fee: RationalNumber,
7353    /// Time in seconds after trigger of the parent Overstay Rules for this particular fee to apply.
7354    #[serde(rename = "startTime")]
7355    pub start_time: i32,
7356    /// Time till overstay will be reapplied
7357    #[serde(rename = "overstayFeePeriod")]
7358    pub overstay_fee_period: i32,
7359    /// Human readable string to identify the overstay rule.
7360    #[serde(rename = "overstayRuleDescription")]
7361    #[serde(default, skip_serializing_if = "Option::is_none")]
7362    pub overstay_rule_description: Option<String>,
7363    /// The `customData` member.
7364    #[serde(rename = "customData")]
7365    #[serde(default, skip_serializing_if = "Option::is_none")]
7366    pub custom_data: Option<crate::types::CustomData>,
7367}
7368
7369impl OverstayRule {
7370    /// Creates a `OverstayRule` from its required fields.
7371    #[must_use]
7372    pub fn new(overstay_fee: RationalNumber, start_time: i32, overstay_fee_period: i32) -> Self {
7373        Self {
7374            overstay_fee,
7375            start_time,
7376            overstay_fee_period,
7377            overstay_rule_description: None,
7378            custom_data: None,
7379        }
7380    }
7381
7382    /// Sets the optional `overstayRuleDescription` field.
7383    #[must_use]
7384    pub fn with_overstay_rule_description(mut self, value: impl Into<String>) -> Self {
7385        self.overstay_rule_description = Some(value.into());
7386        self
7387    }
7388
7389    /// Sets the optional `customData` field.
7390    #[must_use]
7391    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7392        self.custom_data = Some(value);
7393        self
7394    }
7395}
7396
7397impl Validate for OverstayRule {
7398    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7399        path.push_key("overstayFee");
7400        Validate::validate_at(&self.overstay_fee, path, out);
7401        path.pop();
7402        path.push_key("overstayRuleDescription");
7403        if let Some(value) = &self.overstay_rule_description {
7404            validate::string(value.as_str(), None, Some(32), path, out);
7405        }
7406        path.pop();
7407        path.push_key("customData");
7408        if let Some(value) = &self.custom_data {
7409            Validate::validate_at(value, path, out);
7410        }
7411        path.pop();
7412    }
7413}
7414
7415/// Part of ISO 15118-20 price schedule.
7416///
7417/// The OCPP 2.1 `OverstayRuleList` data type.
7418#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7419pub struct OverstayRuleList {
7420    /// The `overstayRule` member.
7421    #[serde(rename = "overstayRule")]
7422    pub overstay_rule: Vec<OverstayRule>,
7423    /// The `overstayPowerThreshold` member.
7424    #[serde(rename = "overstayPowerThreshold")]
7425    #[serde(default, skip_serializing_if = "Option::is_none")]
7426    pub overstay_power_threshold: Option<RationalNumber>,
7427    /// Time till overstay is applied in seconds.
7428    #[serde(rename = "overstayTimeThreshold")]
7429    #[serde(default, skip_serializing_if = "Option::is_none")]
7430    pub overstay_time_threshold: Option<i32>,
7431    /// The `customData` member.
7432    #[serde(rename = "customData")]
7433    #[serde(default, skip_serializing_if = "Option::is_none")]
7434    pub custom_data: Option<crate::types::CustomData>,
7435}
7436
7437impl OverstayRuleList {
7438    /// Creates a `OverstayRuleList` from its required fields.
7439    #[must_use]
7440    pub fn new(overstay_rule: Vec<OverstayRule>) -> Self {
7441        Self {
7442            overstay_rule,
7443            overstay_power_threshold: None,
7444            overstay_time_threshold: None,
7445            custom_data: None,
7446        }
7447    }
7448
7449    /// Sets the optional `overstayPowerThreshold` field.
7450    #[must_use]
7451    pub fn with_overstay_power_threshold(mut self, value: RationalNumber) -> Self {
7452        self.overstay_power_threshold = Some(value);
7453        self
7454    }
7455
7456    /// Sets the optional `overstayTimeThreshold` field.
7457    #[must_use]
7458    pub fn with_overstay_time_threshold(mut self, value: i32) -> Self {
7459        self.overstay_time_threshold = Some(value);
7460        self
7461    }
7462
7463    /// Sets the optional `customData` field.
7464    #[must_use]
7465    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7466        self.custom_data = Some(value);
7467        self
7468    }
7469}
7470
7471impl Validate for OverstayRuleList {
7472    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7473        path.push_key("overstayRule");
7474        validate::list_len(self.overstay_rule.len(), Some(1), Some(5), path, out);
7475        for (index, item) in self.overstay_rule.iter().enumerate() {
7476            path.push_index(index);
7477            Validate::validate_at(item, path, out);
7478            path.pop();
7479        }
7480        path.pop();
7481        path.push_key("overstayPowerThreshold");
7482        if let Some(value) = &self.overstay_power_threshold {
7483            Validate::validate_at(value, path, out);
7484        }
7485        path.pop();
7486        path.push_key("customData");
7487        if let Some(value) = &self.custom_data {
7488            Validate::validate_at(value, path, out);
7489        }
7490        path.pop();
7491    }
7492}
7493
7494/// The OCPP 2.1 `PeriodicEventStreamParams` data type.
7495#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7496pub struct PeriodicEventStreamParams {
7497    /// Time in seconds after which stream data is sent.
7498    #[serde(default, skip_serializing_if = "Option::is_none")]
7499    pub interval: Option<i32>,
7500    /// Number of items to be sent together in stream.
7501    #[serde(default, skip_serializing_if = "Option::is_none")]
7502    pub values: Option<i32>,
7503    /// The `customData` member.
7504    #[serde(rename = "customData")]
7505    #[serde(default, skip_serializing_if = "Option::is_none")]
7506    pub custom_data: Option<crate::types::CustomData>,
7507}
7508
7509impl PeriodicEventStreamParams {
7510    /// Creates an empty `PeriodicEventStreamParams`. Every field of this type is optional.
7511    #[must_use]
7512    pub fn new() -> Self {
7513        Self::default()
7514    }
7515
7516    /// Sets the optional `interval` field.
7517    #[must_use]
7518    pub fn with_interval(mut self, value: i32) -> Self {
7519        self.interval = Some(value);
7520        self
7521    }
7522
7523    /// Sets the optional `values` field.
7524    #[must_use]
7525    pub fn with_values(mut self, value: i32) -> Self {
7526        self.values = Some(value);
7527        self
7528    }
7529
7530    /// Sets the optional `customData` field.
7531    #[must_use]
7532    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7533        self.custom_data = Some(value);
7534        self
7535    }
7536}
7537
7538impl Validate for PeriodicEventStreamParams {
7539    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7540        path.push_key("interval");
7541        if let Some(value) = &self.interval {
7542            validate::int_range(i64::from(*value), Some(0), None, path, out);
7543        }
7544        path.pop();
7545        path.push_key("values");
7546        if let Some(value) = &self.values {
7547            validate::int_range(i64::from(*value), Some(0), None, path, out);
7548        }
7549        path.pop();
7550        path.push_key("customData");
7551        if let Some(value) = &self.custom_data {
7552            Validate::validate_at(value, path, out);
7553        }
7554        path.pop();
7555    }
7556}
7557
7558/// Price with and without tax. At least one of _exclTax_, _inclTax_ must be present.
7559///
7560/// The OCPP 2.1 `Price` data type.
7561#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7562pub struct Price {
7563    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
7564    #[serde(rename = "exclTax")]
7565    #[serde(default, skip_serializing_if = "Option::is_none")]
7566    pub excl_tax: Option<crate::types::Decimal>,
7567    /// Price/cost including tax. Can be absent if _exclTax_ is present.
7568    #[serde(rename = "inclTax")]
7569    #[serde(default, skip_serializing_if = "Option::is_none")]
7570    pub incl_tax: Option<crate::types::Decimal>,
7571    /// The `taxRates` member.
7572    #[serde(rename = "taxRates")]
7573    #[serde(default, skip_serializing_if = "Option::is_none")]
7574    pub tax_rates: Option<Vec<TaxRate>>,
7575    /// The `customData` member.
7576    #[serde(rename = "customData")]
7577    #[serde(default, skip_serializing_if = "Option::is_none")]
7578    pub custom_data: Option<crate::types::CustomData>,
7579}
7580
7581impl Price {
7582    /// Creates an empty `Price`. Every field of this type is optional.
7583    #[must_use]
7584    pub fn new() -> Self {
7585        Self::default()
7586    }
7587
7588    /// Sets the optional `exclTax` field.
7589    #[must_use]
7590    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7591        self.excl_tax = Some(value.into());
7592        self
7593    }
7594
7595    /// Sets the optional `inclTax` field.
7596    #[must_use]
7597    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7598        self.incl_tax = Some(value.into());
7599        self
7600    }
7601
7602    /// Sets the optional `taxRates` field.
7603    #[must_use]
7604    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
7605        self.tax_rates = Some(value);
7606        self
7607    }
7608
7609    /// Sets the optional `customData` field.
7610    #[must_use]
7611    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7612        self.custom_data = Some(value);
7613        self
7614    }
7615}
7616
7617impl Validate for Price {
7618    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7619        path.push_key("taxRates");
7620        if let Some(value) = &self.tax_rates {
7621            validate::list_len(value.len(), Some(1), Some(5), path, out);
7622            for (index, item) in value.iter().enumerate() {
7623                path.push_index(index);
7624                Validate::validate_at(item, path, out);
7625                path.pop();
7626            }
7627        }
7628        path.pop();
7629        path.push_key("customData");
7630        if let Some(value) = &self.custom_data {
7631            Validate::validate_at(value, path, out);
7632        }
7633        path.pop();
7634    }
7635}
7636
7637/// 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.
7638///
7639/// The OCPP 2.1 `PriceLevelSchedule` data type.
7640#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7641pub struct PriceLevelSchedule {
7642    /// The `priceLevelScheduleEntries` member.
7643    #[serde(rename = "priceLevelScheduleEntries")]
7644    pub price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7645    /// Starting point of this price schedule.
7646    #[serde(rename = "timeAnchor")]
7647    pub time_anchor: crate::types::DateTime,
7648    /// Unique ID of this price schedule.
7649    #[serde(rename = "priceScheduleId")]
7650    pub price_schedule_id: i32,
7651    /// Defines the overall number of distinct price level elements used across all PriceLevelSchedules.
7652    #[serde(rename = "numberOfPriceLevels")]
7653    pub number_of_price_levels: i32,
7654    /// Description of the price schedule.
7655    #[serde(rename = "priceScheduleDescription")]
7656    #[serde(default, skip_serializing_if = "Option::is_none")]
7657    pub price_schedule_description: Option<String>,
7658    /// The `customData` member.
7659    #[serde(rename = "customData")]
7660    #[serde(default, skip_serializing_if = "Option::is_none")]
7661    pub custom_data: Option<crate::types::CustomData>,
7662}
7663
7664impl PriceLevelSchedule {
7665    /// Creates a `PriceLevelSchedule` from its required fields.
7666    #[must_use]
7667    pub fn new(
7668        price_level_schedule_entries: Vec<PriceLevelScheduleEntry>,
7669        time_anchor: impl Into<crate::types::DateTime>,
7670        price_schedule_id: i32,
7671        number_of_price_levels: i32,
7672    ) -> Self {
7673        Self {
7674            price_level_schedule_entries,
7675            time_anchor: time_anchor.into(),
7676            price_schedule_id,
7677            number_of_price_levels,
7678            price_schedule_description: None,
7679            custom_data: None,
7680        }
7681    }
7682
7683    /// Sets the optional `priceScheduleDescription` field.
7684    #[must_use]
7685    pub fn with_price_schedule_description(mut self, value: impl Into<String>) -> Self {
7686        self.price_schedule_description = Some(value.into());
7687        self
7688    }
7689
7690    /// Sets the optional `customData` field.
7691    #[must_use]
7692    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7693        self.custom_data = Some(value);
7694        self
7695    }
7696}
7697
7698impl Validate for PriceLevelSchedule {
7699    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7700        path.push_key("priceLevelScheduleEntries");
7701        validate::list_len(
7702            self.price_level_schedule_entries.len(),
7703            Some(1),
7704            Some(100),
7705            path,
7706            out,
7707        );
7708        for (index, item) in self.price_level_schedule_entries.iter().enumerate() {
7709            path.push_index(index);
7710            Validate::validate_at(item, path, out);
7711            path.pop();
7712        }
7713        path.pop();
7714        path.push_key("priceScheduleId");
7715        validate::int_range(i64::from(self.price_schedule_id), Some(0), None, path, out);
7716        path.pop();
7717        path.push_key("numberOfPriceLevels");
7718        validate::int_range(
7719            i64::from(self.number_of_price_levels),
7720            Some(0),
7721            None,
7722            path,
7723            out,
7724        );
7725        path.pop();
7726        path.push_key("priceScheduleDescription");
7727        if let Some(value) = &self.price_schedule_description {
7728            validate::string(value.as_str(), None, Some(32), path, out);
7729        }
7730        path.pop();
7731        path.push_key("customData");
7732        if let Some(value) = &self.custom_data {
7733            Validate::validate_at(value, path, out);
7734        }
7735        path.pop();
7736    }
7737}
7738
7739/// Part of ISO 15118-20 price schedule.
7740///
7741/// The OCPP 2.1 `PriceLevelScheduleEntry` data type.
7742#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7743pub struct PriceLevelScheduleEntry {
7744    /// The amount of seconds that define the duration of this given PriceLevelScheduleEntry.
7745    pub duration: i32,
7746    /// 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.
7747    #[serde(rename = "priceLevel")]
7748    pub price_level: i32,
7749    /// The `customData` member.
7750    #[serde(rename = "customData")]
7751    #[serde(default, skip_serializing_if = "Option::is_none")]
7752    pub custom_data: Option<crate::types::CustomData>,
7753}
7754
7755impl PriceLevelScheduleEntry {
7756    /// Creates a `PriceLevelScheduleEntry` from its required fields.
7757    #[must_use]
7758    pub fn new(duration: i32, price_level: i32) -> Self {
7759        Self {
7760            duration,
7761            price_level,
7762            custom_data: None,
7763        }
7764    }
7765
7766    /// Sets the optional `customData` field.
7767    #[must_use]
7768    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7769        self.custom_data = Some(value);
7770        self
7771    }
7772}
7773
7774impl Validate for PriceLevelScheduleEntry {
7775    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7776        path.push_key("priceLevel");
7777        validate::int_range(i64::from(self.price_level), Some(0), None, path, out);
7778        path.pop();
7779        path.push_key("customData");
7780        if let Some(value) = &self.custom_data {
7781            Validate::validate_at(value, path, out);
7782        }
7783        path.pop();
7784    }
7785}
7786
7787/// Part of ISO 15118-20 price schedule.
7788///
7789/// The OCPP 2.1 `PriceRule` data type.
7790#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7791pub struct PriceRule {
7792    /// The `energyFee` member.
7793    #[serde(rename = "energyFee")]
7794    pub energy_fee: RationalNumber,
7795    /// The `powerRangeStart` member.
7796    #[serde(rename = "powerRangeStart")]
7797    pub power_range_start: RationalNumber,
7798    /// The duration of the parking fee period (in seconds).
7799    /// When the time enters into a ParkingFeePeriod, the ParkingFee will apply to the session. .
7800    #[serde(rename = "parkingFeePeriod")]
7801    #[serde(default, skip_serializing_if = "Option::is_none")]
7802    pub parking_fee_period: Option<i32>,
7803    /// Number of grams of CO2 per kWh.
7804    #[serde(rename = "carbonDioxideEmission")]
7805    #[serde(default, skip_serializing_if = "Option::is_none")]
7806    pub carbon_dioxide_emission: Option<i32>,
7807    /// Percentage of the power that is created by renewable resources.
7808    #[serde(rename = "renewableGenerationPercentage")]
7809    #[serde(default, skip_serializing_if = "Option::is_none")]
7810    pub renewable_generation_percentage: Option<i32>,
7811    /// The `parkingFee` member.
7812    #[serde(rename = "parkingFee")]
7813    #[serde(default, skip_serializing_if = "Option::is_none")]
7814    pub parking_fee: Option<RationalNumber>,
7815    /// The `customData` member.
7816    #[serde(rename = "customData")]
7817    #[serde(default, skip_serializing_if = "Option::is_none")]
7818    pub custom_data: Option<crate::types::CustomData>,
7819}
7820
7821impl PriceRule {
7822    /// Creates a `PriceRule` from its required fields.
7823    #[must_use]
7824    pub fn new(energy_fee: RationalNumber, power_range_start: RationalNumber) -> Self {
7825        Self {
7826            energy_fee,
7827            power_range_start,
7828            parking_fee_period: None,
7829            carbon_dioxide_emission: None,
7830            renewable_generation_percentage: None,
7831            parking_fee: None,
7832            custom_data: None,
7833        }
7834    }
7835
7836    /// Sets the optional `parkingFeePeriod` field.
7837    #[must_use]
7838    pub fn with_parking_fee_period(mut self, value: i32) -> Self {
7839        self.parking_fee_period = Some(value);
7840        self
7841    }
7842
7843    /// Sets the optional `carbonDioxideEmission` field.
7844    #[must_use]
7845    pub fn with_carbon_dioxide_emission(mut self, value: i32) -> Self {
7846        self.carbon_dioxide_emission = Some(value);
7847        self
7848    }
7849
7850    /// Sets the optional `renewableGenerationPercentage` field.
7851    #[must_use]
7852    pub fn with_renewable_generation_percentage(mut self, value: i32) -> Self {
7853        self.renewable_generation_percentage = Some(value);
7854        self
7855    }
7856
7857    /// Sets the optional `parkingFee` field.
7858    #[must_use]
7859    pub fn with_parking_fee(mut self, value: RationalNumber) -> Self {
7860        self.parking_fee = Some(value);
7861        self
7862    }
7863
7864    /// Sets the optional `customData` field.
7865    #[must_use]
7866    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7867        self.custom_data = Some(value);
7868        self
7869    }
7870}
7871
7872impl Validate for PriceRule {
7873    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7874        path.push_key("energyFee");
7875        Validate::validate_at(&self.energy_fee, path, out);
7876        path.pop();
7877        path.push_key("powerRangeStart");
7878        Validate::validate_at(&self.power_range_start, path, out);
7879        path.pop();
7880        path.push_key("carbonDioxideEmission");
7881        if let Some(value) = &self.carbon_dioxide_emission {
7882            validate::int_range(i64::from(*value), Some(0), None, path, out);
7883        }
7884        path.pop();
7885        path.push_key("renewableGenerationPercentage");
7886        if let Some(value) = &self.renewable_generation_percentage {
7887            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
7888        }
7889        path.pop();
7890        path.push_key("parkingFee");
7891        if let Some(value) = &self.parking_fee {
7892            Validate::validate_at(value, path, out);
7893        }
7894        path.pop();
7895        path.push_key("customData");
7896        if let Some(value) = &self.custom_data {
7897            Validate::validate_at(value, path, out);
7898        }
7899        path.pop();
7900    }
7901}
7902
7903/// Part of ISO 15118-20 price schedule.
7904///
7905/// The OCPP 2.1 `PriceRuleStack` data type.
7906#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7907pub struct PriceRuleStack {
7908    /// Duration of the stack of price rules.  he amount of seconds that define the duration of the given PriceRule(s).
7909    pub duration: i32,
7910    /// The `priceRule` member.
7911    #[serde(rename = "priceRule")]
7912    pub price_rule: Vec<PriceRule>,
7913    /// The `customData` member.
7914    #[serde(rename = "customData")]
7915    #[serde(default, skip_serializing_if = "Option::is_none")]
7916    pub custom_data: Option<crate::types::CustomData>,
7917}
7918
7919impl PriceRuleStack {
7920    /// Creates a `PriceRuleStack` from its required fields.
7921    #[must_use]
7922    pub fn new(duration: i32, price_rule: Vec<PriceRule>) -> Self {
7923        Self {
7924            duration,
7925            price_rule,
7926            custom_data: None,
7927        }
7928    }
7929
7930    /// Sets the optional `customData` field.
7931    #[must_use]
7932    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7933        self.custom_data = Some(value);
7934        self
7935    }
7936}
7937
7938impl Validate for PriceRuleStack {
7939    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7940        path.push_key("priceRule");
7941        validate::list_len(self.price_rule.len(), Some(1), Some(8), path, out);
7942        for (index, item) in self.price_rule.iter().enumerate() {
7943            path.push_index(index);
7944            Validate::validate_at(item, path, out);
7945            path.pop();
7946        }
7947        path.pop();
7948        path.push_key("customData");
7949        if let Some(value) = &self.custom_data {
7950            Validate::validate_at(value, path, out);
7951        }
7952        path.pop();
7953    }
7954}
7955
7956/// Part of ISO 15118-20 price schedule.
7957///
7958/// The OCPP 2.1 `RationalNumber` data type.
7959#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7960pub struct RationalNumber {
7961    /// The exponent to base 10 (dec)
7962    pub exponent: i32,
7963    /// Value which shall be multiplied.
7964    pub value: i32,
7965    /// The `customData` member.
7966    #[serde(rename = "customData")]
7967    #[serde(default, skip_serializing_if = "Option::is_none")]
7968    pub custom_data: Option<crate::types::CustomData>,
7969}
7970
7971impl RationalNumber {
7972    /// Creates a `RationalNumber` from its required fields.
7973    #[must_use]
7974    pub fn new(exponent: i32, value: i32) -> Self {
7975        Self {
7976            exponent,
7977            value,
7978            custom_data: None,
7979        }
7980    }
7981
7982    /// Sets the optional `customData` field.
7983    #[must_use]
7984    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7985        self.custom_data = Some(value);
7986        self
7987    }
7988}
7989
7990impl Validate for RationalNumber {
7991    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7992        path.push_key("customData");
7993        if let Some(value) = &self.custom_data {
7994            Validate::validate_at(value, path, out);
7995        }
7996        path.pop();
7997    }
7998}
7999
8000/// The OCPP 2.1 `ReactivePowerParams` data type.
8001#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8002pub struct ReactivePowerParams {
8003    /// Only for VoltVar curve: The nominal ac voltage (rms) adjustment to the voltage curve points for Volt-Var curves (percentage).
8004    #[serde(rename = "vRef")]
8005    #[serde(default, skip_serializing_if = "Option::is_none")]
8006    pub v_ref: Option<crate::types::Decimal>,
8007    /// Only for VoltVar: Enable/disable autonomous VRef adjustment
8008    #[serde(rename = "autonomousVRefEnable")]
8009    #[serde(default, skip_serializing_if = "Option::is_none")]
8010    pub autonomous_v_ref_enable: Option<bool>,
8011    /// Only for VoltVar: Adjustment range for VRef time constant
8012    #[serde(rename = "autonomousVRefTimeConstant")]
8013    #[serde(default, skip_serializing_if = "Option::is_none")]
8014    pub autonomous_v_ref_time_constant: Option<crate::types::Decimal>,
8015    /// The `customData` member.
8016    #[serde(rename = "customData")]
8017    #[serde(default, skip_serializing_if = "Option::is_none")]
8018    pub custom_data: Option<crate::types::CustomData>,
8019}
8020
8021impl ReactivePowerParams {
8022    /// Creates an empty `ReactivePowerParams`. Every field of this type is optional.
8023    #[must_use]
8024    pub fn new() -> Self {
8025        Self::default()
8026    }
8027
8028    /// Sets the optional `vRef` field.
8029    #[must_use]
8030    pub fn with_v_ref(mut self, value: impl Into<crate::types::Decimal>) -> Self {
8031        self.v_ref = Some(value.into());
8032        self
8033    }
8034
8035    /// Sets the optional `autonomousVRefEnable` field.
8036    #[must_use]
8037    pub fn with_autonomous_v_ref_enable(mut self, value: bool) -> Self {
8038        self.autonomous_v_ref_enable = Some(value);
8039        self
8040    }
8041
8042    /// Sets the optional `autonomousVRefTimeConstant` field.
8043    #[must_use]
8044    pub fn with_autonomous_v_ref_time_constant(
8045        mut self,
8046        value: impl Into<crate::types::Decimal>,
8047    ) -> Self {
8048        self.autonomous_v_ref_time_constant = Some(value.into());
8049        self
8050    }
8051
8052    /// Sets the optional `customData` field.
8053    #[must_use]
8054    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8055        self.custom_data = Some(value);
8056        self
8057    }
8058}
8059
8060impl Validate for ReactivePowerParams {
8061    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8062        path.push_key("customData");
8063        if let Some(value) = &self.custom_data {
8064            Validate::validate_at(value, path, out);
8065        }
8066        path.pop();
8067    }
8068}
8069
8070/// The OCPP 2.1 `RelativeTimeInterval` data type.
8071#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8072pub struct RelativeTimeInterval {
8073    /// Start of the interval, in seconds from NOW.
8074    pub start: i32,
8075    /// Duration of the interval, in seconds.
8076    #[serde(default, skip_serializing_if = "Option::is_none")]
8077    pub duration: Option<i32>,
8078    /// The `customData` member.
8079    #[serde(rename = "customData")]
8080    #[serde(default, skip_serializing_if = "Option::is_none")]
8081    pub custom_data: Option<crate::types::CustomData>,
8082}
8083
8084impl RelativeTimeInterval {
8085    /// Creates a `RelativeTimeInterval` from its required fields.
8086    #[must_use]
8087    pub fn new(start: i32) -> Self {
8088        Self {
8089            start,
8090            duration: None,
8091            custom_data: None,
8092        }
8093    }
8094
8095    /// Sets the optional `duration` field.
8096    #[must_use]
8097    pub fn with_duration(mut self, value: i32) -> Self {
8098        self.duration = Some(value);
8099        self
8100    }
8101
8102    /// Sets the optional `customData` field.
8103    #[must_use]
8104    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8105        self.custom_data = Some(value);
8106        self
8107    }
8108}
8109
8110impl Validate for RelativeTimeInterval {
8111    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8112        path.push_key("customData");
8113        if let Some(value) = &self.custom_data {
8114            Validate::validate_at(value, path, out);
8115        }
8116        path.pop();
8117    }
8118}
8119
8120/// Class to report components, variables and variable attributes and characteristics.
8121///
8122/// The OCPP 2.1 `ReportData` data type.
8123#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8124pub struct ReportData {
8125    /// The `component` member.
8126    pub component: Component,
8127    /// The `variable` member.
8128    pub variable: Variable,
8129    /// The `variableAttribute` member.
8130    #[serde(rename = "variableAttribute")]
8131    pub variable_attribute: Vec<VariableAttribute>,
8132    /// The `variableCharacteristics` member.
8133    #[serde(rename = "variableCharacteristics")]
8134    #[serde(default, skip_serializing_if = "Option::is_none")]
8135    pub variable_characteristics: Option<VariableCharacteristics>,
8136    /// The `customData` member.
8137    #[serde(rename = "customData")]
8138    #[serde(default, skip_serializing_if = "Option::is_none")]
8139    pub custom_data: Option<crate::types::CustomData>,
8140}
8141
8142impl ReportData {
8143    /// Creates a `ReportData` from its required fields.
8144    #[must_use]
8145    pub fn new(
8146        component: Component,
8147        variable: Variable,
8148        variable_attribute: Vec<VariableAttribute>,
8149    ) -> Self {
8150        Self {
8151            component,
8152            variable,
8153            variable_attribute,
8154            variable_characteristics: None,
8155            custom_data: None,
8156        }
8157    }
8158
8159    /// Sets the optional `variableCharacteristics` field.
8160    #[must_use]
8161    pub fn with_variable_characteristics(mut self, value: VariableCharacteristics) -> Self {
8162        self.variable_characteristics = Some(value);
8163        self
8164    }
8165
8166    /// Sets the optional `customData` field.
8167    #[must_use]
8168    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8169        self.custom_data = Some(value);
8170        self
8171    }
8172}
8173
8174impl Validate for ReportData {
8175    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8176        path.push_key("component");
8177        Validate::validate_at(&self.component, path, out);
8178        path.pop();
8179        path.push_key("variable");
8180        Validate::validate_at(&self.variable, path, out);
8181        path.pop();
8182        path.push_key("variableAttribute");
8183        validate::list_len(self.variable_attribute.len(), Some(1), Some(4), path, out);
8184        for (index, item) in self.variable_attribute.iter().enumerate() {
8185            path.push_index(index);
8186            Validate::validate_at(item, path, out);
8187            path.pop();
8188        }
8189        path.pop();
8190        path.push_key("variableCharacteristics");
8191        if let Some(value) = &self.variable_characteristics {
8192            Validate::validate_at(value, path, out);
8193        }
8194        path.pop();
8195        path.push_key("customData");
8196        if let Some(value) = &self.custom_data {
8197            Validate::validate_at(value, path, out);
8198        }
8199        path.pop();
8200    }
8201}
8202
8203/// A SalesTariff provided by a Mobility Operator (EMSP) .
8204/// NOTE: This dataType is based on dataTypes from &lt;&lt;ref-ISOIEC15118-2,ISO 15118-2&gt;&gt;.
8205///
8206/// The OCPP 2.1 `SalesTariff` data type.
8207#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8208pub struct SalesTariff {
8209    /// SalesTariff identifier used to identify one sales tariff. An SAID remains a unique identifier for one schedule throughout a charging session.
8210    pub id: i32,
8211    /// The `salesTariffEntry` member.
8212    #[serde(rename = "salesTariffEntry")]
8213    pub sales_tariff_entry: Vec<SalesTariffEntry>,
8214    /// A human readable title/short description of the sales tariff e.g. for HMI display purposes.
8215    #[serde(rename = "salesTariffDescription")]
8216    #[serde(default, skip_serializing_if = "Option::is_none")]
8217    pub sales_tariff_description: Option<String>,
8218    /// Defines the overall number of distinct price levels used across all provided SalesTariff elements.
8219    #[serde(rename = "numEPriceLevels")]
8220    #[serde(default, skip_serializing_if = "Option::is_none")]
8221    pub num_e_price_levels: Option<i32>,
8222    /// The `customData` member.
8223    #[serde(rename = "customData")]
8224    #[serde(default, skip_serializing_if = "Option::is_none")]
8225    pub custom_data: Option<crate::types::CustomData>,
8226}
8227
8228impl SalesTariff {
8229    /// Creates a `SalesTariff` from its required fields.
8230    #[must_use]
8231    pub fn new(id: i32, sales_tariff_entry: Vec<SalesTariffEntry>) -> Self {
8232        Self {
8233            id,
8234            sales_tariff_entry,
8235            sales_tariff_description: None,
8236            num_e_price_levels: None,
8237            custom_data: None,
8238        }
8239    }
8240
8241    /// Sets the optional `salesTariffDescription` field.
8242    #[must_use]
8243    pub fn with_sales_tariff_description(mut self, value: impl Into<String>) -> Self {
8244        self.sales_tariff_description = Some(value.into());
8245        self
8246    }
8247
8248    /// Sets the optional `numEPriceLevels` field.
8249    #[must_use]
8250    pub fn with_num_e_price_levels(mut self, value: i32) -> Self {
8251        self.num_e_price_levels = Some(value);
8252        self
8253    }
8254
8255    /// Sets the optional `customData` field.
8256    #[must_use]
8257    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8258        self.custom_data = Some(value);
8259        self
8260    }
8261}
8262
8263impl Validate for SalesTariff {
8264    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8265        path.push_key("id");
8266        validate::int_range(i64::from(self.id), Some(0), None, path, out);
8267        path.pop();
8268        path.push_key("salesTariffEntry");
8269        validate::list_len(
8270            self.sales_tariff_entry.len(),
8271            Some(1),
8272            Some(1024),
8273            path,
8274            out,
8275        );
8276        for (index, item) in self.sales_tariff_entry.iter().enumerate() {
8277            path.push_index(index);
8278            Validate::validate_at(item, path, out);
8279            path.pop();
8280        }
8281        path.pop();
8282        path.push_key("salesTariffDescription");
8283        if let Some(value) = &self.sales_tariff_description {
8284            validate::string(value.as_str(), None, Some(32), path, out);
8285        }
8286        path.pop();
8287        path.push_key("numEPriceLevels");
8288        if let Some(value) = &self.num_e_price_levels {
8289            validate::int_range(i64::from(*value), Some(0), None, path, out);
8290        }
8291        path.pop();
8292        path.push_key("customData");
8293        if let Some(value) = &self.custom_data {
8294            Validate::validate_at(value, path, out);
8295        }
8296        path.pop();
8297    }
8298}
8299
8300/// The OCPP 2.1 `SalesTariffEntry` data type.
8301#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8302pub struct SalesTariffEntry {
8303    /// The `relativeTimeInterval` member.
8304    #[serde(rename = "relativeTimeInterval")]
8305    pub relative_time_interval: RelativeTimeInterval,
8306    /// 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.
8307    #[serde(rename = "ePriceLevel")]
8308    #[serde(default, skip_serializing_if = "Option::is_none")]
8309    pub e_price_level: Option<i32>,
8310    /// The `consumptionCost` member.
8311    #[serde(rename = "consumptionCost")]
8312    #[serde(default, skip_serializing_if = "Option::is_none")]
8313    pub consumption_cost: Option<Vec<ConsumptionCost>>,
8314    /// The `customData` member.
8315    #[serde(rename = "customData")]
8316    #[serde(default, skip_serializing_if = "Option::is_none")]
8317    pub custom_data: Option<crate::types::CustomData>,
8318}
8319
8320impl SalesTariffEntry {
8321    /// Creates a `SalesTariffEntry` from its required fields.
8322    #[must_use]
8323    pub fn new(relative_time_interval: RelativeTimeInterval) -> Self {
8324        Self {
8325            relative_time_interval,
8326            e_price_level: None,
8327            consumption_cost: None,
8328            custom_data: None,
8329        }
8330    }
8331
8332    /// Sets the optional `ePriceLevel` field.
8333    #[must_use]
8334    pub fn with_e_price_level(mut self, value: i32) -> Self {
8335        self.e_price_level = Some(value);
8336        self
8337    }
8338
8339    /// Sets the optional `consumptionCost` field.
8340    #[must_use]
8341    pub fn with_consumption_cost(mut self, value: Vec<ConsumptionCost>) -> Self {
8342        self.consumption_cost = Some(value);
8343        self
8344    }
8345
8346    /// Sets the optional `customData` field.
8347    #[must_use]
8348    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8349        self.custom_data = Some(value);
8350        self
8351    }
8352}
8353
8354impl Validate for SalesTariffEntry {
8355    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8356        path.push_key("relativeTimeInterval");
8357        Validate::validate_at(&self.relative_time_interval, path, out);
8358        path.pop();
8359        path.push_key("ePriceLevel");
8360        if let Some(value) = &self.e_price_level {
8361            validate::int_range(i64::from(*value), Some(0), None, path, out);
8362        }
8363        path.pop();
8364        path.push_key("consumptionCost");
8365        if let Some(value) = &self.consumption_cost {
8366            validate::list_len(value.len(), Some(1), Some(3), path, out);
8367            for (index, item) in value.iter().enumerate() {
8368                path.push_index(index);
8369                Validate::validate_at(item, path, out);
8370                path.pop();
8371            }
8372        }
8373        path.pop();
8374        path.push_key("customData");
8375        if let Some(value) = &self.custom_data {
8376            Validate::validate_at(value, path, out);
8377        }
8378        path.pop();
8379    }
8380}
8381
8382/// Single sampled value in MeterValues. Each value can be accompanied by optional fields.
8383///
8384/// 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.
8385///
8386/// The OCPP 2.1 `SampledValue` data type.
8387#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8388pub struct SampledValue {
8389    /// Indicates the measured value.
8390    pub value: crate::types::Decimal,
8391    /// The `measurand` member.
8392    #[serde(default, skip_serializing_if = "Option::is_none")]
8393    pub measurand: Option<Measurand>,
8394    /// The `context` member.
8395    #[serde(default, skip_serializing_if = "Option::is_none")]
8396    pub context: Option<ReadingContext>,
8397    /// The `phase` member.
8398    #[serde(default, skip_serializing_if = "Option::is_none")]
8399    pub phase: Option<Phase>,
8400    /// The `location` member.
8401    #[serde(default, skip_serializing_if = "Option::is_none")]
8402    pub location: Option<Location>,
8403    /// The `signedMeterValue` member.
8404    #[serde(rename = "signedMeterValue")]
8405    #[serde(default, skip_serializing_if = "Option::is_none")]
8406    pub signed_meter_value: Option<SignedMeterValue>,
8407    /// The `unitOfMeasure` member.
8408    #[serde(rename = "unitOfMeasure")]
8409    #[serde(default, skip_serializing_if = "Option::is_none")]
8410    pub unit_of_measure: Option<UnitOfMeasure>,
8411    /// The `customData` member.
8412    #[serde(rename = "customData")]
8413    #[serde(default, skip_serializing_if = "Option::is_none")]
8414    pub custom_data: Option<crate::types::CustomData>,
8415}
8416
8417impl SampledValue {
8418    /// Creates a `SampledValue` from its required fields.
8419    #[must_use]
8420    pub fn new(value: impl Into<crate::types::Decimal>) -> Self {
8421        Self {
8422            value: value.into(),
8423            measurand: None,
8424            context: None,
8425            phase: None,
8426            location: None,
8427            signed_meter_value: None,
8428            unit_of_measure: None,
8429            custom_data: None,
8430        }
8431    }
8432
8433    /// Sets the optional `measurand` field.
8434    #[must_use]
8435    pub fn with_measurand(mut self, value: Measurand) -> Self {
8436        self.measurand = Some(value);
8437        self
8438    }
8439
8440    /// Sets the optional `context` field.
8441    #[must_use]
8442    pub fn with_context(mut self, value: ReadingContext) -> Self {
8443        self.context = Some(value);
8444        self
8445    }
8446
8447    /// Sets the optional `phase` field.
8448    #[must_use]
8449    pub fn with_phase(mut self, value: Phase) -> Self {
8450        self.phase = Some(value);
8451        self
8452    }
8453
8454    /// Sets the optional `location` field.
8455    #[must_use]
8456    pub fn with_location(mut self, value: Location) -> Self {
8457        self.location = Some(value);
8458        self
8459    }
8460
8461    /// Sets the optional `signedMeterValue` field.
8462    #[must_use]
8463    pub fn with_signed_meter_value(mut self, value: SignedMeterValue) -> Self {
8464        self.signed_meter_value = Some(value);
8465        self
8466    }
8467
8468    /// Sets the optional `unitOfMeasure` field.
8469    #[must_use]
8470    pub fn with_unit_of_measure(mut self, value: UnitOfMeasure) -> Self {
8471        self.unit_of_measure = Some(value);
8472        self
8473    }
8474
8475    /// Sets the optional `customData` field.
8476    #[must_use]
8477    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8478        self.custom_data = Some(value);
8479        self
8480    }
8481}
8482
8483impl Validate for SampledValue {
8484    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8485        path.push_key("measurand");
8486        if let Some(value) = &self.measurand {
8487            Validate::validate_at(value, path, out);
8488        }
8489        path.pop();
8490        path.push_key("context");
8491        if let Some(value) = &self.context {
8492            Validate::validate_at(value, path, out);
8493        }
8494        path.pop();
8495        path.push_key("phase");
8496        if let Some(value) = &self.phase {
8497            Validate::validate_at(value, path, out);
8498        }
8499        path.pop();
8500        path.push_key("location");
8501        if let Some(value) = &self.location {
8502            Validate::validate_at(value, path, out);
8503        }
8504        path.pop();
8505        path.push_key("signedMeterValue");
8506        if let Some(value) = &self.signed_meter_value {
8507            Validate::validate_at(value, path, out);
8508        }
8509        path.pop();
8510        path.push_key("unitOfMeasure");
8511        if let Some(value) = &self.unit_of_measure {
8512            Validate::validate_at(value, path, out);
8513        }
8514        path.pop();
8515        path.push_key("customData");
8516        if let Some(value) = &self.custom_data {
8517            Validate::validate_at(value, path, out);
8518        }
8519        path.pop();
8520    }
8521}
8522
8523/// Class to hold parameters of SetVariableMonitoring request.
8524///
8525/// The OCPP 2.1 `SetMonitoringData` data type.
8526#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8527pub struct SetMonitoringData {
8528    /// Value for threshold or delta monitoring.
8529    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
8530    pub value: crate::types::Decimal,
8531    /// The `type` member.
8532    pub r#type: Monitor,
8533    /// 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.
8534    ///
8535    /// The severity levels have the following meaning: +
8536    /// *0-Danger* +
8537    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8538    /// *1-Hardware Failure* +
8539    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8540    /// *2-System Failure* +
8541    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8542    /// *3-Critical* +
8543    /// Indicates a critical error. Action is required. +
8544    /// *4-Error* +
8545    /// Indicates a non-urgent error. Action is required. +
8546    /// *5-Alert* +
8547    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8548    /// *6-Warning* +
8549    /// Indicates a warning event. Action may be required. +
8550    /// *7-Notice* +
8551    /// Indicates an unusual event. No immediate action is required. +
8552    /// *8-Informational* +
8553    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8554    /// *9-Debug* +
8555    /// Indicates information useful to developers for debugging, not useful during operations.
8556    pub severity: i32,
8557    /// The `component` member.
8558    pub component: Component,
8559    /// The `variable` member.
8560    pub variable: Variable,
8561    /// An id SHALL only be given to replace an existing monitor. The Charging Station handles the generation of id's for new monitors.
8562    #[serde(default, skip_serializing_if = "Option::is_none")]
8563    pub id: Option<i32>,
8564    /// The `periodicEventStream` member.
8565    #[serde(rename = "periodicEventStream")]
8566    #[serde(default, skip_serializing_if = "Option::is_none")]
8567    pub periodic_event_stream: Option<PeriodicEventStreamParams>,
8568    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction. Default = false.
8569    /// Schema default: `false`.
8570    #[serde(default, skip_serializing_if = "Option::is_none")]
8571    pub transaction: Option<bool>,
8572    /// The `customData` member.
8573    #[serde(rename = "customData")]
8574    #[serde(default, skip_serializing_if = "Option::is_none")]
8575    pub custom_data: Option<crate::types::CustomData>,
8576}
8577
8578impl SetMonitoringData {
8579    /// Creates a `SetMonitoringData` from its required fields.
8580    #[must_use]
8581    pub fn new(
8582        value: impl Into<crate::types::Decimal>,
8583        r#type: Monitor,
8584        severity: i32,
8585        component: Component,
8586        variable: Variable,
8587    ) -> Self {
8588        Self {
8589            value: value.into(),
8590            r#type,
8591            severity,
8592            component,
8593            variable,
8594            id: None,
8595            periodic_event_stream: None,
8596            transaction: None,
8597            custom_data: None,
8598        }
8599    }
8600
8601    /// Sets the optional `id` field.
8602    #[must_use]
8603    pub fn with_id(mut self, value: i32) -> Self {
8604        self.id = Some(value);
8605        self
8606    }
8607
8608    /// Sets the optional `periodicEventStream` field.
8609    #[must_use]
8610    pub fn with_periodic_event_stream(mut self, value: PeriodicEventStreamParams) -> Self {
8611        self.periodic_event_stream = Some(value);
8612        self
8613    }
8614
8615    /// Sets the optional `transaction` field.
8616    #[must_use]
8617    pub fn with_transaction(mut self, value: bool) -> Self {
8618        self.transaction = Some(value);
8619        self
8620    }
8621
8622    /// Sets the optional `customData` field.
8623    #[must_use]
8624    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8625        self.custom_data = Some(value);
8626        self
8627    }
8628}
8629
8630impl Validate for SetMonitoringData {
8631    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8632        path.push_key("type");
8633        Validate::validate_at(&self.r#type, path, out);
8634        path.pop();
8635        path.push_key("severity");
8636        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
8637        path.pop();
8638        path.push_key("component");
8639        Validate::validate_at(&self.component, path, out);
8640        path.pop();
8641        path.push_key("variable");
8642        Validate::validate_at(&self.variable, path, out);
8643        path.pop();
8644        path.push_key("id");
8645        if let Some(value) = &self.id {
8646            validate::int_range(i64::from(*value), Some(0), None, path, out);
8647        }
8648        path.pop();
8649        path.push_key("periodicEventStream");
8650        if let Some(value) = &self.periodic_event_stream {
8651            Validate::validate_at(value, path, out);
8652        }
8653        path.pop();
8654        path.push_key("customData");
8655        if let Some(value) = &self.custom_data {
8656            Validate::validate_at(value, path, out);
8657        }
8658        path.pop();
8659    }
8660}
8661
8662/// Class to hold result of SetVariableMonitoring request.
8663///
8664/// The OCPP 2.1 `SetMonitoringResult` data type.
8665#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8666pub struct SetMonitoringResult {
8667    /// The `status` member.
8668    pub status: SetMonitoringStatus,
8669    /// The `type` member.
8670    pub r#type: Monitor,
8671    /// The `component` member.
8672    pub component: Component,
8673    /// The `variable` member.
8674    pub variable: Variable,
8675    /// 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.
8676    ///
8677    /// The severity levels have the following meaning: +
8678    /// *0-Danger* +
8679    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
8680    /// *1-Hardware Failure* +
8681    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
8682    /// *2-System Failure* +
8683    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
8684    /// *3-Critical* +
8685    /// Indicates a critical error. Action is required. +
8686    /// *4-Error* +
8687    /// Indicates a non-urgent error. Action is required. +
8688    /// *5-Alert* +
8689    /// Indicates an alert event. Default severity for any type of monitoring event.  +
8690    /// *6-Warning* +
8691    /// Indicates a warning event. Action may be required. +
8692    /// *7-Notice* +
8693    /// Indicates an unusual event. No immediate action is required. +
8694    /// *8-Informational* +
8695    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
8696    /// *9-Debug* +
8697    /// Indicates information useful to developers for debugging, not useful during operations.
8698    pub severity: i32,
8699    /// 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.
8700    #[serde(default, skip_serializing_if = "Option::is_none")]
8701    pub id: Option<i32>,
8702    /// The `statusInfo` member.
8703    #[serde(rename = "statusInfo")]
8704    #[serde(default, skip_serializing_if = "Option::is_none")]
8705    pub status_info: Option<StatusInfo>,
8706    /// The `customData` member.
8707    #[serde(rename = "customData")]
8708    #[serde(default, skip_serializing_if = "Option::is_none")]
8709    pub custom_data: Option<crate::types::CustomData>,
8710}
8711
8712impl SetMonitoringResult {
8713    /// Creates a `SetMonitoringResult` from its required fields.
8714    #[must_use]
8715    pub fn new(
8716        status: SetMonitoringStatus,
8717        r#type: Monitor,
8718        component: Component,
8719        variable: Variable,
8720        severity: i32,
8721    ) -> Self {
8722        Self {
8723            status,
8724            r#type,
8725            component,
8726            variable,
8727            severity,
8728            id: None,
8729            status_info: None,
8730            custom_data: None,
8731        }
8732    }
8733
8734    /// Sets the optional `id` field.
8735    #[must_use]
8736    pub fn with_id(mut self, value: i32) -> Self {
8737        self.id = Some(value);
8738        self
8739    }
8740
8741    /// Sets the optional `statusInfo` field.
8742    #[must_use]
8743    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8744        self.status_info = Some(value);
8745        self
8746    }
8747
8748    /// Sets the optional `customData` field.
8749    #[must_use]
8750    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8751        self.custom_data = Some(value);
8752        self
8753    }
8754}
8755
8756impl Validate for SetMonitoringResult {
8757    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8758        path.push_key("status");
8759        Validate::validate_at(&self.status, path, out);
8760        path.pop();
8761        path.push_key("type");
8762        Validate::validate_at(&self.r#type, path, out);
8763        path.pop();
8764        path.push_key("component");
8765        Validate::validate_at(&self.component, path, out);
8766        path.pop();
8767        path.push_key("variable");
8768        Validate::validate_at(&self.variable, path, out);
8769        path.pop();
8770        path.push_key("severity");
8771        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
8772        path.pop();
8773        path.push_key("id");
8774        if let Some(value) = &self.id {
8775            validate::int_range(i64::from(*value), Some(0), None, path, out);
8776        }
8777        path.pop();
8778        path.push_key("statusInfo");
8779        if let Some(value) = &self.status_info {
8780            Validate::validate_at(value, path, out);
8781        }
8782        path.pop();
8783        path.push_key("customData");
8784        if let Some(value) = &self.custom_data {
8785            Validate::validate_at(value, path, out);
8786        }
8787        path.pop();
8788    }
8789}
8790
8791/// The OCPP 2.1 `SetVariableData` data type.
8792#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8793pub struct SetVariableData {
8794    /// Value to be assigned to attribute of variable.
8795    /// This value is allowed to be an empty string ("").
8796    ///
8797    /// 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.
8798    #[serde(rename = "attributeValue")]
8799    pub attribute_value: String,
8800    /// The `component` member.
8801    pub component: Component,
8802    /// The `variable` member.
8803    pub variable: Variable,
8804    /// The `attributeType` member.
8805    #[serde(rename = "attributeType")]
8806    #[serde(default, skip_serializing_if = "Option::is_none")]
8807    pub attribute_type: Option<Attribute>,
8808    /// The `customData` member.
8809    #[serde(rename = "customData")]
8810    #[serde(default, skip_serializing_if = "Option::is_none")]
8811    pub custom_data: Option<crate::types::CustomData>,
8812}
8813
8814impl SetVariableData {
8815    /// Creates a `SetVariableData` from its required fields.
8816    #[must_use]
8817    pub fn new(
8818        attribute_value: impl Into<String>,
8819        component: Component,
8820        variable: Variable,
8821    ) -> Self {
8822        Self {
8823            attribute_value: attribute_value.into(),
8824            component,
8825            variable,
8826            attribute_type: None,
8827            custom_data: None,
8828        }
8829    }
8830
8831    /// Sets the optional `attributeType` field.
8832    #[must_use]
8833    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8834        self.attribute_type = Some(value);
8835        self
8836    }
8837
8838    /// Sets the optional `customData` field.
8839    #[must_use]
8840    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8841        self.custom_data = Some(value);
8842        self
8843    }
8844}
8845
8846impl Validate for SetVariableData {
8847    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8848        path.push_key("attributeValue");
8849        validate::string(self.attribute_value.as_str(), None, Some(2500), path, out);
8850        path.pop();
8851        path.push_key("component");
8852        Validate::validate_at(&self.component, path, out);
8853        path.pop();
8854        path.push_key("variable");
8855        Validate::validate_at(&self.variable, path, out);
8856        path.pop();
8857        path.push_key("attributeType");
8858        if let Some(value) = &self.attribute_type {
8859            Validate::validate_at(value, path, out);
8860        }
8861        path.pop();
8862        path.push_key("customData");
8863        if let Some(value) = &self.custom_data {
8864            Validate::validate_at(value, path, out);
8865        }
8866        path.pop();
8867    }
8868}
8869
8870/// The OCPP 2.1 `SetVariableResult` data type.
8871#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8872pub struct SetVariableResult {
8873    /// The `attributeStatus` member.
8874    #[serde(rename = "attributeStatus")]
8875    pub attribute_status: SetVariableStatus,
8876    /// The `component` member.
8877    pub component: Component,
8878    /// The `variable` member.
8879    pub variable: Variable,
8880    /// The `attributeType` member.
8881    #[serde(rename = "attributeType")]
8882    #[serde(default, skip_serializing_if = "Option::is_none")]
8883    pub attribute_type: Option<Attribute>,
8884    /// The `attributeStatusInfo` member.
8885    #[serde(rename = "attributeStatusInfo")]
8886    #[serde(default, skip_serializing_if = "Option::is_none")]
8887    pub attribute_status_info: Option<StatusInfo>,
8888    /// The `customData` member.
8889    #[serde(rename = "customData")]
8890    #[serde(default, skip_serializing_if = "Option::is_none")]
8891    pub custom_data: Option<crate::types::CustomData>,
8892}
8893
8894impl SetVariableResult {
8895    /// Creates a `SetVariableResult` from its required fields.
8896    #[must_use]
8897    pub fn new(
8898        attribute_status: SetVariableStatus,
8899        component: Component,
8900        variable: Variable,
8901    ) -> Self {
8902        Self {
8903            attribute_status,
8904            component,
8905            variable,
8906            attribute_type: None,
8907            attribute_status_info: None,
8908            custom_data: None,
8909        }
8910    }
8911
8912    /// Sets the optional `attributeType` field.
8913    #[must_use]
8914    pub fn with_attribute_type(mut self, value: Attribute) -> Self {
8915        self.attribute_type = Some(value);
8916        self
8917    }
8918
8919    /// Sets the optional `attributeStatusInfo` field.
8920    #[must_use]
8921    pub fn with_attribute_status_info(mut self, value: StatusInfo) -> Self {
8922        self.attribute_status_info = Some(value);
8923        self
8924    }
8925
8926    /// Sets the optional `customData` field.
8927    #[must_use]
8928    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8929        self.custom_data = Some(value);
8930        self
8931    }
8932}
8933
8934impl Validate for SetVariableResult {
8935    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8936        path.push_key("attributeStatus");
8937        Validate::validate_at(&self.attribute_status, path, out);
8938        path.pop();
8939        path.push_key("component");
8940        Validate::validate_at(&self.component, path, out);
8941        path.pop();
8942        path.push_key("variable");
8943        Validate::validate_at(&self.variable, path, out);
8944        path.pop();
8945        path.push_key("attributeType");
8946        if let Some(value) = &self.attribute_type {
8947            Validate::validate_at(value, path, out);
8948        }
8949        path.pop();
8950        path.push_key("attributeStatusInfo");
8951        if let Some(value) = &self.attribute_status_info {
8952            Validate::validate_at(value, path, out);
8953        }
8954        path.pop();
8955        path.push_key("customData");
8956        if let Some(value) = &self.custom_data {
8957            Validate::validate_at(value, path, out);
8958        }
8959        path.pop();
8960    }
8961}
8962
8963/// Represent a signed version of the meter value.
8964///
8965/// The OCPP 2.1 `SignedMeterValue` data type.
8966#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8967pub struct SignedMeterValue {
8968    /// 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.
8969    #[serde(rename = "signedMeterData")]
8970    pub signed_meter_data: String,
8971    /// Format used by the energy meter to encode the meter data. For example: OCMF or EDL.
8972    #[serde(rename = "encodingMethod")]
8973    pub encoding_method: String,
8974    /// *(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.
8975    #[serde(rename = "signingMethod")]
8976    #[serde(default, skip_serializing_if = "Option::is_none")]
8977    pub signing_method: Option<String>,
8978    /// *(2.1)* Base64 encoded, sending depends on configuration variable _PublicKeyWithSignedMeterValue_.
8979    #[serde(rename = "publicKey")]
8980    #[serde(default, skip_serializing_if = "Option::is_none")]
8981    pub public_key: Option<String>,
8982    /// The `customData` member.
8983    #[serde(rename = "customData")]
8984    #[serde(default, skip_serializing_if = "Option::is_none")]
8985    pub custom_data: Option<crate::types::CustomData>,
8986}
8987
8988impl SignedMeterValue {
8989    /// Creates a `SignedMeterValue` from its required fields.
8990    #[must_use]
8991    pub fn new(signed_meter_data: impl Into<String>, encoding_method: impl Into<String>) -> Self {
8992        Self {
8993            signed_meter_data: signed_meter_data.into(),
8994            encoding_method: encoding_method.into(),
8995            signing_method: None,
8996            public_key: None,
8997            custom_data: None,
8998        }
8999    }
9000
9001    /// Sets the optional `signingMethod` field.
9002    #[must_use]
9003    pub fn with_signing_method(mut self, value: impl Into<String>) -> Self {
9004        self.signing_method = Some(value.into());
9005        self
9006    }
9007
9008    /// Sets the optional `publicKey` field.
9009    #[must_use]
9010    pub fn with_public_key(mut self, value: impl Into<String>) -> Self {
9011        self.public_key = Some(value.into());
9012        self
9013    }
9014
9015    /// Sets the optional `customData` field.
9016    #[must_use]
9017    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9018        self.custom_data = Some(value);
9019        self
9020    }
9021}
9022
9023impl Validate for SignedMeterValue {
9024    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9025        path.push_key("signedMeterData");
9026        validate::string(
9027            self.signed_meter_data.as_str(),
9028            None,
9029            Some(32768),
9030            path,
9031            out,
9032        );
9033        path.pop();
9034        path.push_key("encodingMethod");
9035        validate::string(self.encoding_method.as_str(), None, Some(50), path, out);
9036        path.pop();
9037        path.push_key("signingMethod");
9038        if let Some(value) = &self.signing_method {
9039            validate::string(value.as_str(), None, Some(50), path, out);
9040        }
9041        path.pop();
9042        path.push_key("publicKey");
9043        if let Some(value) = &self.public_key {
9044            validate::string(value.as_str(), None, Some(2500), path, out);
9045        }
9046        path.pop();
9047        path.push_key("customData");
9048        if let Some(value) = &self.custom_data {
9049            Validate::validate_at(value, path, out);
9050        }
9051        path.pop();
9052    }
9053}
9054
9055/// Element providing more information about the status.
9056///
9057/// The OCPP 2.1 `StatusInfo` data type.
9058#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9059pub struct StatusInfo {
9060    /// A predefined code for the reason why the status is returned in this response. The string is case-insensitive.
9061    #[serde(rename = "reasonCode")]
9062    pub reason_code: String,
9063    /// Additional text to provide detailed information.
9064    #[serde(rename = "additionalInfo")]
9065    #[serde(default, skip_serializing_if = "Option::is_none")]
9066    pub additional_info: Option<String>,
9067    /// The `customData` member.
9068    #[serde(rename = "customData")]
9069    #[serde(default, skip_serializing_if = "Option::is_none")]
9070    pub custom_data: Option<crate::types::CustomData>,
9071}
9072
9073impl StatusInfo {
9074    /// Creates a `StatusInfo` from its required fields.
9075    #[must_use]
9076    pub fn new(reason_code: impl Into<String>) -> Self {
9077        Self {
9078            reason_code: reason_code.into(),
9079            additional_info: None,
9080            custom_data: None,
9081        }
9082    }
9083
9084    /// Sets the optional `additionalInfo` field.
9085    #[must_use]
9086    pub fn with_additional_info(mut self, value: impl Into<String>) -> Self {
9087        self.additional_info = Some(value.into());
9088        self
9089    }
9090
9091    /// Sets the optional `customData` field.
9092    #[must_use]
9093    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9094        self.custom_data = Some(value);
9095        self
9096    }
9097}
9098
9099impl Validate for StatusInfo {
9100    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9101        path.push_key("reasonCode");
9102        validate::string(self.reason_code.as_str(), None, Some(20), path, out);
9103        path.pop();
9104        path.push_key("additionalInfo");
9105        if let Some(value) = &self.additional_info {
9106            validate::string(value.as_str(), None, Some(1024), path, out);
9107        }
9108        path.pop();
9109        path.push_key("customData");
9110        if let Some(value) = &self.custom_data {
9111            Validate::validate_at(value, path, out);
9112        }
9113        path.pop();
9114    }
9115}
9116
9117/// The OCPP 2.1 `StreamDataElement` data type.
9118#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9119pub struct StreamDataElement {
9120    /// Offset relative to _basetime_ of this message. _basetime_ + _t_ is timestamp of recorded value.
9121    pub t: crate::types::Decimal,
9122    /// The `v` member.
9123    pub v: String,
9124    /// The `customData` member.
9125    #[serde(rename = "customData")]
9126    #[serde(default, skip_serializing_if = "Option::is_none")]
9127    pub custom_data: Option<crate::types::CustomData>,
9128}
9129
9130impl StreamDataElement {
9131    /// Creates a `StreamDataElement` from its required fields.
9132    #[must_use]
9133    pub fn new(t: impl Into<crate::types::Decimal>, v: impl Into<String>) -> Self {
9134        Self {
9135            t: t.into(),
9136            v: v.into(),
9137            custom_data: None,
9138        }
9139    }
9140
9141    /// Sets the optional `customData` field.
9142    #[must_use]
9143    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9144        self.custom_data = Some(value);
9145        self
9146    }
9147}
9148
9149impl Validate for StreamDataElement {
9150    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9151        path.push_key("v");
9152        validate::string(self.v.as_str(), None, Some(2500), path, out);
9153        path.pop();
9154        path.push_key("customData");
9155        if let Some(value) = &self.custom_data {
9156            Validate::validate_at(value, path, out);
9157        }
9158        path.pop();
9159    }
9160}
9161
9162/// A tariff is described by fields with prices for:
9163/// energy,
9164/// charging time,
9165/// idle time,
9166/// fixed fee,
9167/// reservation time,
9168/// reservation fixed fee. +
9169/// Each of these fields may have (optional) conditions that specify when a price is applicable. +
9170/// The _description_ contains a human-readable explanation of the tariff to be shown to the user. +
9171/// The other fields are parameters that define the tariff. These are used by the charging station to calculate the price.
9172///
9173/// The OCPP 2.1 `Tariff` data type.
9174#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9175pub struct Tariff {
9176    /// Unique id of tariff
9177    #[serde(rename = "tariffId")]
9178    pub tariff_id: String,
9179    /// Currency code according to ISO 4217
9180    pub currency: String,
9181    /// The `description` member.
9182    #[serde(default, skip_serializing_if = "Option::is_none")]
9183    pub description: Option<Vec<MessageContent>>,
9184    /// The `energy` member.
9185    #[serde(default, skip_serializing_if = "Option::is_none")]
9186    pub energy: Option<TariffEnergy>,
9187    /// Time when this tariff becomes active. When absent, it is immediately active.
9188    #[serde(rename = "validFrom")]
9189    #[serde(default, skip_serializing_if = "Option::is_none")]
9190    pub valid_from: Option<crate::types::DateTime>,
9191    /// The `chargingTime` member.
9192    #[serde(rename = "chargingTime")]
9193    #[serde(default, skip_serializing_if = "Option::is_none")]
9194    pub charging_time: Option<TariffTime>,
9195    /// The `idleTime` member.
9196    #[serde(rename = "idleTime")]
9197    #[serde(default, skip_serializing_if = "Option::is_none")]
9198    pub idle_time: Option<TariffTime>,
9199    /// The `fixedFee` member.
9200    #[serde(rename = "fixedFee")]
9201    #[serde(default, skip_serializing_if = "Option::is_none")]
9202    pub fixed_fee: Option<TariffFixed>,
9203    /// The `reservationTime` member.
9204    #[serde(rename = "reservationTime")]
9205    #[serde(default, skip_serializing_if = "Option::is_none")]
9206    pub reservation_time: Option<TariffTime>,
9207    /// The `reservationFixed` member.
9208    #[serde(rename = "reservationFixed")]
9209    #[serde(default, skip_serializing_if = "Option::is_none")]
9210    pub reservation_fixed: Option<TariffFixed>,
9211    /// The `minCost` member.
9212    #[serde(rename = "minCost")]
9213    #[serde(default, skip_serializing_if = "Option::is_none")]
9214    pub min_cost: Option<Price>,
9215    /// The `maxCost` member.
9216    #[serde(rename = "maxCost")]
9217    #[serde(default, skip_serializing_if = "Option::is_none")]
9218    pub max_cost: Option<Price>,
9219    /// The `customData` member.
9220    #[serde(rename = "customData")]
9221    #[serde(default, skip_serializing_if = "Option::is_none")]
9222    pub custom_data: Option<crate::types::CustomData>,
9223}
9224
9225impl Tariff {
9226    /// Creates a `Tariff` from its required fields.
9227    #[must_use]
9228    pub fn new(tariff_id: impl Into<String>, currency: impl Into<String>) -> Self {
9229        Self {
9230            tariff_id: tariff_id.into(),
9231            currency: currency.into(),
9232            description: None,
9233            energy: None,
9234            valid_from: None,
9235            charging_time: None,
9236            idle_time: None,
9237            fixed_fee: None,
9238            reservation_time: None,
9239            reservation_fixed: None,
9240            min_cost: None,
9241            max_cost: None,
9242            custom_data: None,
9243        }
9244    }
9245
9246    /// Sets the optional `description` field.
9247    #[must_use]
9248    pub fn with_description(mut self, value: Vec<MessageContent>) -> Self {
9249        self.description = Some(value);
9250        self
9251    }
9252
9253    /// Sets the optional `energy` field.
9254    #[must_use]
9255    pub fn with_energy(mut self, value: TariffEnergy) -> Self {
9256        self.energy = Some(value);
9257        self
9258    }
9259
9260    /// Sets the optional `validFrom` field.
9261    #[must_use]
9262    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9263        self.valid_from = Some(value.into());
9264        self
9265    }
9266
9267    /// Sets the optional `chargingTime` field.
9268    #[must_use]
9269    pub fn with_charging_time(mut self, value: TariffTime) -> Self {
9270        self.charging_time = Some(value);
9271        self
9272    }
9273
9274    /// Sets the optional `idleTime` field.
9275    #[must_use]
9276    pub fn with_idle_time(mut self, value: TariffTime) -> Self {
9277        self.idle_time = Some(value);
9278        self
9279    }
9280
9281    /// Sets the optional `fixedFee` field.
9282    #[must_use]
9283    pub fn with_fixed_fee(mut self, value: TariffFixed) -> Self {
9284        self.fixed_fee = Some(value);
9285        self
9286    }
9287
9288    /// Sets the optional `reservationTime` field.
9289    #[must_use]
9290    pub fn with_reservation_time(mut self, value: TariffTime) -> Self {
9291        self.reservation_time = Some(value);
9292        self
9293    }
9294
9295    /// Sets the optional `reservationFixed` field.
9296    #[must_use]
9297    pub fn with_reservation_fixed(mut self, value: TariffFixed) -> Self {
9298        self.reservation_fixed = Some(value);
9299        self
9300    }
9301
9302    /// Sets the optional `minCost` field.
9303    #[must_use]
9304    pub fn with_min_cost(mut self, value: Price) -> Self {
9305        self.min_cost = Some(value);
9306        self
9307    }
9308
9309    /// Sets the optional `maxCost` field.
9310    #[must_use]
9311    pub fn with_max_cost(mut self, value: Price) -> Self {
9312        self.max_cost = Some(value);
9313        self
9314    }
9315
9316    /// Sets the optional `customData` field.
9317    #[must_use]
9318    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9319        self.custom_data = Some(value);
9320        self
9321    }
9322}
9323
9324impl Validate for Tariff {
9325    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9326        path.push_key("tariffId");
9327        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9328        path.pop();
9329        path.push_key("currency");
9330        validate::string(self.currency.as_str(), None, Some(3), path, out);
9331        path.pop();
9332        path.push_key("description");
9333        if let Some(value) = &self.description {
9334            validate::list_len(value.len(), Some(1), Some(10), path, out);
9335            for (index, item) in value.iter().enumerate() {
9336                path.push_index(index);
9337                Validate::validate_at(item, path, out);
9338                path.pop();
9339            }
9340        }
9341        path.pop();
9342        path.push_key("energy");
9343        if let Some(value) = &self.energy {
9344            Validate::validate_at(value, path, out);
9345        }
9346        path.pop();
9347        path.push_key("chargingTime");
9348        if let Some(value) = &self.charging_time {
9349            Validate::validate_at(value, path, out);
9350        }
9351        path.pop();
9352        path.push_key("idleTime");
9353        if let Some(value) = &self.idle_time {
9354            Validate::validate_at(value, path, out);
9355        }
9356        path.pop();
9357        path.push_key("fixedFee");
9358        if let Some(value) = &self.fixed_fee {
9359            Validate::validate_at(value, path, out);
9360        }
9361        path.pop();
9362        path.push_key("reservationTime");
9363        if let Some(value) = &self.reservation_time {
9364            Validate::validate_at(value, path, out);
9365        }
9366        path.pop();
9367        path.push_key("reservationFixed");
9368        if let Some(value) = &self.reservation_fixed {
9369            Validate::validate_at(value, path, out);
9370        }
9371        path.pop();
9372        path.push_key("minCost");
9373        if let Some(value) = &self.min_cost {
9374            Validate::validate_at(value, path, out);
9375        }
9376        path.pop();
9377        path.push_key("maxCost");
9378        if let Some(value) = &self.max_cost {
9379            Validate::validate_at(value, path, out);
9380        }
9381        path.pop();
9382        path.push_key("customData");
9383        if let Some(value) = &self.custom_data {
9384            Validate::validate_at(value, path, out);
9385        }
9386        path.pop();
9387    }
9388}
9389
9390/// Shows assignment of tariffs to EVSE or IdToken.
9391///
9392/// The OCPP 2.1 `TariffAssignment` data type.
9393#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9394pub struct TariffAssignment {
9395    /// Tariff id.
9396    #[serde(rename = "tariffId")]
9397    pub tariff_id: String,
9398    /// The `tariffKind` member.
9399    #[serde(rename = "tariffKind")]
9400    pub tariff_kind: TariffKind,
9401    /// Date/time when this tariff become active.
9402    #[serde(rename = "validFrom")]
9403    #[serde(default, skip_serializing_if = "Option::is_none")]
9404    pub valid_from: Option<crate::types::DateTime>,
9405    /// The `evseIds` member.
9406    #[serde(rename = "evseIds")]
9407    #[serde(default, skip_serializing_if = "Option::is_none")]
9408    pub evse_ids: Option<Vec<i32>>,
9409    /// IdTokens related to tariff
9410    #[serde(rename = "idTokens")]
9411    #[serde(default, skip_serializing_if = "Option::is_none")]
9412    pub id_tokens: Option<Vec<String>>,
9413    /// The `customData` member.
9414    #[serde(rename = "customData")]
9415    #[serde(default, skip_serializing_if = "Option::is_none")]
9416    pub custom_data: Option<crate::types::CustomData>,
9417}
9418
9419impl TariffAssignment {
9420    /// Creates a `TariffAssignment` from its required fields.
9421    #[must_use]
9422    pub fn new(tariff_id: impl Into<String>, tariff_kind: TariffKind) -> Self {
9423        Self {
9424            tariff_id: tariff_id.into(),
9425            tariff_kind,
9426            valid_from: None,
9427            evse_ids: None,
9428            id_tokens: None,
9429            custom_data: None,
9430        }
9431    }
9432
9433    /// Sets the optional `validFrom` field.
9434    #[must_use]
9435    pub fn with_valid_from(mut self, value: impl Into<crate::types::DateTime>) -> Self {
9436        self.valid_from = Some(value.into());
9437        self
9438    }
9439
9440    /// Sets the optional `evseIds` field.
9441    #[must_use]
9442    pub fn with_evse_ids(mut self, value: Vec<i32>) -> Self {
9443        self.evse_ids = Some(value);
9444        self
9445    }
9446
9447    /// Sets the optional `idTokens` field.
9448    #[must_use]
9449    pub fn with_id_tokens(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
9450        self.id_tokens = Some(value.into_iter().map(Into::into).collect());
9451        self
9452    }
9453
9454    /// Sets the optional `customData` field.
9455    #[must_use]
9456    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9457        self.custom_data = Some(value);
9458        self
9459    }
9460}
9461
9462impl Validate for TariffAssignment {
9463    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9464        path.push_key("tariffId");
9465        validate::string(self.tariff_id.as_str(), None, Some(60), path, out);
9466        path.pop();
9467        path.push_key("tariffKind");
9468        Validate::validate_at(&self.tariff_kind, path, out);
9469        path.pop();
9470        path.push_key("evseIds");
9471        if let Some(value) = &self.evse_ids {
9472            validate::list_len(value.len(), Some(1), None, path, out);
9473            for (index, item) in value.iter().enumerate() {
9474                path.push_index(index);
9475                validate::int_range(i64::from(*item), Some(0), None, path, out);
9476                path.pop();
9477            }
9478        }
9479        path.pop();
9480        path.push_key("idTokens");
9481        if let Some(value) = &self.id_tokens {
9482            validate::list_len(value.len(), Some(1), None, path, out);
9483            for (index, item) in value.iter().enumerate() {
9484                path.push_index(index);
9485                validate::string(item.as_str(), None, Some(255), path, out);
9486                path.pop();
9487            }
9488        }
9489        path.pop();
9490        path.push_key("customData");
9491        if let Some(value) = &self.custom_data {
9492            Validate::validate_at(value, path, out);
9493        }
9494        path.pop();
9495    }
9496}
9497
9498/// These conditions describe if and when a TariffEnergyType or TariffTimeType applies during a transaction.
9499///
9500/// 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.
9501///
9502/// For reverse energy flow (discharging) negative values of energy, power and current are used.
9503///
9504/// 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.
9505///
9506/// 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.
9507/// 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.
9508///
9509/// The OCPP 2.1 `TariffConditions` data type.
9510#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9511pub struct TariffConditions {
9512    /// Start time of day in local time. +
9513    /// Format as per RFC 3339: time-hour ":" time-minute  +
9514    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9515    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9516    #[serde(rename = "startTimeOfDay")]
9517    #[serde(default, skip_serializing_if = "Option::is_none")]
9518    pub start_time_of_day: Option<String>,
9519    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9520    ///     If end time &lt; start time then the period wraps around to the next day. +
9521    ///     To stop at end of the day use: 00:00.
9522    #[serde(rename = "endTimeOfDay")]
9523    #[serde(default, skip_serializing_if = "Option::is_none")]
9524    pub end_time_of_day: Option<String>,
9525    /// Day(s) of the week this is tariff applies.
9526    #[serde(rename = "dayOfWeek")]
9527    #[serde(default, skip_serializing_if = "Option::is_none")]
9528    pub day_of_week: Option<Vec<DayOfWeek>>,
9529    /// Start date in local time, for example: 2015-12-24.
9530    /// Valid from this day (inclusive). +
9531    /// Format as per RFC 3339: full-date  +
9532    ///
9533    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9534    #[serde(rename = "validFromDate")]
9535    #[serde(default, skip_serializing_if = "Option::is_none")]
9536    pub valid_from_date: Option<String>,
9537    /// End date in local time, for example: 2015-12-27.
9538    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9539    #[serde(rename = "validToDate")]
9540    #[serde(default, skip_serializing_if = "Option::is_none")]
9541    pub valid_to_date: Option<String>,
9542    /// The `evseKind` member.
9543    #[serde(rename = "evseKind")]
9544    #[serde(default, skip_serializing_if = "Option::is_none")]
9545    pub evse_kind: Option<EvseKind>,
9546    /// Minimum consumed energy in Wh, for example 20000 Wh.
9547    ///     Valid from this amount of energy (inclusive) being used.
9548    #[serde(rename = "minEnergy")]
9549    #[serde(default, skip_serializing_if = "Option::is_none")]
9550    pub min_energy: Option<crate::types::Decimal>,
9551    /// Maximum consumed energy in Wh, for example 50000 Wh.
9552    ///     Valid until this amount of energy (exclusive) being used.
9553    #[serde(rename = "maxEnergy")]
9554    #[serde(default, skip_serializing_if = "Option::is_none")]
9555    pub max_energy: Option<crate::types::Decimal>,
9556    /// Sum of the minimum current (in Amperes) over all phases, for example 5 A.
9557    ///     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. +
9558    ///     This is NOT about the minimum current over the entire transaction.
9559    #[serde(rename = "minCurrent")]
9560    #[serde(default, skip_serializing_if = "Option::is_none")]
9561    pub min_current: Option<crate::types::Decimal>,
9562    /// Sum of the maximum current (in Amperes) over all phases, for example 20 A.
9563    ///       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.
9564    ///       This is NOT about the maximum current over the entire transaction.
9565    #[serde(rename = "maxCurrent")]
9566    #[serde(default, skip_serializing_if = "Option::is_none")]
9567    pub max_current: Option<crate::types::Decimal>,
9568    /// Minimum power in W, for example 5000 W.
9569    ///       When the EV is charging with more than, or equal to, the defined amount of power, this price is/becomes active.
9570    ///       If the charging power is or becomes lower, this price is not or no longer valid and becomes inactive.
9571    ///       This is NOT about the minimum power over the entire transaction.
9572    #[serde(rename = "minPower")]
9573    #[serde(default, skip_serializing_if = "Option::is_none")]
9574    pub min_power: Option<crate::types::Decimal>,
9575    /// Maximum power in W, for example 20000 W.
9576    ///       When the EV is charging with less than the defined amount of power, this price becomes/is active.
9577    ///       If the charging power is or becomes higher, this price is not or no longer valid and becomes inactive.
9578    ///       This is NOT about the maximum power over the entire transaction.
9579    #[serde(rename = "maxPower")]
9580    #[serde(default, skip_serializing_if = "Option::is_none")]
9581    pub max_power: Option<crate::types::Decimal>,
9582    /// Minimum duration in seconds the transaction (charging &amp; idle) MUST last (inclusive).
9583    ///       When the duration of a transaction is longer than the defined value, this price is or becomes active.
9584    ///       Before that moment, this price is not yet active.
9585    #[serde(rename = "minTime")]
9586    #[serde(default, skip_serializing_if = "Option::is_none")]
9587    pub min_time: Option<i32>,
9588    /// Maximum duration in seconds the transaction (charging &amp; idle) MUST last (exclusive).
9589    ///       When the duration of a transaction is shorter than the defined value, this price is or becomes active.
9590    ///       After that moment, this price is no longer active.
9591    #[serde(rename = "maxTime")]
9592    #[serde(default, skip_serializing_if = "Option::is_none")]
9593    pub max_time: Option<i32>,
9594    /// Minimum duration in seconds the charging MUST last (inclusive).
9595    ///       When the duration of a charging is longer than the defined value, this price is or becomes active.
9596    ///       Before that moment, this price is not yet active.
9597    #[serde(rename = "minChargingTime")]
9598    #[serde(default, skip_serializing_if = "Option::is_none")]
9599    pub min_charging_time: Option<i32>,
9600    /// Maximum duration in seconds the charging MUST last (exclusive).
9601    ///       When the duration of a charging is shorter than the defined value, this price is or becomes active.
9602    ///       After that moment, this price is no longer active.
9603    #[serde(rename = "maxChargingTime")]
9604    #[serde(default, skip_serializing_if = "Option::is_none")]
9605    pub max_charging_time: Option<i32>,
9606    /// Minimum duration in seconds the idle period (i.e. not charging) MUST last (inclusive).
9607    ///       When the duration of the idle time is longer than the defined value, this price is or becomes active.
9608    ///       Before that moment, this price is not yet active.
9609    #[serde(rename = "minIdleTime")]
9610    #[serde(default, skip_serializing_if = "Option::is_none")]
9611    pub min_idle_time: Option<i32>,
9612    /// Maximum duration in seconds the idle period (i.e. not charging) MUST last (exclusive).
9613    ///       When the duration of idle time is shorter than the defined value, this price is or becomes active.
9614    ///       After that moment, this price is no longer active.
9615    #[serde(rename = "maxIdleTime")]
9616    #[serde(default, skip_serializing_if = "Option::is_none")]
9617    pub max_idle_time: Option<i32>,
9618    /// The `customData` member.
9619    #[serde(rename = "customData")]
9620    #[serde(default, skip_serializing_if = "Option::is_none")]
9621    pub custom_data: Option<crate::types::CustomData>,
9622}
9623
9624impl TariffConditions {
9625    /// Creates an empty `TariffConditions`. Every field of this type is optional.
9626    #[must_use]
9627    pub fn new() -> Self {
9628        Self::default()
9629    }
9630
9631    /// Sets the optional `startTimeOfDay` field.
9632    #[must_use]
9633    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9634        self.start_time_of_day = Some(value.into());
9635        self
9636    }
9637
9638    /// Sets the optional `endTimeOfDay` field.
9639    #[must_use]
9640    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9641        self.end_time_of_day = Some(value.into());
9642        self
9643    }
9644
9645    /// Sets the optional `dayOfWeek` field.
9646    #[must_use]
9647    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9648        self.day_of_week = Some(value);
9649        self
9650    }
9651
9652    /// Sets the optional `validFromDate` field.
9653    #[must_use]
9654    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9655        self.valid_from_date = Some(value.into());
9656        self
9657    }
9658
9659    /// Sets the optional `validToDate` field.
9660    #[must_use]
9661    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9662        self.valid_to_date = Some(value.into());
9663        self
9664    }
9665
9666    /// Sets the optional `evseKind` field.
9667    #[must_use]
9668    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9669        self.evse_kind = Some(value);
9670        self
9671    }
9672
9673    /// Sets the optional `minEnergy` field.
9674    #[must_use]
9675    pub fn with_min_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9676        self.min_energy = Some(value.into());
9677        self
9678    }
9679
9680    /// Sets the optional `maxEnergy` field.
9681    #[must_use]
9682    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9683        self.max_energy = Some(value.into());
9684        self
9685    }
9686
9687    /// Sets the optional `minCurrent` field.
9688    #[must_use]
9689    pub fn with_min_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9690        self.min_current = Some(value.into());
9691        self
9692    }
9693
9694    /// Sets the optional `maxCurrent` field.
9695    #[must_use]
9696    pub fn with_max_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9697        self.max_current = Some(value.into());
9698        self
9699    }
9700
9701    /// Sets the optional `minPower` field.
9702    #[must_use]
9703    pub fn with_min_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9704        self.min_power = Some(value.into());
9705        self
9706    }
9707
9708    /// Sets the optional `maxPower` field.
9709    #[must_use]
9710    pub fn with_max_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
9711        self.max_power = Some(value.into());
9712        self
9713    }
9714
9715    /// Sets the optional `minTime` field.
9716    #[must_use]
9717    pub fn with_min_time(mut self, value: i32) -> Self {
9718        self.min_time = Some(value);
9719        self
9720    }
9721
9722    /// Sets the optional `maxTime` field.
9723    #[must_use]
9724    pub fn with_max_time(mut self, value: i32) -> Self {
9725        self.max_time = Some(value);
9726        self
9727    }
9728
9729    /// Sets the optional `minChargingTime` field.
9730    #[must_use]
9731    pub fn with_min_charging_time(mut self, value: i32) -> Self {
9732        self.min_charging_time = Some(value);
9733        self
9734    }
9735
9736    /// Sets the optional `maxChargingTime` field.
9737    #[must_use]
9738    pub fn with_max_charging_time(mut self, value: i32) -> Self {
9739        self.max_charging_time = Some(value);
9740        self
9741    }
9742
9743    /// Sets the optional `minIdleTime` field.
9744    #[must_use]
9745    pub fn with_min_idle_time(mut self, value: i32) -> Self {
9746        self.min_idle_time = Some(value);
9747        self
9748    }
9749
9750    /// Sets the optional `maxIdleTime` field.
9751    #[must_use]
9752    pub fn with_max_idle_time(mut self, value: i32) -> Self {
9753        self.max_idle_time = Some(value);
9754        self
9755    }
9756
9757    /// Sets the optional `customData` field.
9758    #[must_use]
9759    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9760        self.custom_data = Some(value);
9761        self
9762    }
9763}
9764
9765impl Validate for TariffConditions {
9766    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9767        path.push_key("dayOfWeek");
9768        if let Some(value) = &self.day_of_week {
9769            validate::list_len(value.len(), Some(1), Some(7), path, out);
9770            for (index, item) in value.iter().enumerate() {
9771                path.push_index(index);
9772                Validate::validate_at(item, path, out);
9773                path.pop();
9774            }
9775        }
9776        path.pop();
9777        path.push_key("evseKind");
9778        if let Some(value) = &self.evse_kind {
9779            Validate::validate_at(value, path, out);
9780        }
9781        path.pop();
9782        path.push_key("customData");
9783        if let Some(value) = &self.custom_data {
9784            Validate::validate_at(value, path, out);
9785        }
9786        path.pop();
9787    }
9788}
9789
9790/// These conditions describe if a FixedPrice applies at start of the transaction.
9791///
9792/// 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.
9793///
9794/// 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.
9795/// 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.
9796///
9797/// The OCPP 2.1 `TariffConditionsFixed` data type.
9798#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9799pub struct TariffConditionsFixed {
9800    /// Start time of day in local time. +
9801    /// Format as per RFC 3339: time-hour ":" time-minute  +
9802    /// Must be in 24h format with leading zeros. Hour/Minute separator: ":"
9803    /// Regex: (\[0-1\]\[0-9\]\|2\[0-3\]):\[0-5\]\[0-9\]
9804    #[serde(rename = "startTimeOfDay")]
9805    #[serde(default, skip_serializing_if = "Option::is_none")]
9806    pub start_time_of_day: Option<String>,
9807    /// End time of day in local time. Same syntax as _startTimeOfDay_. +
9808    ///     If end time &lt; start time then the period wraps around to the next day. +
9809    ///     To stop at end of the day use: 00:00.
9810    #[serde(rename = "endTimeOfDay")]
9811    #[serde(default, skip_serializing_if = "Option::is_none")]
9812    pub end_time_of_day: Option<String>,
9813    /// Day(s) of the week this is tariff applies.
9814    #[serde(rename = "dayOfWeek")]
9815    #[serde(default, skip_serializing_if = "Option::is_none")]
9816    pub day_of_week: Option<Vec<DayOfWeek>>,
9817    /// Start date in local time, for example: 2015-12-24.
9818    /// Valid from this day (inclusive). +
9819    /// Format as per RFC 3339: full-date  +
9820    ///
9821    /// Regex: (\[12\]\[0-9\]{3})-(0\[1-9\]\|1\[0-2\])-(0\[1-9\]\|\[12\]\[0-9\]\|3\[01\])
9822    #[serde(rename = "validFromDate")]
9823    #[serde(default, skip_serializing_if = "Option::is_none")]
9824    pub valid_from_date: Option<String>,
9825    /// End date in local time, for example: 2015-12-27.
9826    ///     Valid until this day (exclusive). Same syntax as _validFromDate_.
9827    #[serde(rename = "validToDate")]
9828    #[serde(default, skip_serializing_if = "Option::is_none")]
9829    pub valid_to_date: Option<String>,
9830    /// The `evseKind` member.
9831    #[serde(rename = "evseKind")]
9832    #[serde(default, skip_serializing_if = "Option::is_none")]
9833    pub evse_kind: Option<EvseKind>,
9834    /// For which payment brand this (adhoc) tariff applies. Can be used to add a surcharge for certain payment brands.
9835    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentBrand".
9836    #[serde(rename = "paymentBrand")]
9837    #[serde(default, skip_serializing_if = "Option::is_none")]
9838    pub payment_brand: Option<String>,
9839    /// Type of adhoc payment, e.g. CC, Debit.
9840    ///     Based on value of _additionalIdToken_ from _idToken.additionalInfo.type_ = "PaymentRecognition".
9841    #[serde(rename = "paymentRecognition")]
9842    #[serde(default, skip_serializing_if = "Option::is_none")]
9843    pub payment_recognition: Option<String>,
9844    /// The `customData` member.
9845    #[serde(rename = "customData")]
9846    #[serde(default, skip_serializing_if = "Option::is_none")]
9847    pub custom_data: Option<crate::types::CustomData>,
9848}
9849
9850impl TariffConditionsFixed {
9851    /// Creates an empty `TariffConditionsFixed`. Every field of this type is optional.
9852    #[must_use]
9853    pub fn new() -> Self {
9854        Self::default()
9855    }
9856
9857    /// Sets the optional `startTimeOfDay` field.
9858    #[must_use]
9859    pub fn with_start_time_of_day(mut self, value: impl Into<String>) -> Self {
9860        self.start_time_of_day = Some(value.into());
9861        self
9862    }
9863
9864    /// Sets the optional `endTimeOfDay` field.
9865    #[must_use]
9866    pub fn with_end_time_of_day(mut self, value: impl Into<String>) -> Self {
9867        self.end_time_of_day = Some(value.into());
9868        self
9869    }
9870
9871    /// Sets the optional `dayOfWeek` field.
9872    #[must_use]
9873    pub fn with_day_of_week(mut self, value: Vec<DayOfWeek>) -> Self {
9874        self.day_of_week = Some(value);
9875        self
9876    }
9877
9878    /// Sets the optional `validFromDate` field.
9879    #[must_use]
9880    pub fn with_valid_from_date(mut self, value: impl Into<String>) -> Self {
9881        self.valid_from_date = Some(value.into());
9882        self
9883    }
9884
9885    /// Sets the optional `validToDate` field.
9886    #[must_use]
9887    pub fn with_valid_to_date(mut self, value: impl Into<String>) -> Self {
9888        self.valid_to_date = Some(value.into());
9889        self
9890    }
9891
9892    /// Sets the optional `evseKind` field.
9893    #[must_use]
9894    pub fn with_evse_kind(mut self, value: EvseKind) -> Self {
9895        self.evse_kind = Some(value);
9896        self
9897    }
9898
9899    /// Sets the optional `paymentBrand` field.
9900    #[must_use]
9901    pub fn with_payment_brand(mut self, value: impl Into<String>) -> Self {
9902        self.payment_brand = Some(value.into());
9903        self
9904    }
9905
9906    /// Sets the optional `paymentRecognition` field.
9907    #[must_use]
9908    pub fn with_payment_recognition(mut self, value: impl Into<String>) -> Self {
9909        self.payment_recognition = Some(value.into());
9910        self
9911    }
9912
9913    /// Sets the optional `customData` field.
9914    #[must_use]
9915    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9916        self.custom_data = Some(value);
9917        self
9918    }
9919}
9920
9921impl Validate for TariffConditionsFixed {
9922    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9923        path.push_key("dayOfWeek");
9924        if let Some(value) = &self.day_of_week {
9925            validate::list_len(value.len(), Some(1), Some(7), path, out);
9926            for (index, item) in value.iter().enumerate() {
9927                path.push_index(index);
9928                Validate::validate_at(item, path, out);
9929                path.pop();
9930            }
9931        }
9932        path.pop();
9933        path.push_key("evseKind");
9934        if let Some(value) = &self.evse_kind {
9935            Validate::validate_at(value, path, out);
9936        }
9937        path.pop();
9938        path.push_key("paymentBrand");
9939        if let Some(value) = &self.payment_brand {
9940            validate::string(value.as_str(), None, Some(20), path, out);
9941        }
9942        path.pop();
9943        path.push_key("paymentRecognition");
9944        if let Some(value) = &self.payment_recognition {
9945            validate::string(value.as_str(), None, Some(20), path, out);
9946        }
9947        path.pop();
9948        path.push_key("customData");
9949        if let Some(value) = &self.custom_data {
9950            Validate::validate_at(value, path, out);
9951        }
9952        path.pop();
9953    }
9954}
9955
9956/// Price elements and tax for energy
9957///
9958/// The OCPP 2.1 `TariffEnergy` data type.
9959#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9960pub struct TariffEnergy {
9961    /// The `prices` member.
9962    pub prices: Vec<TariffEnergyPrice>,
9963    /// The `taxRates` member.
9964    #[serde(rename = "taxRates")]
9965    #[serde(default, skip_serializing_if = "Option::is_none")]
9966    pub tax_rates: Option<Vec<TaxRate>>,
9967    /// The `customData` member.
9968    #[serde(rename = "customData")]
9969    #[serde(default, skip_serializing_if = "Option::is_none")]
9970    pub custom_data: Option<crate::types::CustomData>,
9971}
9972
9973impl TariffEnergy {
9974    /// Creates a `TariffEnergy` from its required fields.
9975    #[must_use]
9976    pub fn new(prices: Vec<TariffEnergyPrice>) -> Self {
9977        Self {
9978            prices,
9979            tax_rates: None,
9980            custom_data: None,
9981        }
9982    }
9983
9984    /// Sets the optional `taxRates` field.
9985    #[must_use]
9986    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
9987        self.tax_rates = Some(value);
9988        self
9989    }
9990
9991    /// Sets the optional `customData` field.
9992    #[must_use]
9993    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9994        self.custom_data = Some(value);
9995        self
9996    }
9997}
9998
9999impl Validate for TariffEnergy {
10000    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10001        path.push_key("prices");
10002        validate::list_len(self.prices.len(), Some(1), None, path, out);
10003        for (index, item) in self.prices.iter().enumerate() {
10004            path.push_index(index);
10005            Validate::validate_at(item, path, out);
10006            path.pop();
10007        }
10008        path.pop();
10009        path.push_key("taxRates");
10010        if let Some(value) = &self.tax_rates {
10011            validate::list_len(value.len(), Some(1), Some(5), path, out);
10012            for (index, item) in value.iter().enumerate() {
10013                path.push_index(index);
10014                Validate::validate_at(item, path, out);
10015                path.pop();
10016            }
10017        }
10018        path.pop();
10019        path.push_key("customData");
10020        if let Some(value) = &self.custom_data {
10021            Validate::validate_at(value, path, out);
10022        }
10023        path.pop();
10024    }
10025}
10026
10027/// Tariff with optional conditions for an energy price.
10028///
10029/// The OCPP 2.1 `TariffEnergyPrice` data type.
10030#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10031pub struct TariffEnergyPrice {
10032    /// Price per kWh (excl. tax) for this element.
10033    #[serde(rename = "priceKwh")]
10034    pub price_kwh: crate::types::Decimal,
10035    /// The `conditions` member.
10036    #[serde(default, skip_serializing_if = "Option::is_none")]
10037    pub conditions: Option<TariffConditions>,
10038    /// The `customData` member.
10039    #[serde(rename = "customData")]
10040    #[serde(default, skip_serializing_if = "Option::is_none")]
10041    pub custom_data: Option<crate::types::CustomData>,
10042}
10043
10044impl TariffEnergyPrice {
10045    /// Creates a `TariffEnergyPrice` from its required fields.
10046    #[must_use]
10047    pub fn new(price_kwh: impl Into<crate::types::Decimal>) -> Self {
10048        Self {
10049            price_kwh: price_kwh.into(),
10050            conditions: None,
10051            custom_data: None,
10052        }
10053    }
10054
10055    /// Sets the optional `conditions` field.
10056    #[must_use]
10057    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10058        self.conditions = Some(value);
10059        self
10060    }
10061
10062    /// Sets the optional `customData` field.
10063    #[must_use]
10064    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10065        self.custom_data = Some(value);
10066        self
10067    }
10068}
10069
10070impl Validate for TariffEnergyPrice {
10071    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10072        path.push_key("conditions");
10073        if let Some(value) = &self.conditions {
10074            Validate::validate_at(value, path, out);
10075        }
10076        path.pop();
10077        path.push_key("customData");
10078        if let Some(value) = &self.custom_data {
10079            Validate::validate_at(value, path, out);
10080        }
10081        path.pop();
10082    }
10083}
10084
10085/// The OCPP 2.1 `TariffFixed` data type.
10086#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10087pub struct TariffFixed {
10088    /// The `prices` member.
10089    pub prices: Vec<TariffFixedPrice>,
10090    /// The `taxRates` member.
10091    #[serde(rename = "taxRates")]
10092    #[serde(default, skip_serializing_if = "Option::is_none")]
10093    pub tax_rates: Option<Vec<TaxRate>>,
10094    /// The `customData` member.
10095    #[serde(rename = "customData")]
10096    #[serde(default, skip_serializing_if = "Option::is_none")]
10097    pub custom_data: Option<crate::types::CustomData>,
10098}
10099
10100impl TariffFixed {
10101    /// Creates a `TariffFixed` from its required fields.
10102    #[must_use]
10103    pub fn new(prices: Vec<TariffFixedPrice>) -> Self {
10104        Self {
10105            prices,
10106            tax_rates: None,
10107            custom_data: None,
10108        }
10109    }
10110
10111    /// Sets the optional `taxRates` field.
10112    #[must_use]
10113    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10114        self.tax_rates = Some(value);
10115        self
10116    }
10117
10118    /// Sets the optional `customData` field.
10119    #[must_use]
10120    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10121        self.custom_data = Some(value);
10122        self
10123    }
10124}
10125
10126impl Validate for TariffFixed {
10127    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10128        path.push_key("prices");
10129        validate::list_len(self.prices.len(), Some(1), None, path, out);
10130        for (index, item) in self.prices.iter().enumerate() {
10131            path.push_index(index);
10132            Validate::validate_at(item, path, out);
10133            path.pop();
10134        }
10135        path.pop();
10136        path.push_key("taxRates");
10137        if let Some(value) = &self.tax_rates {
10138            validate::list_len(value.len(), Some(1), Some(5), path, out);
10139            for (index, item) in value.iter().enumerate() {
10140                path.push_index(index);
10141                Validate::validate_at(item, path, out);
10142                path.pop();
10143            }
10144        }
10145        path.pop();
10146        path.push_key("customData");
10147        if let Some(value) = &self.custom_data {
10148            Validate::validate_at(value, path, out);
10149        }
10150        path.pop();
10151    }
10152}
10153
10154/// Tariff with optional conditions for a fixed price.
10155///
10156/// The OCPP 2.1 `TariffFixedPrice` data type.
10157#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10158pub struct TariffFixedPrice {
10159    /// Fixed price  for this element e.g. a start fee.
10160    #[serde(rename = "priceFixed")]
10161    pub price_fixed: crate::types::Decimal,
10162    /// The `conditions` member.
10163    #[serde(default, skip_serializing_if = "Option::is_none")]
10164    pub conditions: Option<TariffConditionsFixed>,
10165    /// The `customData` member.
10166    #[serde(rename = "customData")]
10167    #[serde(default, skip_serializing_if = "Option::is_none")]
10168    pub custom_data: Option<crate::types::CustomData>,
10169}
10170
10171impl TariffFixedPrice {
10172    /// Creates a `TariffFixedPrice` from its required fields.
10173    #[must_use]
10174    pub fn new(price_fixed: impl Into<crate::types::Decimal>) -> Self {
10175        Self {
10176            price_fixed: price_fixed.into(),
10177            conditions: None,
10178            custom_data: None,
10179        }
10180    }
10181
10182    /// Sets the optional `conditions` field.
10183    #[must_use]
10184    pub fn with_conditions(mut self, value: TariffConditionsFixed) -> Self {
10185        self.conditions = Some(value);
10186        self
10187    }
10188
10189    /// Sets the optional `customData` field.
10190    #[must_use]
10191    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10192        self.custom_data = Some(value);
10193        self
10194    }
10195}
10196
10197impl Validate for TariffFixedPrice {
10198    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10199        path.push_key("conditions");
10200        if let Some(value) = &self.conditions {
10201            Validate::validate_at(value, path, out);
10202        }
10203        path.pop();
10204        path.push_key("customData");
10205        if let Some(value) = &self.custom_data {
10206            Validate::validate_at(value, path, out);
10207        }
10208        path.pop();
10209    }
10210}
10211
10212/// Price elements and tax for time
10213///
10214/// The OCPP 2.1 `TariffTime` data type.
10215#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10216pub struct TariffTime {
10217    /// The `prices` member.
10218    pub prices: Vec<TariffTimePrice>,
10219    /// The `taxRates` member.
10220    #[serde(rename = "taxRates")]
10221    #[serde(default, skip_serializing_if = "Option::is_none")]
10222    pub tax_rates: Option<Vec<TaxRate>>,
10223    /// The `customData` member.
10224    #[serde(rename = "customData")]
10225    #[serde(default, skip_serializing_if = "Option::is_none")]
10226    pub custom_data: Option<crate::types::CustomData>,
10227}
10228
10229impl TariffTime {
10230    /// Creates a `TariffTime` from its required fields.
10231    #[must_use]
10232    pub fn new(prices: Vec<TariffTimePrice>) -> Self {
10233        Self {
10234            prices,
10235            tax_rates: None,
10236            custom_data: None,
10237        }
10238    }
10239
10240    /// Sets the optional `taxRates` field.
10241    #[must_use]
10242    pub fn with_tax_rates(mut self, value: Vec<TaxRate>) -> Self {
10243        self.tax_rates = Some(value);
10244        self
10245    }
10246
10247    /// Sets the optional `customData` field.
10248    #[must_use]
10249    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10250        self.custom_data = Some(value);
10251        self
10252    }
10253}
10254
10255impl Validate for TariffTime {
10256    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10257        path.push_key("prices");
10258        validate::list_len(self.prices.len(), Some(1), None, path, out);
10259        for (index, item) in self.prices.iter().enumerate() {
10260            path.push_index(index);
10261            Validate::validate_at(item, path, out);
10262            path.pop();
10263        }
10264        path.pop();
10265        path.push_key("taxRates");
10266        if let Some(value) = &self.tax_rates {
10267            validate::list_len(value.len(), Some(1), Some(5), path, out);
10268            for (index, item) in value.iter().enumerate() {
10269                path.push_index(index);
10270                Validate::validate_at(item, path, out);
10271                path.pop();
10272            }
10273        }
10274        path.pop();
10275        path.push_key("customData");
10276        if let Some(value) = &self.custom_data {
10277            Validate::validate_at(value, path, out);
10278        }
10279        path.pop();
10280    }
10281}
10282
10283/// Tariff with optional conditions for a time duration price.
10284///
10285/// The OCPP 2.1 `TariffTimePrice` data type.
10286#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10287pub struct TariffTimePrice {
10288    /// Price per minute (excl. tax) for this element.
10289    #[serde(rename = "priceMinute")]
10290    pub price_minute: crate::types::Decimal,
10291    /// The `conditions` member.
10292    #[serde(default, skip_serializing_if = "Option::is_none")]
10293    pub conditions: Option<TariffConditions>,
10294    /// The `customData` member.
10295    #[serde(rename = "customData")]
10296    #[serde(default, skip_serializing_if = "Option::is_none")]
10297    pub custom_data: Option<crate::types::CustomData>,
10298}
10299
10300impl TariffTimePrice {
10301    /// Creates a `TariffTimePrice` from its required fields.
10302    #[must_use]
10303    pub fn new(price_minute: impl Into<crate::types::Decimal>) -> Self {
10304        Self {
10305            price_minute: price_minute.into(),
10306            conditions: None,
10307            custom_data: None,
10308        }
10309    }
10310
10311    /// Sets the optional `conditions` field.
10312    #[must_use]
10313    pub fn with_conditions(mut self, value: TariffConditions) -> Self {
10314        self.conditions = Some(value);
10315        self
10316    }
10317
10318    /// Sets the optional `customData` field.
10319    #[must_use]
10320    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10321        self.custom_data = Some(value);
10322        self
10323    }
10324}
10325
10326impl Validate for TariffTimePrice {
10327    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10328        path.push_key("conditions");
10329        if let Some(value) = &self.conditions {
10330            Validate::validate_at(value, path, out);
10331        }
10332        path.pop();
10333        path.push_key("customData");
10334        if let Some(value) = &self.custom_data {
10335            Validate::validate_at(value, path, out);
10336        }
10337        path.pop();
10338    }
10339}
10340
10341/// Tax percentage
10342///
10343/// The OCPP 2.1 `TaxRate` data type.
10344#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10345pub struct TaxRate {
10346    /// Type of this tax, e.g.  "Federal ",  "State", for information on receipt.
10347    pub r#type: String,
10348    /// Tax percentage
10349    pub tax: crate::types::Decimal,
10350    /// Stack level for this type of tax. Default value, when absent, is 0. +
10351    /// _stack_ = 0: tax on net price; +
10352    /// _stack_ = 1: tax added on top of _stack_ 0; +
10353    /// _stack_ = 2: tax added on top of _stack_ 1, etc.
10354    #[serde(default, skip_serializing_if = "Option::is_none")]
10355    pub stack: Option<i32>,
10356    /// The `customData` member.
10357    #[serde(rename = "customData")]
10358    #[serde(default, skip_serializing_if = "Option::is_none")]
10359    pub custom_data: Option<crate::types::CustomData>,
10360}
10361
10362impl TaxRate {
10363    /// Creates a `TaxRate` from its required fields.
10364    #[must_use]
10365    pub fn new(r#type: impl Into<String>, tax: impl Into<crate::types::Decimal>) -> Self {
10366        Self {
10367            r#type: r#type.into(),
10368            tax: tax.into(),
10369            stack: None,
10370            custom_data: None,
10371        }
10372    }
10373
10374    /// Sets the optional `stack` field.
10375    #[must_use]
10376    pub fn with_stack(mut self, value: i32) -> Self {
10377        self.stack = Some(value);
10378        self
10379    }
10380
10381    /// Sets the optional `customData` field.
10382    #[must_use]
10383    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10384        self.custom_data = Some(value);
10385        self
10386    }
10387}
10388
10389impl Validate for TaxRate {
10390    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10391        path.push_key("type");
10392        validate::string(self.r#type.as_str(), None, Some(20), path, out);
10393        path.pop();
10394        path.push_key("stack");
10395        if let Some(value) = &self.stack {
10396            validate::int_range(i64::from(*value), Some(0), None, path, out);
10397        }
10398        path.pop();
10399        path.push_key("customData");
10400        if let Some(value) = &self.custom_data {
10401            Validate::validate_at(value, path, out);
10402        }
10403        path.pop();
10404    }
10405}
10406
10407/// Part of ISO 15118-20 price schedule.
10408///
10409/// The OCPP 2.1 `TaxRule` data type.
10410#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10411pub struct TaxRule {
10412    /// Id for the tax rule.
10413    #[serde(rename = "taxRuleID")]
10414    pub tax_rule_id: i32,
10415    /// Indicates whether this tax applies to Energy Fees.
10416    #[serde(rename = "appliesToEnergyFee")]
10417    pub applies_to_energy_fee: bool,
10418    /// Indicates whether this tax applies to Parking Fees.
10419    #[serde(rename = "appliesToParkingFee")]
10420    pub applies_to_parking_fee: bool,
10421    /// Indicates whether this tax applies to Overstay Fees.
10422    #[serde(rename = "appliesToOverstayFee")]
10423    pub applies_to_overstay_fee: bool,
10424    /// Indicates whether this tax applies to Minimum/Maximum Cost.
10425    #[serde(rename = "appliesToMinimumMaximumCost")]
10426    pub applies_to_minimum_maximum_cost: bool,
10427    /// The `taxRate` member.
10428    #[serde(rename = "taxRate")]
10429    pub tax_rate: RationalNumber,
10430    /// Human readable string to identify the tax rule.
10431    #[serde(rename = "taxRuleName")]
10432    #[serde(default, skip_serializing_if = "Option::is_none")]
10433    pub tax_rule_name: Option<String>,
10434    /// Indicates whether the tax is included in any price or not.
10435    #[serde(rename = "taxIncludedInPrice")]
10436    #[serde(default, skip_serializing_if = "Option::is_none")]
10437    pub tax_included_in_price: Option<bool>,
10438    /// The `customData` member.
10439    #[serde(rename = "customData")]
10440    #[serde(default, skip_serializing_if = "Option::is_none")]
10441    pub custom_data: Option<crate::types::CustomData>,
10442}
10443
10444impl TaxRule {
10445    /// Creates a `TaxRule` from its required fields.
10446    #[must_use]
10447    pub fn new(
10448        tax_rule_id: i32,
10449        applies_to_energy_fee: bool,
10450        applies_to_parking_fee: bool,
10451        applies_to_overstay_fee: bool,
10452        applies_to_minimum_maximum_cost: bool,
10453        tax_rate: RationalNumber,
10454    ) -> Self {
10455        Self {
10456            tax_rule_id,
10457            applies_to_energy_fee,
10458            applies_to_parking_fee,
10459            applies_to_overstay_fee,
10460            applies_to_minimum_maximum_cost,
10461            tax_rate,
10462            tax_rule_name: None,
10463            tax_included_in_price: None,
10464            custom_data: None,
10465        }
10466    }
10467
10468    /// Sets the optional `taxRuleName` field.
10469    #[must_use]
10470    pub fn with_tax_rule_name(mut self, value: impl Into<String>) -> Self {
10471        self.tax_rule_name = Some(value.into());
10472        self
10473    }
10474
10475    /// Sets the optional `taxIncludedInPrice` field.
10476    #[must_use]
10477    pub fn with_tax_included_in_price(mut self, value: bool) -> Self {
10478        self.tax_included_in_price = Some(value);
10479        self
10480    }
10481
10482    /// Sets the optional `customData` field.
10483    #[must_use]
10484    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10485        self.custom_data = Some(value);
10486        self
10487    }
10488}
10489
10490impl Validate for TaxRule {
10491    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10492        path.push_key("taxRuleID");
10493        validate::int_range(i64::from(self.tax_rule_id), Some(0), None, path, out);
10494        path.pop();
10495        path.push_key("taxRate");
10496        Validate::validate_at(&self.tax_rate, path, out);
10497        path.pop();
10498        path.push_key("taxRuleName");
10499        if let Some(value) = &self.tax_rule_name {
10500            validate::string(value.as_str(), None, Some(100), path, out);
10501        }
10502        path.pop();
10503        path.push_key("customData");
10504        if let Some(value) = &self.custom_data {
10505            Validate::validate_at(value, path, out);
10506        }
10507        path.pop();
10508    }
10509}
10510
10511/// This contains the cost calculated during a transaction. It is used both for running cost and final cost of the transaction.
10512///
10513/// The OCPP 2.1 `TotalCost` data type.
10514#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10515pub struct TotalCost {
10516    /// Currency of the costs in ISO 4217 Code.
10517    pub currency: String,
10518    /// The `typeOfCost` member.
10519    #[serde(rename = "typeOfCost")]
10520    pub type_of_cost: TariffCost,
10521    /// The `total` member.
10522    pub total: TotalPrice,
10523    /// The `fixed` member.
10524    #[serde(default, skip_serializing_if = "Option::is_none")]
10525    pub fixed: Option<Price>,
10526    /// The `energy` member.
10527    #[serde(default, skip_serializing_if = "Option::is_none")]
10528    pub energy: Option<Price>,
10529    /// The `chargingTime` member.
10530    #[serde(rename = "chargingTime")]
10531    #[serde(default, skip_serializing_if = "Option::is_none")]
10532    pub charging_time: Option<Price>,
10533    /// The `idleTime` member.
10534    #[serde(rename = "idleTime")]
10535    #[serde(default, skip_serializing_if = "Option::is_none")]
10536    pub idle_time: Option<Price>,
10537    /// The `reservationTime` member.
10538    #[serde(rename = "reservationTime")]
10539    #[serde(default, skip_serializing_if = "Option::is_none")]
10540    pub reservation_time: Option<Price>,
10541    /// The `reservationFixed` member.
10542    #[serde(rename = "reservationFixed")]
10543    #[serde(default, skip_serializing_if = "Option::is_none")]
10544    pub reservation_fixed: Option<Price>,
10545    /// The `customData` member.
10546    #[serde(rename = "customData")]
10547    #[serde(default, skip_serializing_if = "Option::is_none")]
10548    pub custom_data: Option<crate::types::CustomData>,
10549}
10550
10551impl TotalCost {
10552    /// Creates a `TotalCost` from its required fields.
10553    #[must_use]
10554    pub fn new(currency: impl Into<String>, type_of_cost: TariffCost, total: TotalPrice) -> Self {
10555        Self {
10556            currency: currency.into(),
10557            type_of_cost,
10558            total,
10559            fixed: None,
10560            energy: None,
10561            charging_time: None,
10562            idle_time: None,
10563            reservation_time: None,
10564            reservation_fixed: None,
10565            custom_data: None,
10566        }
10567    }
10568
10569    /// Sets the optional `fixed` field.
10570    #[must_use]
10571    pub fn with_fixed(mut self, value: Price) -> Self {
10572        self.fixed = Some(value);
10573        self
10574    }
10575
10576    /// Sets the optional `energy` field.
10577    #[must_use]
10578    pub fn with_energy(mut self, value: Price) -> Self {
10579        self.energy = Some(value);
10580        self
10581    }
10582
10583    /// Sets the optional `chargingTime` field.
10584    #[must_use]
10585    pub fn with_charging_time(mut self, value: Price) -> Self {
10586        self.charging_time = Some(value);
10587        self
10588    }
10589
10590    /// Sets the optional `idleTime` field.
10591    #[must_use]
10592    pub fn with_idle_time(mut self, value: Price) -> Self {
10593        self.idle_time = Some(value);
10594        self
10595    }
10596
10597    /// Sets the optional `reservationTime` field.
10598    #[must_use]
10599    pub fn with_reservation_time(mut self, value: Price) -> Self {
10600        self.reservation_time = Some(value);
10601        self
10602    }
10603
10604    /// Sets the optional `reservationFixed` field.
10605    #[must_use]
10606    pub fn with_reservation_fixed(mut self, value: Price) -> Self {
10607        self.reservation_fixed = Some(value);
10608        self
10609    }
10610
10611    /// Sets the optional `customData` field.
10612    #[must_use]
10613    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10614        self.custom_data = Some(value);
10615        self
10616    }
10617}
10618
10619impl Validate for TotalCost {
10620    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10621        path.push_key("currency");
10622        validate::string(self.currency.as_str(), None, Some(3), path, out);
10623        path.pop();
10624        path.push_key("typeOfCost");
10625        Validate::validate_at(&self.type_of_cost, path, out);
10626        path.pop();
10627        path.push_key("total");
10628        Validate::validate_at(&self.total, path, out);
10629        path.pop();
10630        path.push_key("fixed");
10631        if let Some(value) = &self.fixed {
10632            Validate::validate_at(value, path, out);
10633        }
10634        path.pop();
10635        path.push_key("energy");
10636        if let Some(value) = &self.energy {
10637            Validate::validate_at(value, path, out);
10638        }
10639        path.pop();
10640        path.push_key("chargingTime");
10641        if let Some(value) = &self.charging_time {
10642            Validate::validate_at(value, path, out);
10643        }
10644        path.pop();
10645        path.push_key("idleTime");
10646        if let Some(value) = &self.idle_time {
10647            Validate::validate_at(value, path, out);
10648        }
10649        path.pop();
10650        path.push_key("reservationTime");
10651        if let Some(value) = &self.reservation_time {
10652            Validate::validate_at(value, path, out);
10653        }
10654        path.pop();
10655        path.push_key("reservationFixed");
10656        if let Some(value) = &self.reservation_fixed {
10657            Validate::validate_at(value, path, out);
10658        }
10659        path.pop();
10660        path.push_key("customData");
10661        if let Some(value) = &self.custom_data {
10662            Validate::validate_at(value, path, out);
10663        }
10664        path.pop();
10665    }
10666}
10667
10668/// Total cost with and without tax. Contains the total of energy, charging time, idle time, fixed and reservation costs including and/or excluding tax.
10669///
10670/// The OCPP 2.1 `TotalPrice` data type.
10671#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10672pub struct TotalPrice {
10673    /// Price/cost excluding tax. Can be absent if _inclTax_ is present.
10674    #[serde(rename = "exclTax")]
10675    #[serde(default, skip_serializing_if = "Option::is_none")]
10676    pub excl_tax: Option<crate::types::Decimal>,
10677    /// Price/cost including tax. Can be absent if _exclTax_ is present.
10678    #[serde(rename = "inclTax")]
10679    #[serde(default, skip_serializing_if = "Option::is_none")]
10680    pub incl_tax: Option<crate::types::Decimal>,
10681    /// The `customData` member.
10682    #[serde(rename = "customData")]
10683    #[serde(default, skip_serializing_if = "Option::is_none")]
10684    pub custom_data: Option<crate::types::CustomData>,
10685}
10686
10687impl TotalPrice {
10688    /// Creates an empty `TotalPrice`. Every field of this type is optional.
10689    #[must_use]
10690    pub fn new() -> Self {
10691        Self::default()
10692    }
10693
10694    /// Sets the optional `exclTax` field.
10695    #[must_use]
10696    pub fn with_excl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10697        self.excl_tax = Some(value.into());
10698        self
10699    }
10700
10701    /// Sets the optional `inclTax` field.
10702    #[must_use]
10703    pub fn with_incl_tax(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10704        self.incl_tax = Some(value.into());
10705        self
10706    }
10707
10708    /// Sets the optional `customData` field.
10709    #[must_use]
10710    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10711        self.custom_data = Some(value);
10712        self
10713    }
10714}
10715
10716impl Validate for TotalPrice {
10717    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10718        path.push_key("customData");
10719        if let Some(value) = &self.custom_data {
10720            Validate::validate_at(value, path, out);
10721        }
10722        path.pop();
10723    }
10724}
10725
10726/// This contains the calculated usage of energy, charging time and idle time during a transaction.
10727///
10728/// The OCPP 2.1 `TotalUsage` data type.
10729#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10730pub struct TotalUsage {
10731    /// The `energy` member.
10732    pub energy: crate::types::Decimal,
10733    /// Total duration of the charging session (including the duration of charging and not charging), in seconds.
10734    #[serde(rename = "chargingTime")]
10735    pub charging_time: i32,
10736    /// Total duration of the charging session where the EV was not charging (no energy was transferred between EVSE and EV), in seconds.
10737    #[serde(rename = "idleTime")]
10738    pub idle_time: i32,
10739    /// Total time of reservation in seconds.
10740    #[serde(rename = "reservationTime")]
10741    #[serde(default, skip_serializing_if = "Option::is_none")]
10742    pub reservation_time: Option<i32>,
10743    /// The `customData` member.
10744    #[serde(rename = "customData")]
10745    #[serde(default, skip_serializing_if = "Option::is_none")]
10746    pub custom_data: Option<crate::types::CustomData>,
10747}
10748
10749impl TotalUsage {
10750    /// Creates a `TotalUsage` from its required fields.
10751    #[must_use]
10752    pub fn new(
10753        energy: impl Into<crate::types::Decimal>,
10754        charging_time: i32,
10755        idle_time: i32,
10756    ) -> Self {
10757        Self {
10758            energy: energy.into(),
10759            charging_time,
10760            idle_time,
10761            reservation_time: None,
10762            custom_data: None,
10763        }
10764    }
10765
10766    /// Sets the optional `reservationTime` field.
10767    #[must_use]
10768    pub fn with_reservation_time(mut self, value: i32) -> Self {
10769        self.reservation_time = Some(value);
10770        self
10771    }
10772
10773    /// Sets the optional `customData` field.
10774    #[must_use]
10775    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10776        self.custom_data = Some(value);
10777        self
10778    }
10779}
10780
10781impl Validate for TotalUsage {
10782    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10783        path.push_key("customData");
10784        if let Some(value) = &self.custom_data {
10785            Validate::validate_at(value, path, out);
10786        }
10787        path.pop();
10788    }
10789}
10790
10791/// The OCPP 2.1 `Transaction` data type.
10792#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10793pub struct Transaction {
10794    /// This contains the Id of the transaction.
10795    #[serde(rename = "transactionId")]
10796    pub transaction_id: String,
10797    /// The `chargingState` member.
10798    #[serde(rename = "chargingState")]
10799    #[serde(default, skip_serializing_if = "Option::is_none")]
10800    pub charging_state: Option<ChargingState>,
10801    /// 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.
10802    #[serde(rename = "timeSpentCharging")]
10803    #[serde(default, skip_serializing_if = "Option::is_none")]
10804    pub time_spent_charging: Option<i32>,
10805    /// The `stoppedReason` member.
10806    #[serde(rename = "stoppedReason")]
10807    #[serde(default, skip_serializing_if = "Option::is_none")]
10808    pub stopped_reason: Option<Reason>,
10809    /// 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.
10810    #[serde(rename = "remoteStartId")]
10811    #[serde(default, skip_serializing_if = "Option::is_none")]
10812    pub remote_start_id: Option<i32>,
10813    /// The `operationMode` member.
10814    #[serde(rename = "operationMode")]
10815    #[serde(default, skip_serializing_if = "Option::is_none")]
10816    pub operation_mode: Option<OperationMode>,
10817    /// *(2.1)* Id of tariff in use for transaction
10818    #[serde(rename = "tariffId")]
10819    #[serde(default, skip_serializing_if = "Option::is_none")]
10820    pub tariff_id: Option<String>,
10821    /// The `transactionLimit` member.
10822    #[serde(rename = "transactionLimit")]
10823    #[serde(default, skip_serializing_if = "Option::is_none")]
10824    pub transaction_limit: Option<TransactionLimit>,
10825    /// The `customData` member.
10826    #[serde(rename = "customData")]
10827    #[serde(default, skip_serializing_if = "Option::is_none")]
10828    pub custom_data: Option<crate::types::CustomData>,
10829}
10830
10831impl Transaction {
10832    /// Creates a `Transaction` from its required fields.
10833    #[must_use]
10834    pub fn new(transaction_id: impl Into<String>) -> Self {
10835        Self {
10836            transaction_id: transaction_id.into(),
10837            charging_state: None,
10838            time_spent_charging: None,
10839            stopped_reason: None,
10840            remote_start_id: None,
10841            operation_mode: None,
10842            tariff_id: None,
10843            transaction_limit: None,
10844            custom_data: None,
10845        }
10846    }
10847
10848    /// Sets the optional `chargingState` field.
10849    #[must_use]
10850    pub fn with_charging_state(mut self, value: ChargingState) -> Self {
10851        self.charging_state = Some(value);
10852        self
10853    }
10854
10855    /// Sets the optional `timeSpentCharging` field.
10856    #[must_use]
10857    pub fn with_time_spent_charging(mut self, value: i32) -> Self {
10858        self.time_spent_charging = Some(value);
10859        self
10860    }
10861
10862    /// Sets the optional `stoppedReason` field.
10863    #[must_use]
10864    pub fn with_stopped_reason(mut self, value: Reason) -> Self {
10865        self.stopped_reason = Some(value);
10866        self
10867    }
10868
10869    /// Sets the optional `remoteStartId` field.
10870    #[must_use]
10871    pub fn with_remote_start_id(mut self, value: i32) -> Self {
10872        self.remote_start_id = Some(value);
10873        self
10874    }
10875
10876    /// Sets the optional `operationMode` field.
10877    #[must_use]
10878    pub fn with_operation_mode(mut self, value: OperationMode) -> Self {
10879        self.operation_mode = Some(value);
10880        self
10881    }
10882
10883    /// Sets the optional `tariffId` field.
10884    #[must_use]
10885    pub fn with_tariff_id(mut self, value: impl Into<String>) -> Self {
10886        self.tariff_id = Some(value.into());
10887        self
10888    }
10889
10890    /// Sets the optional `transactionLimit` field.
10891    #[must_use]
10892    pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
10893        self.transaction_limit = Some(value);
10894        self
10895    }
10896
10897    /// Sets the optional `customData` field.
10898    #[must_use]
10899    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10900        self.custom_data = Some(value);
10901        self
10902    }
10903}
10904
10905impl Validate for Transaction {
10906    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10907        path.push_key("transactionId");
10908        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
10909        path.pop();
10910        path.push_key("chargingState");
10911        if let Some(value) = &self.charging_state {
10912            Validate::validate_at(value, path, out);
10913        }
10914        path.pop();
10915        path.push_key("stoppedReason");
10916        if let Some(value) = &self.stopped_reason {
10917            Validate::validate_at(value, path, out);
10918        }
10919        path.pop();
10920        path.push_key("operationMode");
10921        if let Some(value) = &self.operation_mode {
10922            Validate::validate_at(value, path, out);
10923        }
10924        path.pop();
10925        path.push_key("tariffId");
10926        if let Some(value) = &self.tariff_id {
10927            validate::string(value.as_str(), None, Some(60), path, out);
10928        }
10929        path.pop();
10930        path.push_key("transactionLimit");
10931        if let Some(value) = &self.transaction_limit {
10932            Validate::validate_at(value, path, out);
10933        }
10934        path.pop();
10935        path.push_key("customData");
10936        if let Some(value) = &self.custom_data {
10937            Validate::validate_at(value, path, out);
10938        }
10939        path.pop();
10940    }
10941}
10942
10943/// Cost, energy, time or SoC limit for a transaction.
10944///
10945/// The OCPP 2.1 `TransactionLimit` data type.
10946#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
10947pub struct TransactionLimit {
10948    /// Maximum allowed cost of transaction in currency of tariff.
10949    #[serde(rename = "maxCost")]
10950    #[serde(default, skip_serializing_if = "Option::is_none")]
10951    pub max_cost: Option<crate::types::Decimal>,
10952    /// Maximum allowed energy in Wh to charge in transaction.
10953    #[serde(rename = "maxEnergy")]
10954    #[serde(default, skip_serializing_if = "Option::is_none")]
10955    pub max_energy: Option<crate::types::Decimal>,
10956    /// Maximum duration of transaction in seconds from start to end.
10957    #[serde(rename = "maxTime")]
10958    #[serde(default, skip_serializing_if = "Option::is_none")]
10959    pub max_time: Option<i32>,
10960    /// Maximum State of Charge of EV in percentage.
10961    #[serde(rename = "maxSoC")]
10962    #[serde(default, skip_serializing_if = "Option::is_none")]
10963    pub max_so_c: Option<i32>,
10964    /// The `customData` member.
10965    #[serde(rename = "customData")]
10966    #[serde(default, skip_serializing_if = "Option::is_none")]
10967    pub custom_data: Option<crate::types::CustomData>,
10968}
10969
10970impl TransactionLimit {
10971    /// Creates an empty `TransactionLimit`. Every field of this type is optional.
10972    #[must_use]
10973    pub fn new() -> Self {
10974        Self::default()
10975    }
10976
10977    /// Sets the optional `maxCost` field.
10978    #[must_use]
10979    pub fn with_max_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10980        self.max_cost = Some(value.into());
10981        self
10982    }
10983
10984    /// Sets the optional `maxEnergy` field.
10985    #[must_use]
10986    pub fn with_max_energy(mut self, value: impl Into<crate::types::Decimal>) -> Self {
10987        self.max_energy = Some(value.into());
10988        self
10989    }
10990
10991    /// Sets the optional `maxTime` field.
10992    #[must_use]
10993    pub fn with_max_time(mut self, value: i32) -> Self {
10994        self.max_time = Some(value);
10995        self
10996    }
10997
10998    /// Sets the optional `maxSoC` field.
10999    #[must_use]
11000    pub fn with_max_so_c(mut self, value: i32) -> Self {
11001        self.max_so_c = Some(value);
11002        self
11003    }
11004
11005    /// Sets the optional `customData` field.
11006    #[must_use]
11007    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11008        self.custom_data = Some(value);
11009        self
11010    }
11011}
11012
11013impl Validate for TransactionLimit {
11014    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11015        path.push_key("maxSoC");
11016        if let Some(value) = &self.max_so_c {
11017            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
11018        }
11019        path.pop();
11020        path.push_key("customData");
11021        if let Some(value) = &self.custom_data {
11022            Validate::validate_at(value, path, out);
11023        }
11024        path.pop();
11025    }
11026}
11027
11028/// Represents a UnitOfMeasure with a multiplier
11029///
11030/// The OCPP 2.1 `UnitOfMeasure` data type.
11031#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11032pub struct UnitOfMeasure {
11033    /// Unit of the value. Default = "Wh" if the (default) measurand is an "Energy" type.
11034    /// This field SHALL use a value from the list Standardized Units of Measurements in Part 2 Appendices.
11035    /// If an applicable unit is available in that list, otherwise a "custom" unit might be used.
11036    /// Schema default: `"Wh"`.
11037    #[serde(default, skip_serializing_if = "Option::is_none")]
11038    pub unit: Option<String>,
11039    /// Multiplier, this value represents the exponent to base 10. I.e. multiplier 3 means 10 raised to the 3rd power. Default is 0. +
11040    /// The _multiplier_ only multiplies the value of the measurand. It does not specify a conversion between units, for example, kW and W.
11041    /// Schema default: `0`.
11042    #[serde(default, skip_serializing_if = "Option::is_none")]
11043    pub multiplier: Option<i32>,
11044    /// The `customData` member.
11045    #[serde(rename = "customData")]
11046    #[serde(default, skip_serializing_if = "Option::is_none")]
11047    pub custom_data: Option<crate::types::CustomData>,
11048}
11049
11050impl UnitOfMeasure {
11051    /// Creates an empty `UnitOfMeasure`. Every field of this type is optional.
11052    #[must_use]
11053    pub fn new() -> Self {
11054        Self::default()
11055    }
11056
11057    /// Sets the optional `unit` field.
11058    #[must_use]
11059    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11060        self.unit = Some(value.into());
11061        self
11062    }
11063
11064    /// Sets the optional `multiplier` field.
11065    #[must_use]
11066    pub fn with_multiplier(mut self, value: i32) -> Self {
11067        self.multiplier = Some(value);
11068        self
11069    }
11070
11071    /// Sets the optional `customData` field.
11072    #[must_use]
11073    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11074        self.custom_data = Some(value);
11075        self
11076    }
11077}
11078
11079impl Validate for UnitOfMeasure {
11080    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11081        path.push_key("unit");
11082        if let Some(value) = &self.unit {
11083            validate::string(value.as_str(), None, Some(20), path, out);
11084        }
11085        path.pop();
11086        path.push_key("customData");
11087        if let Some(value) = &self.custom_data {
11088            Validate::validate_at(value, path, out);
11089        }
11090        path.pop();
11091    }
11092}
11093
11094/// Charging parameters for ISO 15118-20, also supporting V2X charging/discharging.+
11095/// All values are greater or equal to zero, with the exception of EVMinEnergyRequest, EVMaxEnergyRequest, EVTargetEnergyRequest, EVMinV2XEnergyRequest and EVMaxV2XEnergyRequest.
11096///
11097/// The OCPP 2.1 `V2XChargingParameters` data type.
11098#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11099pub struct V2XChargingParameters {
11100    /// Minimum charge power in W, defined by max(EV, EVSE).
11101    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11102    /// Relates to:
11103    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower
11104    #[serde(rename = "minChargePower")]
11105    #[serde(default, skip_serializing_if = "Option::is_none")]
11106    pub min_charge_power: Option<crate::types::Decimal>,
11107    /// Minimum charge power on phase L2 in W, defined by max(EV, EVSE).
11108    /// Relates to:
11109    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L2
11110    #[serde(rename = "minChargePower_L2")]
11111    #[serde(default, skip_serializing_if = "Option::is_none")]
11112    pub min_charge_power_l2: Option<crate::types::Decimal>,
11113    /// Minimum charge power on phase L3 in W, defined by max(EV, EVSE).
11114    /// Relates to:
11115    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumChargePower_L3
11116    #[serde(rename = "minChargePower_L3")]
11117    #[serde(default, skip_serializing_if = "Option::is_none")]
11118    pub min_charge_power_l3: Option<crate::types::Decimal>,
11119    /// Maximum charge (absorbed) power in W, defined by min(EV, EVSE) at unity power factor. +
11120    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11121    /// It corresponds to the ChaWMax attribute in the IEC 61850.
11122    /// It is usually equivalent to the rated apparent power of the EV when discharging (ChaVAMax) in IEC 61850. +
11123    ///
11124    /// Relates to:
11125    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower
11126    #[serde(rename = "maxChargePower")]
11127    #[serde(default, skip_serializing_if = "Option::is_none")]
11128    pub max_charge_power: Option<crate::types::Decimal>,
11129    /// Maximum charge power on phase L2 in W, defined by min(EV, EVSE)
11130    /// Relates to:
11131    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L2
11132    #[serde(rename = "maxChargePower_L2")]
11133    #[serde(default, skip_serializing_if = "Option::is_none")]
11134    pub max_charge_power_l2: Option<crate::types::Decimal>,
11135    /// Maximum charge power on phase L3 in W, defined by min(EV, EVSE)
11136    /// Relates to:
11137    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumChargePower_L3
11138    #[serde(rename = "maxChargePower_L3")]
11139    #[serde(default, skip_serializing_if = "Option::is_none")]
11140    pub max_charge_power_l3: Option<crate::types::Decimal>,
11141    /// Minimum discharge (injected) power in W, defined by max(EV, EVSE) at unity power factor. Value &gt;= 0. +
11142    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1. +
11143    /// It corresponds to the WMax attribute in the IEC 61850.
11144    /// It is usually equivalent to the rated apparent power of the EV when discharging (VAMax attribute in the IEC 61850).
11145    ///
11146    /// Relates to:
11147    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower
11148    #[serde(rename = "minDischargePower")]
11149    #[serde(default, skip_serializing_if = "Option::is_none")]
11150    pub min_discharge_power: Option<crate::types::Decimal>,
11151    /// Minimum discharge power on phase L2 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11152    /// Relates to:
11153    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L2
11154    #[serde(rename = "minDischargePower_L2")]
11155    #[serde(default, skip_serializing_if = "Option::is_none")]
11156    pub min_discharge_power_l2: Option<crate::types::Decimal>,
11157    /// Minimum discharge power on phase L3 in W, defined by max(EV, EVSE).  Value &gt;= 0.
11158    /// Relates to:
11159    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMinimumDischargePower_L3
11160    #[serde(rename = "minDischargePower_L3")]
11161    #[serde(default, skip_serializing_if = "Option::is_none")]
11162    pub min_discharge_power_l3: Option<crate::types::Decimal>,
11163    /// Maximum discharge (injected) power in W, defined by min(EV, EVSE) at unity power factor.  Value &gt;= 0.
11164    /// This field represents the sum of all phases, unless values are provided for L2 and L3, in which case this field represents phase L1.
11165    /// Relates to:
11166    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower
11167    #[serde(rename = "maxDischargePower")]
11168    #[serde(default, skip_serializing_if = "Option::is_none")]
11169    pub max_discharge_power: Option<crate::types::Decimal>,
11170    /// Maximum discharge power on phase L2 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11171    /// Relates to:
11172    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePowe_L2
11173    #[serde(rename = "maxDischargePower_L2")]
11174    #[serde(default, skip_serializing_if = "Option::is_none")]
11175    pub max_discharge_power_l2: Option<crate::types::Decimal>,
11176    /// Maximum discharge power on phase L3 in W, defined by min(EV, EVSE).  Value &gt;= 0.
11177    /// Relates to:
11178    /// *ISO 15118-20*: BPT_AC/DC_CPDReqEnergyTransferModeType: EVMaximumDischargePower_L3
11179    #[serde(rename = "maxDischargePower_L3")]
11180    #[serde(default, skip_serializing_if = "Option::is_none")]
11181    pub max_discharge_power_l3: Option<crate::types::Decimal>,
11182    /// Minimum charge current in A, defined by max(EV, EVSE)
11183    /// Relates to:
11184    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumChargeCurrent
11185    #[serde(rename = "minChargeCurrent")]
11186    #[serde(default, skip_serializing_if = "Option::is_none")]
11187    pub min_charge_current: Option<crate::types::Decimal>,
11188    /// Maximum charge current in A, defined by min(EV, EVSE)
11189    /// Relates to:
11190    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumChargeCurrent
11191    #[serde(rename = "maxChargeCurrent")]
11192    #[serde(default, skip_serializing_if = "Option::is_none")]
11193    pub max_charge_current: Option<crate::types::Decimal>,
11194    /// Minimum discharge current in A, defined by max(EV, EVSE).  Value &gt;= 0.
11195    /// Relates to:
11196    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumDischargeCurrent
11197    #[serde(rename = "minDischargeCurrent")]
11198    #[serde(default, skip_serializing_if = "Option::is_none")]
11199    pub min_discharge_current: Option<crate::types::Decimal>,
11200    /// Maximum discharge current in A, defined by min(EV, EVSE).  Value &gt;= 0.
11201    /// Relates to:
11202    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumDischargeCurrent
11203    #[serde(rename = "maxDischargeCurrent")]
11204    #[serde(default, skip_serializing_if = "Option::is_none")]
11205    pub max_discharge_current: Option<crate::types::Decimal>,
11206    /// Minimum voltage in V, defined by max(EV, EVSE)
11207    /// Relates to:
11208    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMinimumVoltage
11209    #[serde(rename = "minVoltage")]
11210    #[serde(default, skip_serializing_if = "Option::is_none")]
11211    pub min_voltage: Option<crate::types::Decimal>,
11212    /// Maximum voltage in V, defined by min(EV, EVSE)
11213    /// Relates to:
11214    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: EVMaximumVoltage
11215    #[serde(rename = "maxVoltage")]
11216    #[serde(default, skip_serializing_if = "Option::is_none")]
11217    pub max_voltage: Option<crate::types::Decimal>,
11218    /// Energy to requested state of charge in Wh
11219    /// Relates to:
11220    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVTargetEnergyRequest
11221    #[serde(rename = "evTargetEnergyRequest")]
11222    #[serde(default, skip_serializing_if = "Option::is_none")]
11223    pub ev_target_energy_request: Option<crate::types::Decimal>,
11224    /// Energy to minimum allowed state of charge in Wh
11225    /// Relates to:
11226    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMinimumEnergyRequest
11227    #[serde(rename = "evMinEnergyRequest")]
11228    #[serde(default, skip_serializing_if = "Option::is_none")]
11229    pub ev_min_energy_request: Option<crate::types::Decimal>,
11230    /// Energy to maximum state of charge in Wh
11231    /// Relates to:
11232    /// *ISO 15118-20*: Dynamic/Scheduled_SEReqControlModeType: EVMaximumEnergyRequest
11233    #[serde(rename = "evMaxEnergyRequest")]
11234    #[serde(default, skip_serializing_if = "Option::is_none")]
11235    pub ev_max_energy_request: Option<crate::types::Decimal>,
11236    /// Energy (in Wh) to minimum state of charge for cycling (V2X) activity.
11237    /// Positive value means that current state of charge is below V2X range.
11238    /// Relates to:
11239    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMinimumV2XEnergyRequest
11240    #[serde(rename = "evMinV2XEnergyRequest")]
11241    #[serde(default, skip_serializing_if = "Option::is_none")]
11242    pub ev_min_v2_x_energy_request: Option<crate::types::Decimal>,
11243    /// Energy (in Wh) to maximum state of charge for cycling (V2X) activity.
11244    /// Negative value indicates that current state of charge is above V2X range.
11245    /// Relates to:
11246    /// *ISO 15118-20*: Dynamic_SEReqControlModeType: EVMaximumV2XEnergyRequest
11247    #[serde(rename = "evMaxV2XEnergyRequest")]
11248    #[serde(default, skip_serializing_if = "Option::is_none")]
11249    pub ev_max_v2_x_energy_request: Option<crate::types::Decimal>,
11250    /// Target state of charge at departure as percentage.
11251    /// Relates to:
11252    /// *ISO 15118-20*: BPT_DC_CPDReqEnergyTransferModeType: TargetSOC
11253    #[serde(rename = "targetSoC")]
11254    #[serde(default, skip_serializing_if = "Option::is_none")]
11255    pub target_so_c: Option<i32>,
11256    /// The `customData` member.
11257    #[serde(rename = "customData")]
11258    #[serde(default, skip_serializing_if = "Option::is_none")]
11259    pub custom_data: Option<crate::types::CustomData>,
11260}
11261
11262impl V2XChargingParameters {
11263    /// Creates an empty `V2XChargingParameters`. Every field of this type is optional.
11264    #[must_use]
11265    pub fn new() -> Self {
11266        Self::default()
11267    }
11268
11269    /// Sets the optional `minChargePower` field.
11270    #[must_use]
11271    pub fn with_min_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11272        self.min_charge_power = Some(value.into());
11273        self
11274    }
11275
11276    /// Sets the optional `minChargePower_L2` field.
11277    #[must_use]
11278    pub fn with_min_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11279        self.min_charge_power_l2 = Some(value.into());
11280        self
11281    }
11282
11283    /// Sets the optional `minChargePower_L3` field.
11284    #[must_use]
11285    pub fn with_min_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11286        self.min_charge_power_l3 = Some(value.into());
11287        self
11288    }
11289
11290    /// Sets the optional `maxChargePower` field.
11291    #[must_use]
11292    pub fn with_max_charge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11293        self.max_charge_power = Some(value.into());
11294        self
11295    }
11296
11297    /// Sets the optional `maxChargePower_L2` field.
11298    #[must_use]
11299    pub fn with_max_charge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11300        self.max_charge_power_l2 = Some(value.into());
11301        self
11302    }
11303
11304    /// Sets the optional `maxChargePower_L3` field.
11305    #[must_use]
11306    pub fn with_max_charge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11307        self.max_charge_power_l3 = Some(value.into());
11308        self
11309    }
11310
11311    /// Sets the optional `minDischargePower` field.
11312    #[must_use]
11313    pub fn with_min_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11314        self.min_discharge_power = Some(value.into());
11315        self
11316    }
11317
11318    /// Sets the optional `minDischargePower_L2` field.
11319    #[must_use]
11320    pub fn with_min_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11321        self.min_discharge_power_l2 = Some(value.into());
11322        self
11323    }
11324
11325    /// Sets the optional `minDischargePower_L3` field.
11326    #[must_use]
11327    pub fn with_min_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11328        self.min_discharge_power_l3 = Some(value.into());
11329        self
11330    }
11331
11332    /// Sets the optional `maxDischargePower` field.
11333    #[must_use]
11334    pub fn with_max_discharge_power(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11335        self.max_discharge_power = Some(value.into());
11336        self
11337    }
11338
11339    /// Sets the optional `maxDischargePower_L2` field.
11340    #[must_use]
11341    pub fn with_max_discharge_power_l2(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11342        self.max_discharge_power_l2 = Some(value.into());
11343        self
11344    }
11345
11346    /// Sets the optional `maxDischargePower_L3` field.
11347    #[must_use]
11348    pub fn with_max_discharge_power_l3(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11349        self.max_discharge_power_l3 = Some(value.into());
11350        self
11351    }
11352
11353    /// Sets the optional `minChargeCurrent` field.
11354    #[must_use]
11355    pub fn with_min_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11356        self.min_charge_current = Some(value.into());
11357        self
11358    }
11359
11360    /// Sets the optional `maxChargeCurrent` field.
11361    #[must_use]
11362    pub fn with_max_charge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11363        self.max_charge_current = Some(value.into());
11364        self
11365    }
11366
11367    /// Sets the optional `minDischargeCurrent` field.
11368    #[must_use]
11369    pub fn with_min_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11370        self.min_discharge_current = Some(value.into());
11371        self
11372    }
11373
11374    /// Sets the optional `maxDischargeCurrent` field.
11375    #[must_use]
11376    pub fn with_max_discharge_current(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11377        self.max_discharge_current = Some(value.into());
11378        self
11379    }
11380
11381    /// Sets the optional `minVoltage` field.
11382    #[must_use]
11383    pub fn with_min_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11384        self.min_voltage = Some(value.into());
11385        self
11386    }
11387
11388    /// Sets the optional `maxVoltage` field.
11389    #[must_use]
11390    pub fn with_max_voltage(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11391        self.max_voltage = Some(value.into());
11392        self
11393    }
11394
11395    /// Sets the optional `evTargetEnergyRequest` field.
11396    #[must_use]
11397    pub fn with_ev_target_energy_request(
11398        mut self,
11399        value: impl Into<crate::types::Decimal>,
11400    ) -> Self {
11401        self.ev_target_energy_request = Some(value.into());
11402        self
11403    }
11404
11405    /// Sets the optional `evMinEnergyRequest` field.
11406    #[must_use]
11407    pub fn with_ev_min_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11408        self.ev_min_energy_request = Some(value.into());
11409        self
11410    }
11411
11412    /// Sets the optional `evMaxEnergyRequest` field.
11413    #[must_use]
11414    pub fn with_ev_max_energy_request(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11415        self.ev_max_energy_request = Some(value.into());
11416        self
11417    }
11418
11419    /// Sets the optional `evMinV2XEnergyRequest` field.
11420    #[must_use]
11421    pub fn with_ev_min_v2_x_energy_request(
11422        mut self,
11423        value: impl Into<crate::types::Decimal>,
11424    ) -> Self {
11425        self.ev_min_v2_x_energy_request = Some(value.into());
11426        self
11427    }
11428
11429    /// Sets the optional `evMaxV2XEnergyRequest` field.
11430    #[must_use]
11431    pub fn with_ev_max_v2_x_energy_request(
11432        mut self,
11433        value: impl Into<crate::types::Decimal>,
11434    ) -> Self {
11435        self.ev_max_v2_x_energy_request = Some(value.into());
11436        self
11437    }
11438
11439    /// Sets the optional `targetSoC` field.
11440    #[must_use]
11441    pub fn with_target_so_c(mut self, value: i32) -> Self {
11442        self.target_so_c = Some(value);
11443        self
11444    }
11445
11446    /// Sets the optional `customData` field.
11447    #[must_use]
11448    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11449        self.custom_data = Some(value);
11450        self
11451    }
11452}
11453
11454impl Validate for V2XChargingParameters {
11455    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11456        path.push_key("targetSoC");
11457        if let Some(value) = &self.target_so_c {
11458            validate::int_range(i64::from(*value), Some(0), Some(100), path, out);
11459        }
11460        path.pop();
11461        path.push_key("customData");
11462        if let Some(value) = &self.custom_data {
11463            Validate::validate_at(value, path, out);
11464        }
11465        path.pop();
11466    }
11467}
11468
11469/// *(2.1)* A point of a frequency-watt curve.
11470///
11471/// The OCPP 2.1 `V2XFreqWattPoint` data type.
11472#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11473pub struct V2XFreqWattPoint {
11474    /// Net frequency in Hz.
11475    pub frequency: crate::types::Decimal,
11476    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11477    pub power: crate::types::Decimal,
11478    /// The `customData` member.
11479    #[serde(rename = "customData")]
11480    #[serde(default, skip_serializing_if = "Option::is_none")]
11481    pub custom_data: Option<crate::types::CustomData>,
11482}
11483
11484impl V2XFreqWattPoint {
11485    /// Creates a `V2XFreqWattPoint` from its required fields.
11486    #[must_use]
11487    pub fn new(
11488        frequency: impl Into<crate::types::Decimal>,
11489        power: impl Into<crate::types::Decimal>,
11490    ) -> Self {
11491        Self {
11492            frequency: frequency.into(),
11493            power: power.into(),
11494            custom_data: None,
11495        }
11496    }
11497
11498    /// Sets the optional `customData` field.
11499    #[must_use]
11500    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11501        self.custom_data = Some(value);
11502        self
11503    }
11504}
11505
11506impl Validate for V2XFreqWattPoint {
11507    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11508        path.push_key("customData");
11509        if let Some(value) = &self.custom_data {
11510            Validate::validate_at(value, path, out);
11511        }
11512        path.pop();
11513    }
11514}
11515
11516/// *(2.1)* A point of a signal-watt curve.
11517///
11518/// The OCPP 2.1 `V2XSignalWattPoint` data type.
11519#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11520pub struct V2XSignalWattPoint {
11521    /// Signal value from an AFRRSignalRequest.
11522    pub signal: i32,
11523    /// Power in W to charge (positive) or discharge (negative) at specified frequency.
11524    pub power: crate::types::Decimal,
11525    /// The `customData` member.
11526    #[serde(rename = "customData")]
11527    #[serde(default, skip_serializing_if = "Option::is_none")]
11528    pub custom_data: Option<crate::types::CustomData>,
11529}
11530
11531impl V2XSignalWattPoint {
11532    /// Creates a `V2XSignalWattPoint` from its required fields.
11533    #[must_use]
11534    pub fn new(signal: i32, power: impl Into<crate::types::Decimal>) -> Self {
11535        Self {
11536            signal,
11537            power: power.into(),
11538            custom_data: None,
11539        }
11540    }
11541
11542    /// Sets the optional `customData` field.
11543    #[must_use]
11544    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11545        self.custom_data = Some(value);
11546        self
11547    }
11548}
11549
11550impl Validate for V2XSignalWattPoint {
11551    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
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/// VPN Configuration settings
11561///
11562/// The OCPP 2.1 `VPN` data type.
11563#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11564pub struct VPN {
11565    /// VPN Server Address
11566    pub server: String,
11567    /// VPN User
11568    pub user: String,
11569    /// *(2.1)* VPN Password.
11570    pub password: String,
11571    /// VPN shared secret.
11572    pub key: String,
11573    /// The `type` member.
11574    pub r#type: VPNEnum,
11575    /// VPN group.
11576    #[serde(default, skip_serializing_if = "Option::is_none")]
11577    pub group: Option<String>,
11578    /// The `customData` member.
11579    #[serde(rename = "customData")]
11580    #[serde(default, skip_serializing_if = "Option::is_none")]
11581    pub custom_data: Option<crate::types::CustomData>,
11582}
11583
11584impl VPN {
11585    /// Creates a `VPN` from its required fields.
11586    #[must_use]
11587    pub fn new(
11588        server: impl Into<String>,
11589        user: impl Into<String>,
11590        password: impl Into<String>,
11591        key: impl Into<String>,
11592        r#type: VPNEnum,
11593    ) -> Self {
11594        Self {
11595            server: server.into(),
11596            user: user.into(),
11597            password: password.into(),
11598            key: key.into(),
11599            r#type,
11600            group: None,
11601            custom_data: None,
11602        }
11603    }
11604
11605    /// Sets the optional `group` field.
11606    #[must_use]
11607    pub fn with_group(mut self, value: impl Into<String>) -> Self {
11608        self.group = Some(value.into());
11609        self
11610    }
11611
11612    /// Sets the optional `customData` field.
11613    #[must_use]
11614    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11615        self.custom_data = Some(value);
11616        self
11617    }
11618}
11619
11620impl Validate for VPN {
11621    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11622        path.push_key("server");
11623        validate::string(self.server.as_str(), None, Some(2000), path, out);
11624        path.pop();
11625        path.push_key("user");
11626        validate::string(self.user.as_str(), None, Some(50), path, out);
11627        path.pop();
11628        path.push_key("password");
11629        validate::string(self.password.as_str(), None, Some(64), path, out);
11630        path.pop();
11631        path.push_key("key");
11632        validate::string(self.key.as_str(), None, Some(255), path, out);
11633        path.pop();
11634        path.push_key("type");
11635        Validate::validate_at(&self.r#type, path, out);
11636        path.pop();
11637        path.push_key("group");
11638        if let Some(value) = &self.group {
11639            validate::string(value.as_str(), None, Some(50), path, out);
11640        }
11641        path.pop();
11642        path.push_key("customData");
11643        if let Some(value) = &self.custom_data {
11644            Validate::validate_at(value, path, out);
11645        }
11646        path.pop();
11647    }
11648}
11649
11650/// Reference key to a component-variable.
11651///
11652/// The OCPP 2.1 `Variable` data type.
11653#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11654pub struct Variable {
11655    /// 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.
11656    pub name: String,
11657    /// Name of instance in case the variable exists as multiple instances. Case Insensitive. strongly advised to use Camel Case.
11658    #[serde(default, skip_serializing_if = "Option::is_none")]
11659    pub instance: Option<String>,
11660    /// The `customData` member.
11661    #[serde(rename = "customData")]
11662    #[serde(default, skip_serializing_if = "Option::is_none")]
11663    pub custom_data: Option<crate::types::CustomData>,
11664}
11665
11666impl Variable {
11667    /// Creates a `Variable` from its required fields.
11668    #[must_use]
11669    pub fn new(name: impl Into<String>) -> Self {
11670        Self {
11671            name: name.into(),
11672            instance: None,
11673            custom_data: None,
11674        }
11675    }
11676
11677    /// Sets the optional `instance` field.
11678    #[must_use]
11679    pub fn with_instance(mut self, value: impl Into<String>) -> Self {
11680        self.instance = Some(value.into());
11681        self
11682    }
11683
11684    /// Sets the optional `customData` field.
11685    #[must_use]
11686    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11687        self.custom_data = Some(value);
11688        self
11689    }
11690}
11691
11692impl Validate for Variable {
11693    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11694        path.push_key("name");
11695        validate::string(self.name.as_str(), None, Some(50), path, out);
11696        path.pop();
11697        path.push_key("instance");
11698        if let Some(value) = &self.instance {
11699            validate::string(value.as_str(), None, Some(50), path, out);
11700        }
11701        path.pop();
11702        path.push_key("customData");
11703        if let Some(value) = &self.custom_data {
11704            Validate::validate_at(value, path, out);
11705        }
11706        path.pop();
11707    }
11708}
11709
11710/// Attribute data of a variable.
11711///
11712/// The OCPP 2.1 `VariableAttribute` data type.
11713#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11714pub struct VariableAttribute {
11715    /// The `type` member.
11716    #[serde(default, skip_serializing_if = "Option::is_none")]
11717    pub r#type: Option<Attribute>,
11718    /// Value of the attribute. May only be omitted when mutability is set to 'WriteOnly'.
11719    ///
11720    /// 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.
11721    #[serde(default, skip_serializing_if = "Option::is_none")]
11722    pub value: Option<String>,
11723    /// The `mutability` member.
11724    #[serde(default, skip_serializing_if = "Option::is_none")]
11725    pub mutability: Option<Mutability>,
11726    /// If true, value will be persistent across system reboots or power down. Default when omitted is false.
11727    /// Schema default: `false`.
11728    #[serde(default, skip_serializing_if = "Option::is_none")]
11729    pub persistent: Option<bool>,
11730    /// If true, value that will never be changed by the Charging Station at runtime. Default when omitted is false.
11731    /// Schema default: `false`.
11732    #[serde(default, skip_serializing_if = "Option::is_none")]
11733    pub constant: Option<bool>,
11734    /// The `customData` member.
11735    #[serde(rename = "customData")]
11736    #[serde(default, skip_serializing_if = "Option::is_none")]
11737    pub custom_data: Option<crate::types::CustomData>,
11738}
11739
11740impl VariableAttribute {
11741    /// Creates an empty `VariableAttribute`. Every field of this type is optional.
11742    #[must_use]
11743    pub fn new() -> Self {
11744        Self::default()
11745    }
11746
11747    /// Sets the optional `type` field.
11748    #[must_use]
11749    pub fn with_type(mut self, value: Attribute) -> Self {
11750        self.r#type = Some(value);
11751        self
11752    }
11753
11754    /// Sets the optional `value` field.
11755    #[must_use]
11756    pub fn with_value(mut self, value: impl Into<String>) -> Self {
11757        self.value = Some(value.into());
11758        self
11759    }
11760
11761    /// Sets the optional `mutability` field.
11762    #[must_use]
11763    pub fn with_mutability(mut self, value: Mutability) -> Self {
11764        self.mutability = Some(value);
11765        self
11766    }
11767
11768    /// Sets the optional `persistent` field.
11769    #[must_use]
11770    pub fn with_persistent(mut self, value: bool) -> Self {
11771        self.persistent = Some(value);
11772        self
11773    }
11774
11775    /// Sets the optional `constant` field.
11776    #[must_use]
11777    pub fn with_constant(mut self, value: bool) -> Self {
11778        self.constant = Some(value);
11779        self
11780    }
11781
11782    /// Sets the optional `customData` field.
11783    #[must_use]
11784    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11785        self.custom_data = Some(value);
11786        self
11787    }
11788}
11789
11790impl Validate for VariableAttribute {
11791    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11792        path.push_key("type");
11793        if let Some(value) = &self.r#type {
11794            Validate::validate_at(value, path, out);
11795        }
11796        path.pop();
11797        path.push_key("value");
11798        if let Some(value) = &self.value {
11799            validate::string(value.as_str(), None, Some(2500), path, out);
11800        }
11801        path.pop();
11802        path.push_key("mutability");
11803        if let Some(value) = &self.mutability {
11804            Validate::validate_at(value, path, out);
11805        }
11806        path.pop();
11807        path.push_key("customData");
11808        if let Some(value) = &self.custom_data {
11809            Validate::validate_at(value, path, out);
11810        }
11811        path.pop();
11812    }
11813}
11814
11815/// Fixed read-only parameters of a variable.
11816///
11817/// The OCPP 2.1 `VariableCharacteristics` data type.
11818#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11819pub struct VariableCharacteristics {
11820    /// The `dataType` member.
11821    #[serde(rename = "dataType")]
11822    pub data_type: Data,
11823    /// Flag indicating if this variable supports monitoring.
11824    #[serde(rename = "supportsMonitoring")]
11825    pub supports_monitoring: bool,
11826    /// Unit of the variable. When the transmitted value has a unit, this field SHALL be included.
11827    #[serde(default, skip_serializing_if = "Option::is_none")]
11828    pub unit: Option<String>,
11829    /// Minimum possible value of this variable.
11830    #[serde(rename = "minLimit")]
11831    #[serde(default, skip_serializing_if = "Option::is_none")]
11832    pub min_limit: Option<crate::types::Decimal>,
11833    /// 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.
11834    #[serde(rename = "maxLimit")]
11835    #[serde(default, skip_serializing_if = "Option::is_none")]
11836    pub max_limit: Option<crate::types::Decimal>,
11837    /// *(2.1)* Maximum number of elements from _valuesList_ that are supported as _attributeValue_.
11838    #[serde(rename = "maxElements")]
11839    #[serde(default, skip_serializing_if = "Option::is_none")]
11840    pub max_elements: Option<i32>,
11841    /// Mandatory when _dataType_ = OptionList, MemberList or SequenceList. In that case _valuesList_ specifies the allowed values for the type.
11842    ///
11843    /// The length of this field can be limited by DeviceDataCtrlr.ConfigurationValueSize.
11844    ///
11845    /// * OptionList: The (Actual) Variable value must be a single value from the reported (CSV) enumeration list.
11846    ///
11847    /// * MemberList: The (Actual) Variable value  may be an (unordered) (sub-)set of the reported (CSV) valid values list.
11848    ///
11849    /// * SequenceList: The (Actual) Variable value  may be an ordered (priority, etc)  (sub-)set of the reported (CSV) valid values.
11850    ///
11851    /// This is a comma separated list.
11852    ///
11853    /// 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.
11854    #[serde(rename = "valuesList")]
11855    #[serde(default, skip_serializing_if = "Option::is_none")]
11856    pub values_list: Option<String>,
11857    /// The `customData` member.
11858    #[serde(rename = "customData")]
11859    #[serde(default, skip_serializing_if = "Option::is_none")]
11860    pub custom_data: Option<crate::types::CustomData>,
11861}
11862
11863impl VariableCharacteristics {
11864    /// Creates a `VariableCharacteristics` from its required fields.
11865    #[must_use]
11866    pub fn new(data_type: Data, supports_monitoring: bool) -> Self {
11867        Self {
11868            data_type,
11869            supports_monitoring,
11870            unit: None,
11871            min_limit: None,
11872            max_limit: None,
11873            max_elements: None,
11874            values_list: None,
11875            custom_data: None,
11876        }
11877    }
11878
11879    /// Sets the optional `unit` field.
11880    #[must_use]
11881    pub fn with_unit(mut self, value: impl Into<String>) -> Self {
11882        self.unit = Some(value.into());
11883        self
11884    }
11885
11886    /// Sets the optional `minLimit` field.
11887    #[must_use]
11888    pub fn with_min_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11889        self.min_limit = Some(value.into());
11890        self
11891    }
11892
11893    /// Sets the optional `maxLimit` field.
11894    #[must_use]
11895    pub fn with_max_limit(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11896        self.max_limit = Some(value.into());
11897        self
11898    }
11899
11900    /// Sets the optional `maxElements` field.
11901    #[must_use]
11902    pub fn with_max_elements(mut self, value: i32) -> Self {
11903        self.max_elements = Some(value);
11904        self
11905    }
11906
11907    /// Sets the optional `valuesList` field.
11908    #[must_use]
11909    pub fn with_values_list(mut self, value: impl Into<String>) -> Self {
11910        self.values_list = Some(value.into());
11911        self
11912    }
11913
11914    /// Sets the optional `customData` field.
11915    #[must_use]
11916    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11917        self.custom_data = Some(value);
11918        self
11919    }
11920}
11921
11922impl Validate for VariableCharacteristics {
11923    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11924        path.push_key("dataType");
11925        Validate::validate_at(&self.data_type, path, out);
11926        path.pop();
11927        path.push_key("unit");
11928        if let Some(value) = &self.unit {
11929            validate::string(value.as_str(), None, Some(16), path, out);
11930        }
11931        path.pop();
11932        path.push_key("maxElements");
11933        if let Some(value) = &self.max_elements {
11934            validate::int_range(i64::from(*value), Some(1), None, path, out);
11935        }
11936        path.pop();
11937        path.push_key("valuesList");
11938        if let Some(value) = &self.values_list {
11939            validate::string(value.as_str(), None, Some(1000), path, out);
11940        }
11941        path.pop();
11942        path.push_key("customData");
11943        if let Some(value) = &self.custom_data {
11944            Validate::validate_at(value, path, out);
11945        }
11946        path.pop();
11947    }
11948}
11949
11950/// A monitoring setting for a variable.
11951///
11952/// The OCPP 2.1 `VariableMonitoring` data type.
11953#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11954pub struct VariableMonitoring {
11955    /// Identifies the monitor.
11956    pub id: i32,
11957    /// Monitor only active when a transaction is ongoing on a component relevant to this transaction.
11958    pub transaction: bool,
11959    /// Value for threshold or delta monitoring.
11960    /// For Periodic or PeriodicClockAligned this is the interval in seconds.
11961    pub value: crate::types::Decimal,
11962    /// The `type` member.
11963    pub r#type: Monitor,
11964    /// 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.
11965    ///
11966    /// The severity levels have the following meaning: +
11967    /// *0-Danger* +
11968    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
11969    /// *1-Hardware Failure* +
11970    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
11971    /// *2-System Failure* +
11972    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
11973    /// *3-Critical* +
11974    /// Indicates a critical error. Action is required. +
11975    /// *4-Error* +
11976    /// Indicates a non-urgent error. Action is required. +
11977    /// *5-Alert* +
11978    /// Indicates an alert event. Default severity for any type of monitoring event.  +
11979    /// *6-Warning* +
11980    /// Indicates a warning event. Action may be required. +
11981    /// *7-Notice* +
11982    /// Indicates an unusual event. No immediate action is required. +
11983    /// *8-Informational* +
11984    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
11985    /// *9-Debug* +
11986    /// Indicates information useful to developers for debugging, not useful during operations.
11987    pub severity: i32,
11988    /// The `eventNotificationType` member.
11989    #[serde(rename = "eventNotificationType")]
11990    pub event_notification_type: EventNotification,
11991    /// The `customData` member.
11992    #[serde(rename = "customData")]
11993    #[serde(default, skip_serializing_if = "Option::is_none")]
11994    pub custom_data: Option<crate::types::CustomData>,
11995}
11996
11997impl VariableMonitoring {
11998    /// Creates a `VariableMonitoring` from its required fields.
11999    #[must_use]
12000    pub fn new(
12001        id: i32,
12002        transaction: bool,
12003        value: impl Into<crate::types::Decimal>,
12004        r#type: Monitor,
12005        severity: i32,
12006        event_notification_type: EventNotification,
12007    ) -> Self {
12008        Self {
12009            id,
12010            transaction,
12011            value: value.into(),
12012            r#type,
12013            severity,
12014            event_notification_type,
12015            custom_data: None,
12016        }
12017    }
12018
12019    /// Sets the optional `customData` field.
12020    #[must_use]
12021    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12022        self.custom_data = Some(value);
12023        self
12024    }
12025}
12026
12027impl Validate for VariableMonitoring {
12028    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12029        path.push_key("id");
12030        validate::int_range(i64::from(self.id), Some(0), None, path, out);
12031        path.pop();
12032        path.push_key("type");
12033        Validate::validate_at(&self.r#type, path, out);
12034        path.pop();
12035        path.push_key("severity");
12036        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
12037        path.pop();
12038        path.push_key("eventNotificationType");
12039        Validate::validate_at(&self.event_notification_type, path, out);
12040        path.pop();
12041        path.push_key("customData");
12042        if let Some(value) = &self.custom_data {
12043            Validate::validate_at(value, path, out);
12044        }
12045        path.pop();
12046    }
12047}
12048
12049/// The OCPP 2.1 `VoltageParams` data type.
12050#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
12051pub struct VoltageParams {
12052    /// EN 50549-1 chapter 4.9.3.4
12053    ///     Voltage threshold for the 10 min time window mean value monitoring.
12054    ///     The 10 min mean is recalculated up to every 3 s.
12055    ///     If the present voltage is above this threshold for more than the time defined by _hv10MinMeanValue_, the EV must trip.
12056    ///     This value is mandatory if _hv10MinMeanTripDelay_ is set.
12057    #[serde(rename = "hv10MinMeanValue")]
12058    #[serde(default, skip_serializing_if = "Option::is_none")]
12059    pub hv10_min_mean_value: Option<crate::types::Decimal>,
12060    /// Time for which the voltage is allowed to stay above the 10 min mean value.
12061    ///     After this time, the EV must trip.
12062    ///     This value is mandatory if OverVoltageMeanValue10min is set.
12063    #[serde(rename = "hv10MinMeanTripDelay")]
12064    #[serde(default, skip_serializing_if = "Option::is_none")]
12065    pub hv10_min_mean_trip_delay: Option<crate::types::Decimal>,
12066    /// The `powerDuringCessation` member.
12067    #[serde(rename = "powerDuringCessation")]
12068    #[serde(default, skip_serializing_if = "Option::is_none")]
12069    pub power_during_cessation: Option<PowerDuringCessation>,
12070    /// The `customData` member.
12071    #[serde(rename = "customData")]
12072    #[serde(default, skip_serializing_if = "Option::is_none")]
12073    pub custom_data: Option<crate::types::CustomData>,
12074}
12075
12076impl VoltageParams {
12077    /// Creates an empty `VoltageParams`. Every field of this type is optional.
12078    #[must_use]
12079    pub fn new() -> Self {
12080        Self::default()
12081    }
12082
12083    /// Sets the optional `hv10MinMeanValue` field.
12084    #[must_use]
12085    pub fn with_hv10_min_mean_value(mut self, value: impl Into<crate::types::Decimal>) -> Self {
12086        self.hv10_min_mean_value = Some(value.into());
12087        self
12088    }
12089
12090    /// Sets the optional `hv10MinMeanTripDelay` field.
12091    #[must_use]
12092    pub fn with_hv10_min_mean_trip_delay(
12093        mut self,
12094        value: impl Into<crate::types::Decimal>,
12095    ) -> Self {
12096        self.hv10_min_mean_trip_delay = Some(value.into());
12097        self
12098    }
12099
12100    /// Sets the optional `powerDuringCessation` field.
12101    #[must_use]
12102    pub fn with_power_during_cessation(mut self, value: PowerDuringCessation) -> Self {
12103        self.power_during_cessation = Some(value);
12104        self
12105    }
12106
12107    /// Sets the optional `customData` field.
12108    #[must_use]
12109    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12110        self.custom_data = Some(value);
12111        self
12112    }
12113}
12114
12115impl Validate for VoltageParams {
12116    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12117        path.push_key("powerDuringCessation");
12118        if let Some(value) = &self.power_during_cessation {
12119            Validate::validate_at(value, path, out);
12120        }
12121        path.pop();
12122        path.push_key("customData");
12123        if let Some(value) = &self.custom_data {
12124            Validate::validate_at(value, path, out);
12125        }
12126        path.pop();
12127    }
12128}