Skip to main content

ocpp_kit/v2_1/
messages.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//! Request and response payloads for every OCPP 2.1 action.
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::action::Action;
20use super::enums::*;
21use super::types::*;
22use crate::message::{Confirmed, MessageKind, Origin, Request, Response, Sealed, Unconfirmed};
23use crate::validate::{self, Validate, ValidationPath, Violations};
24
25/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct AFRRSignalRequest {
28    /// Time when signal becomes active.
29    pub timestamp: crate::types::DateTime,
30    /// Value of signal in _v2xSignalWattCurve_.
31    #[serde(deserialize_with = "crate::types::integer::one")]
32    pub signal: i32,
33    /// The `customData` member.
34    #[serde(rename = "customData")]
35    #[serde(default, skip_serializing_if = "Option::is_none")]
36    pub custom_data: Option<crate::types::CustomData>,
37}
38
39impl AFRRSignalRequest {
40    /// Creates a `AFRRSignalRequest` from its required fields.
41    #[must_use]
42    pub fn new(timestamp: impl Into<crate::types::DateTime>, signal: i32) -> Self {
43        Self {
44            timestamp: timestamp.into(),
45            signal,
46            custom_data: None,
47        }
48    }
49
50    /// Sets the optional `customData` field.
51    #[must_use]
52    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
53        self.custom_data = Some(value);
54        self
55    }
56}
57
58impl Validate for AFRRSignalRequest {
59    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
60        path.push_key("customData");
61        if let Some(value) = &self.custom_data {
62            Validate::validate_at(value, path, out);
63        }
64        path.pop();
65    }
66}
67
68impl Sealed for AFRRSignalRequest {}
69impl Request for AFRRSignalRequest {
70    type Action = Action;
71    const ACTION: Action = Action::AFRRSignal;
72    const KIND: MessageKind = MessageKind::Call;
73    const ORIGIN: Origin = Origin::Csms;
74    type Response = AFRRSignalResponse;
75}
76
77impl Confirmed for AFRRSignalRequest {}
78
79/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
80#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
81pub struct AFRRSignalResponse {
82    /// The `status` member.
83    pub status: GenericStatus,
84    /// The `statusInfo` member.
85    #[serde(rename = "statusInfo")]
86    #[serde(default, skip_serializing_if = "Option::is_none")]
87    pub status_info: Option<StatusInfo>,
88    /// The `customData` member.
89    #[serde(rename = "customData")]
90    #[serde(default, skip_serializing_if = "Option::is_none")]
91    pub custom_data: Option<crate::types::CustomData>,
92}
93
94impl AFRRSignalResponse {
95    /// Creates a `AFRRSignalResponse` from its required fields.
96    #[must_use]
97    pub fn new(status: GenericStatus) -> Self {
98        Self {
99            status,
100            status_info: None,
101            custom_data: None,
102        }
103    }
104
105    /// Sets the optional `statusInfo` field.
106    #[must_use]
107    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
108        self.status_info = Some(value);
109        self
110    }
111
112    /// Sets the optional `customData` field.
113    #[must_use]
114    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
115        self.custom_data = Some(value);
116        self
117    }
118}
119
120impl Validate for AFRRSignalResponse {
121    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
122        path.push_key("status");
123        Validate::validate_at(&self.status, path, out);
124        path.pop();
125        path.push_key("statusInfo");
126        if let Some(value) = &self.status_info {
127            Validate::validate_at(value, path, out);
128        }
129        path.pop();
130        path.push_key("customData");
131        if let Some(value) = &self.custom_data {
132            Validate::validate_at(value, path, out);
133        }
134        path.pop();
135    }
136}
137
138impl Sealed for AFRRSignalResponse {}
139impl Response for AFRRSignalResponse {}
140
141/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
142#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
143pub struct AdjustPeriodicEventStreamRequest {
144    /// The `id` member.
145    #[serde(deserialize_with = "crate::types::integer::one")]
146    pub id: i32,
147    /// The `params` member.
148    pub params: PeriodicEventStreamParams,
149    /// The `customData` member.
150    #[serde(rename = "customData")]
151    #[serde(default, skip_serializing_if = "Option::is_none")]
152    pub custom_data: Option<crate::types::CustomData>,
153}
154
155impl AdjustPeriodicEventStreamRequest {
156    /// Creates a `AdjustPeriodicEventStreamRequest` from its required fields.
157    #[must_use]
158    pub fn new(id: i32, params: PeriodicEventStreamParams) -> Self {
159        Self {
160            id,
161            params,
162            custom_data: None,
163        }
164    }
165
166    /// Sets the optional `customData` field.
167    #[must_use]
168    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
169        self.custom_data = Some(value);
170        self
171    }
172}
173
174impl Validate for AdjustPeriodicEventStreamRequest {
175    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
176        path.push_key("id");
177        validate::int_range(i64::from(self.id), Some(0), None, path, out);
178        path.pop();
179        path.push_key("params");
180        Validate::validate_at(&self.params, path, out);
181        path.pop();
182        path.push_key("customData");
183        if let Some(value) = &self.custom_data {
184            Validate::validate_at(value, path, out);
185        }
186        path.pop();
187    }
188}
189
190impl Sealed for AdjustPeriodicEventStreamRequest {}
191impl Request for AdjustPeriodicEventStreamRequest {
192    type Action = Action;
193    const ACTION: Action = Action::AdjustPeriodicEventStream;
194    const KIND: MessageKind = MessageKind::Call;
195    const ORIGIN: Origin = Origin::Csms;
196    type Response = AdjustPeriodicEventStreamResponse;
197}
198
199impl Confirmed for AdjustPeriodicEventStreamRequest {}
200
201/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
202#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
203pub struct AdjustPeriodicEventStreamResponse {
204    /// The `status` member.
205    pub status: GenericStatus,
206    /// The `statusInfo` member.
207    #[serde(rename = "statusInfo")]
208    #[serde(default, skip_serializing_if = "Option::is_none")]
209    pub status_info: Option<StatusInfo>,
210    /// The `customData` member.
211    #[serde(rename = "customData")]
212    #[serde(default, skip_serializing_if = "Option::is_none")]
213    pub custom_data: Option<crate::types::CustomData>,
214}
215
216impl AdjustPeriodicEventStreamResponse {
217    /// Creates a `AdjustPeriodicEventStreamResponse` from its required fields.
218    #[must_use]
219    pub fn new(status: GenericStatus) -> Self {
220        Self {
221            status,
222            status_info: None,
223            custom_data: None,
224        }
225    }
226
227    /// Sets the optional `statusInfo` field.
228    #[must_use]
229    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
230        self.status_info = Some(value);
231        self
232    }
233
234    /// Sets the optional `customData` field.
235    #[must_use]
236    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
237        self.custom_data = Some(value);
238        self
239    }
240}
241
242impl Validate for AdjustPeriodicEventStreamResponse {
243    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
244        path.push_key("status");
245        Validate::validate_at(&self.status, path, out);
246        path.pop();
247        path.push_key("statusInfo");
248        if let Some(value) = &self.status_info {
249            Validate::validate_at(value, path, out);
250        }
251        path.pop();
252        path.push_key("customData");
253        if let Some(value) = &self.custom_data {
254            Validate::validate_at(value, path, out);
255        }
256        path.pop();
257    }
258}
259
260impl Sealed for AdjustPeriodicEventStreamResponse {}
261impl Response for AdjustPeriodicEventStreamResponse {}
262
263/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
264#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
265pub struct AuthorizeRequest {
266    /// The `idToken` member.
267    #[serde(rename = "idToken")]
268    pub id_token: IdToken,
269    /// *(2.1)* The X.509 certificate chain presented by EV and encoded in PEM format. Order of certificates in chain is from leaf up to (but excluding) root certificate. +
270    /// Only needed in case of central contract validation when Charging Station cannot validate the contract certificate.
271    #[serde(default, skip_serializing_if = "Option::is_none")]
272    pub certificate: Option<String>,
273    /// The `iso15118CertificateHashData` member.
274    #[serde(rename = "iso15118CertificateHashData")]
275    #[serde(default, skip_serializing_if = "Option::is_none")]
276    pub iso15118_certificate_hash_data: Option<Vec<OCSPRequestData>>,
277    /// The `customData` member.
278    #[serde(rename = "customData")]
279    #[serde(default, skip_serializing_if = "Option::is_none")]
280    pub custom_data: Option<crate::types::CustomData>,
281}
282
283impl AuthorizeRequest {
284    /// Creates a `AuthorizeRequest` from its required fields.
285    #[must_use]
286    pub fn new(id_token: IdToken) -> Self {
287        Self {
288            id_token,
289            certificate: None,
290            iso15118_certificate_hash_data: None,
291            custom_data: None,
292        }
293    }
294
295    /// Sets the optional `certificate` field.
296    #[must_use]
297    pub fn with_certificate(mut self, value: impl Into<String>) -> Self {
298        self.certificate = Some(value.into());
299        self
300    }
301
302    /// Sets the optional `iso15118CertificateHashData` field.
303    #[must_use]
304    pub fn with_iso15118_certificate_hash_data(mut self, value: Vec<OCSPRequestData>) -> Self {
305        self.iso15118_certificate_hash_data = Some(value);
306        self
307    }
308
309    /// Sets the optional `customData` field.
310    #[must_use]
311    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
312        self.custom_data = Some(value);
313        self
314    }
315}
316
317impl Validate for AuthorizeRequest {
318    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
319        path.push_key("idToken");
320        Validate::validate_at(&self.id_token, path, out);
321        path.pop();
322        path.push_key("certificate");
323        if let Some(value) = &self.certificate {
324            validate::string(value.as_str(), None, Some(10000), path, out);
325        }
326        path.pop();
327        path.push_key("iso15118CertificateHashData");
328        if let Some(value) = &self.iso15118_certificate_hash_data {
329            validate::list_len(value.len(), Some(1), Some(4), path, out);
330            for (index, item) in value.iter().enumerate() {
331                path.push_index(index);
332                Validate::validate_at(item, path, out);
333                path.pop();
334            }
335        }
336        path.pop();
337        path.push_key("customData");
338        if let Some(value) = &self.custom_data {
339            Validate::validate_at(value, path, out);
340        }
341        path.pop();
342    }
343}
344
345impl Sealed for AuthorizeRequest {}
346impl Request for AuthorizeRequest {
347    type Action = Action;
348    const ACTION: Action = Action::Authorize;
349    const KIND: MessageKind = MessageKind::Call;
350    const ORIGIN: Origin = Origin::ChargingStation;
351    type Response = AuthorizeResponse;
352}
353
354impl Confirmed for AuthorizeRequest {}
355
356/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
357#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
358pub struct AuthorizeResponse {
359    /// The `idTokenInfo` member.
360    #[serde(rename = "idTokenInfo")]
361    pub id_token_info: IdTokenInfo,
362    /// The `certificateStatus` member.
363    #[serde(rename = "certificateStatus")]
364    #[serde(default, skip_serializing_if = "Option::is_none")]
365    pub certificate_status: Option<AuthorizeCertificateStatus>,
366    /// *(2.1)* List of allowed energy transfer modes the EV can choose from. If omitted this defaults to charging only.
367    #[serde(rename = "allowedEnergyTransfer")]
368    #[serde(default, skip_serializing_if = "Option::is_none")]
369    pub allowed_energy_transfer: Option<Vec<EnergyTransferMode>>,
370    /// The `tariff` member.
371    #[serde(default, skip_serializing_if = "Option::is_none")]
372    pub tariff: Option<Tariff>,
373    /// The `customData` member.
374    #[serde(rename = "customData")]
375    #[serde(default, skip_serializing_if = "Option::is_none")]
376    pub custom_data: Option<crate::types::CustomData>,
377}
378
379impl AuthorizeResponse {
380    /// Creates a `AuthorizeResponse` from its required fields.
381    #[must_use]
382    pub fn new(id_token_info: IdTokenInfo) -> Self {
383        Self {
384            id_token_info,
385            certificate_status: None,
386            allowed_energy_transfer: None,
387            tariff: None,
388            custom_data: None,
389        }
390    }
391
392    /// Sets the optional `certificateStatus` field.
393    #[must_use]
394    pub fn with_certificate_status(mut self, value: AuthorizeCertificateStatus) -> Self {
395        self.certificate_status = Some(value);
396        self
397    }
398
399    /// Sets the optional `allowedEnergyTransfer` field.
400    #[must_use]
401    pub fn with_allowed_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
402        self.allowed_energy_transfer = Some(value);
403        self
404    }
405
406    /// Sets the optional `tariff` field.
407    #[must_use]
408    pub fn with_tariff(mut self, value: Tariff) -> Self {
409        self.tariff = Some(value);
410        self
411    }
412
413    /// Sets the optional `customData` field.
414    #[must_use]
415    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
416        self.custom_data = Some(value);
417        self
418    }
419}
420
421impl Validate for AuthorizeResponse {
422    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
423        path.push_key("idTokenInfo");
424        Validate::validate_at(&self.id_token_info, path, out);
425        path.pop();
426        path.push_key("certificateStatus");
427        if let Some(value) = &self.certificate_status {
428            Validate::validate_at(value, path, out);
429        }
430        path.pop();
431        path.push_key("allowedEnergyTransfer");
432        if let Some(value) = &self.allowed_energy_transfer {
433            validate::list_len(value.len(), Some(1), None, path, out);
434            for (index, item) in value.iter().enumerate() {
435                path.push_index(index);
436                Validate::validate_at(item, path, out);
437                path.pop();
438            }
439        }
440        path.pop();
441        path.push_key("tariff");
442        if let Some(value) = &self.tariff {
443            Validate::validate_at(value, path, out);
444        }
445        path.pop();
446        path.push_key("customData");
447        if let Some(value) = &self.custom_data {
448            Validate::validate_at(value, path, out);
449        }
450        path.pop();
451    }
452}
453
454impl Sealed for AuthorizeResponse {}
455impl Response for AuthorizeResponse {}
456
457/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
458#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
459pub struct BatterySwapRequest {
460    /// The `batteryData` member.
461    #[serde(rename = "batteryData")]
462    pub battery_data: Vec<BatteryData>,
463    /// The `eventType` member.
464    #[serde(rename = "eventType")]
465    pub event_type: BatterySwapEvent,
466    /// The `idToken` member.
467    #[serde(rename = "idToken")]
468    pub id_token: IdToken,
469    /// RequestId to correlate BatteryIn/Out events and optional RequestBatterySwapRequest.
470    #[serde(rename = "requestId")]
471    #[serde(deserialize_with = "crate::types::integer::one")]
472    pub request_id: i32,
473    /// The `customData` member.
474    #[serde(rename = "customData")]
475    #[serde(default, skip_serializing_if = "Option::is_none")]
476    pub custom_data: Option<crate::types::CustomData>,
477}
478
479impl BatterySwapRequest {
480    /// Creates a `BatterySwapRequest` from its required fields.
481    #[must_use]
482    pub fn new(
483        battery_data: Vec<BatteryData>,
484        event_type: BatterySwapEvent,
485        id_token: IdToken,
486        request_id: i32,
487    ) -> Self {
488        Self {
489            battery_data,
490            event_type,
491            id_token,
492            request_id,
493            custom_data: None,
494        }
495    }
496
497    /// Sets the optional `customData` field.
498    #[must_use]
499    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
500        self.custom_data = Some(value);
501        self
502    }
503}
504
505impl Validate for BatterySwapRequest {
506    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
507        path.push_key("batteryData");
508        validate::list_len(self.battery_data.len(), Some(1), None, path, out);
509        for (index, item) in self.battery_data.iter().enumerate() {
510            path.push_index(index);
511            Validate::validate_at(item, path, out);
512            path.pop();
513        }
514        path.pop();
515        path.push_key("eventType");
516        Validate::validate_at(&self.event_type, path, out);
517        path.pop();
518        path.push_key("idToken");
519        Validate::validate_at(&self.id_token, path, out);
520        path.pop();
521        path.push_key("customData");
522        if let Some(value) = &self.custom_data {
523            Validate::validate_at(value, path, out);
524        }
525        path.pop();
526    }
527}
528
529impl Sealed for BatterySwapRequest {}
530impl Request for BatterySwapRequest {
531    type Action = Action;
532    const ACTION: Action = Action::BatterySwap;
533    const KIND: MessageKind = MessageKind::Call;
534    const ORIGIN: Origin = Origin::ChargingStation;
535    type Response = BatterySwapResponse;
536}
537
538impl Confirmed for BatterySwapRequest {}
539
540/// This is an empty response that just acknowledges receipt of the request. (The request cannot be rejected).
541///
542/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
543#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
544pub struct BatterySwapResponse {
545    /// The `customData` member.
546    #[serde(rename = "customData")]
547    #[serde(default, skip_serializing_if = "Option::is_none")]
548    pub custom_data: Option<crate::types::CustomData>,
549}
550
551impl BatterySwapResponse {
552    /// Creates an empty `BatterySwapResponse`. Every field of this type is optional.
553    #[must_use]
554    pub fn new() -> Self {
555        Self::default()
556    }
557
558    /// Sets the optional `customData` field.
559    #[must_use]
560    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
561        self.custom_data = Some(value);
562        self
563    }
564}
565
566impl Validate for BatterySwapResponse {
567    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
568        path.push_key("customData");
569        if let Some(value) = &self.custom_data {
570            Validate::validate_at(value, path, out);
571        }
572        path.pop();
573    }
574}
575
576impl Sealed for BatterySwapResponse {}
577impl Response for BatterySwapResponse {}
578
579/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
580#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
581pub struct BootNotificationRequest {
582    /// The `chargingStation` member.
583    #[serde(rename = "chargingStation")]
584    pub charging_station: ChargingStation,
585    /// The `reason` member.
586    pub reason: BootReason,
587    /// The `customData` member.
588    #[serde(rename = "customData")]
589    #[serde(default, skip_serializing_if = "Option::is_none")]
590    pub custom_data: Option<crate::types::CustomData>,
591}
592
593impl BootNotificationRequest {
594    /// Creates a `BootNotificationRequest` from its required fields.
595    #[must_use]
596    pub fn new(charging_station: ChargingStation, reason: BootReason) -> Self {
597        Self {
598            charging_station,
599            reason,
600            custom_data: None,
601        }
602    }
603
604    /// Sets the optional `customData` field.
605    #[must_use]
606    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
607        self.custom_data = Some(value);
608        self
609    }
610}
611
612impl Validate for BootNotificationRequest {
613    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
614        path.push_key("chargingStation");
615        Validate::validate_at(&self.charging_station, path, out);
616        path.pop();
617        path.push_key("reason");
618        Validate::validate_at(&self.reason, path, out);
619        path.pop();
620        path.push_key("customData");
621        if let Some(value) = &self.custom_data {
622            Validate::validate_at(value, path, out);
623        }
624        path.pop();
625    }
626}
627
628impl Sealed for BootNotificationRequest {}
629impl Request for BootNotificationRequest {
630    type Action = Action;
631    const ACTION: Action = Action::BootNotification;
632    const KIND: MessageKind = MessageKind::Call;
633    const ORIGIN: Origin = Origin::ChargingStation;
634    type Response = BootNotificationResponse;
635}
636
637impl Confirmed for BootNotificationRequest {}
638
639/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
640#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
641pub struct BootNotificationResponse {
642    /// This contains the CSMS’s current time.
643    #[serde(rename = "currentTime")]
644    pub current_time: crate::types::DateTime,
645    /// When &lt;&lt;cmn_registrationstatusenumtype,Status&gt;&gt; is Accepted, this contains the heartbeat interval in seconds. If the CSMS returns something other than Accepted, the value of the interval field indicates the minimum wait time before sending a next BootNotification request.
646    #[serde(deserialize_with = "crate::types::integer::one")]
647    pub interval: i32,
648    /// The `status` member.
649    pub status: RegistrationStatus,
650    /// The `statusInfo` member.
651    #[serde(rename = "statusInfo")]
652    #[serde(default, skip_serializing_if = "Option::is_none")]
653    pub status_info: Option<StatusInfo>,
654    /// The `customData` member.
655    #[serde(rename = "customData")]
656    #[serde(default, skip_serializing_if = "Option::is_none")]
657    pub custom_data: Option<crate::types::CustomData>,
658}
659
660impl BootNotificationResponse {
661    /// Creates a `BootNotificationResponse` from its required fields.
662    #[must_use]
663    pub fn new(
664        current_time: impl Into<crate::types::DateTime>,
665        interval: i32,
666        status: RegistrationStatus,
667    ) -> Self {
668        Self {
669            current_time: current_time.into(),
670            interval,
671            status,
672            status_info: None,
673            custom_data: None,
674        }
675    }
676
677    /// Sets the optional `statusInfo` field.
678    #[must_use]
679    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
680        self.status_info = Some(value);
681        self
682    }
683
684    /// Sets the optional `customData` field.
685    #[must_use]
686    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
687        self.custom_data = Some(value);
688        self
689    }
690}
691
692impl Validate for BootNotificationResponse {
693    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
694        path.push_key("status");
695        Validate::validate_at(&self.status, path, out);
696        path.pop();
697        path.push_key("statusInfo");
698        if let Some(value) = &self.status_info {
699            Validate::validate_at(value, path, out);
700        }
701        path.pop();
702        path.push_key("customData");
703        if let Some(value) = &self.custom_data {
704            Validate::validate_at(value, path, out);
705        }
706        path.pop();
707    }
708}
709
710impl Sealed for BootNotificationResponse {}
711impl Response for BootNotificationResponse {}
712
713/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
714#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
715pub struct CancelReservationRequest {
716    /// Id of the reservation to cancel.
717    #[serde(rename = "reservationId")]
718    #[serde(deserialize_with = "crate::types::integer::one")]
719    pub reservation_id: i32,
720    /// The `customData` member.
721    #[serde(rename = "customData")]
722    #[serde(default, skip_serializing_if = "Option::is_none")]
723    pub custom_data: Option<crate::types::CustomData>,
724}
725
726impl CancelReservationRequest {
727    /// Creates a `CancelReservationRequest` from its required fields.
728    #[must_use]
729    pub fn new(reservation_id: i32) -> Self {
730        Self {
731            reservation_id,
732            custom_data: None,
733        }
734    }
735
736    /// Sets the optional `customData` field.
737    #[must_use]
738    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
739        self.custom_data = Some(value);
740        self
741    }
742}
743
744impl Validate for CancelReservationRequest {
745    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
746        path.push_key("reservationId");
747        validate::int_range(i64::from(self.reservation_id), Some(0), None, path, out);
748        path.pop();
749        path.push_key("customData");
750        if let Some(value) = &self.custom_data {
751            Validate::validate_at(value, path, out);
752        }
753        path.pop();
754    }
755}
756
757impl Sealed for CancelReservationRequest {}
758impl Request for CancelReservationRequest {
759    type Action = Action;
760    const ACTION: Action = Action::CancelReservation;
761    const KIND: MessageKind = MessageKind::Call;
762    const ORIGIN: Origin = Origin::Csms;
763    type Response = CancelReservationResponse;
764}
765
766impl Confirmed for CancelReservationRequest {}
767
768/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
769#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
770pub struct CancelReservationResponse {
771    /// The `status` member.
772    pub status: CancelReservationStatus,
773    /// The `statusInfo` member.
774    #[serde(rename = "statusInfo")]
775    #[serde(default, skip_serializing_if = "Option::is_none")]
776    pub status_info: Option<StatusInfo>,
777    /// The `customData` member.
778    #[serde(rename = "customData")]
779    #[serde(default, skip_serializing_if = "Option::is_none")]
780    pub custom_data: Option<crate::types::CustomData>,
781}
782
783impl CancelReservationResponse {
784    /// Creates a `CancelReservationResponse` from its required fields.
785    #[must_use]
786    pub fn new(status: CancelReservationStatus) -> Self {
787        Self {
788            status,
789            status_info: None,
790            custom_data: None,
791        }
792    }
793
794    /// Sets the optional `statusInfo` field.
795    #[must_use]
796    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
797        self.status_info = Some(value);
798        self
799    }
800
801    /// Sets the optional `customData` field.
802    #[must_use]
803    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
804        self.custom_data = Some(value);
805        self
806    }
807}
808
809impl Validate for CancelReservationResponse {
810    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
811        path.push_key("status");
812        Validate::validate_at(&self.status, path, out);
813        path.pop();
814        path.push_key("statusInfo");
815        if let Some(value) = &self.status_info {
816            Validate::validate_at(value, path, out);
817        }
818        path.pop();
819        path.push_key("customData");
820        if let Some(value) = &self.custom_data {
821            Validate::validate_at(value, path, out);
822        }
823        path.pop();
824    }
825}
826
827impl Sealed for CancelReservationResponse {}
828impl Response for CancelReservationResponse {}
829
830/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
831#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
832pub struct CertificateSignedRequest {
833    /// The signed PEM encoded X.509 certificate. This SHALL also contain the necessary sub CA certificates, when applicable. The order of the bundle follows the certificate chain, starting from the leaf certificate.
834    ///
835    /// The Configuration Variable &lt;&lt;configkey-max-certificate-chain-size,MaxCertificateChainSize&gt;&gt; can be used to limit the maximum size of this field.
836    #[serde(rename = "certificateChain")]
837    pub certificate_chain: String,
838    /// The `certificateType` member.
839    #[serde(rename = "certificateType")]
840    #[serde(default, skip_serializing_if = "Option::is_none")]
841    pub certificate_type: Option<CertificateSigningUse>,
842    /// *(2.1)* RequestId to correlate this message with the SignCertificateRequest.
843    #[serde(rename = "requestId")]
844    #[serde(default, skip_serializing_if = "Option::is_none")]
845    #[serde(deserialize_with = "crate::types::integer::option")]
846    pub request_id: Option<i32>,
847    /// The `customData` member.
848    #[serde(rename = "customData")]
849    #[serde(default, skip_serializing_if = "Option::is_none")]
850    pub custom_data: Option<crate::types::CustomData>,
851}
852
853impl CertificateSignedRequest {
854    /// Creates a `CertificateSignedRequest` from its required fields.
855    #[must_use]
856    pub fn new(certificate_chain: impl Into<String>) -> Self {
857        Self {
858            certificate_chain: certificate_chain.into(),
859            certificate_type: None,
860            request_id: None,
861            custom_data: None,
862        }
863    }
864
865    /// Sets the optional `certificateType` field.
866    #[must_use]
867    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
868        self.certificate_type = Some(value);
869        self
870    }
871
872    /// Sets the optional `requestId` field.
873    #[must_use]
874    pub fn with_request_id(mut self, value: i32) -> Self {
875        self.request_id = Some(value);
876        self
877    }
878
879    /// Sets the optional `customData` field.
880    #[must_use]
881    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
882        self.custom_data = Some(value);
883        self
884    }
885}
886
887impl Validate for CertificateSignedRequest {
888    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
889        path.push_key("certificateChain");
890        validate::string(
891            self.certificate_chain.as_str(),
892            None,
893            Some(10000),
894            path,
895            out,
896        );
897        path.pop();
898        path.push_key("certificateType");
899        if let Some(value) = &self.certificate_type {
900            Validate::validate_at(value, path, out);
901        }
902        path.pop();
903        path.push_key("customData");
904        if let Some(value) = &self.custom_data {
905            Validate::validate_at(value, path, out);
906        }
907        path.pop();
908    }
909}
910
911impl Sealed for CertificateSignedRequest {}
912impl Request for CertificateSignedRequest {
913    type Action = Action;
914    const ACTION: Action = Action::CertificateSigned;
915    const KIND: MessageKind = MessageKind::Call;
916    const ORIGIN: Origin = Origin::Csms;
917    type Response = CertificateSignedResponse;
918}
919
920impl Confirmed for CertificateSignedRequest {}
921
922/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
923#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
924pub struct CertificateSignedResponse {
925    /// The `status` member.
926    pub status: CertificateSignedStatus,
927    /// The `statusInfo` member.
928    #[serde(rename = "statusInfo")]
929    #[serde(default, skip_serializing_if = "Option::is_none")]
930    pub status_info: Option<StatusInfo>,
931    /// The `customData` member.
932    #[serde(rename = "customData")]
933    #[serde(default, skip_serializing_if = "Option::is_none")]
934    pub custom_data: Option<crate::types::CustomData>,
935}
936
937impl CertificateSignedResponse {
938    /// Creates a `CertificateSignedResponse` from its required fields.
939    #[must_use]
940    pub fn new(status: CertificateSignedStatus) -> Self {
941        Self {
942            status,
943            status_info: None,
944            custom_data: None,
945        }
946    }
947
948    /// Sets the optional `statusInfo` field.
949    #[must_use]
950    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
951        self.status_info = Some(value);
952        self
953    }
954
955    /// Sets the optional `customData` field.
956    #[must_use]
957    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
958        self.custom_data = Some(value);
959        self
960    }
961}
962
963impl Validate for CertificateSignedResponse {
964    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
965        path.push_key("status");
966        Validate::validate_at(&self.status, path, out);
967        path.pop();
968        path.push_key("statusInfo");
969        if let Some(value) = &self.status_info {
970            Validate::validate_at(value, path, out);
971        }
972        path.pop();
973        path.push_key("customData");
974        if let Some(value) = &self.custom_data {
975            Validate::validate_at(value, path, out);
976        }
977        path.pop();
978    }
979}
980
981impl Sealed for CertificateSignedResponse {}
982impl Response for CertificateSignedResponse {}
983
984/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
985#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
986pub struct ChangeAvailabilityRequest {
987    /// The `operationalStatus` member.
988    #[serde(rename = "operationalStatus")]
989    pub operational_status: OperationalStatus,
990    /// The `evse` member.
991    #[serde(default, skip_serializing_if = "Option::is_none")]
992    pub evse: Option<EVSE>,
993    /// The `customData` member.
994    #[serde(rename = "customData")]
995    #[serde(default, skip_serializing_if = "Option::is_none")]
996    pub custom_data: Option<crate::types::CustomData>,
997}
998
999impl ChangeAvailabilityRequest {
1000    /// Creates a `ChangeAvailabilityRequest` from its required fields.
1001    #[must_use]
1002    pub fn new(operational_status: OperationalStatus) -> Self {
1003        Self {
1004            operational_status,
1005            evse: None,
1006            custom_data: None,
1007        }
1008    }
1009
1010    /// Sets the optional `evse` field.
1011    #[must_use]
1012    pub fn with_evse(mut self, value: EVSE) -> Self {
1013        self.evse = Some(value);
1014        self
1015    }
1016
1017    /// Sets the optional `customData` field.
1018    #[must_use]
1019    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1020        self.custom_data = Some(value);
1021        self
1022    }
1023}
1024
1025impl Validate for ChangeAvailabilityRequest {
1026    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1027        path.push_key("operationalStatus");
1028        Validate::validate_at(&self.operational_status, path, out);
1029        path.pop();
1030        path.push_key("evse");
1031        if let Some(value) = &self.evse {
1032            Validate::validate_at(value, path, out);
1033        }
1034        path.pop();
1035        path.push_key("customData");
1036        if let Some(value) = &self.custom_data {
1037            Validate::validate_at(value, path, out);
1038        }
1039        path.pop();
1040    }
1041}
1042
1043impl Sealed for ChangeAvailabilityRequest {}
1044impl Request for ChangeAvailabilityRequest {
1045    type Action = Action;
1046    const ACTION: Action = Action::ChangeAvailability;
1047    const KIND: MessageKind = MessageKind::Call;
1048    const ORIGIN: Origin = Origin::Csms;
1049    type Response = ChangeAvailabilityResponse;
1050}
1051
1052impl Confirmed for ChangeAvailabilityRequest {}
1053
1054/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
1055#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1056pub struct ChangeAvailabilityResponse {
1057    /// The `status` member.
1058    pub status: ChangeAvailabilityStatus,
1059    /// The `statusInfo` member.
1060    #[serde(rename = "statusInfo")]
1061    #[serde(default, skip_serializing_if = "Option::is_none")]
1062    pub status_info: Option<StatusInfo>,
1063    /// The `customData` member.
1064    #[serde(rename = "customData")]
1065    #[serde(default, skip_serializing_if = "Option::is_none")]
1066    pub custom_data: Option<crate::types::CustomData>,
1067}
1068
1069impl ChangeAvailabilityResponse {
1070    /// Creates a `ChangeAvailabilityResponse` from its required fields.
1071    #[must_use]
1072    pub fn new(status: ChangeAvailabilityStatus) -> Self {
1073        Self {
1074            status,
1075            status_info: None,
1076            custom_data: None,
1077        }
1078    }
1079
1080    /// Sets the optional `statusInfo` field.
1081    #[must_use]
1082    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1083        self.status_info = Some(value);
1084        self
1085    }
1086
1087    /// Sets the optional `customData` field.
1088    #[must_use]
1089    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1090        self.custom_data = Some(value);
1091        self
1092    }
1093}
1094
1095impl Validate for ChangeAvailabilityResponse {
1096    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1097        path.push_key("status");
1098        Validate::validate_at(&self.status, path, out);
1099        path.pop();
1100        path.push_key("statusInfo");
1101        if let Some(value) = &self.status_info {
1102            Validate::validate_at(value, path, out);
1103        }
1104        path.pop();
1105        path.push_key("customData");
1106        if let Some(value) = &self.custom_data {
1107            Validate::validate_at(value, path, out);
1108        }
1109        path.pop();
1110    }
1111}
1112
1113impl Sealed for ChangeAvailabilityResponse {}
1114impl Response for ChangeAvailabilityResponse {}
1115
1116/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1117#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1118pub struct ChangeTransactionTariffRequest {
1119    /// The `tariff` member.
1120    pub tariff: Tariff,
1121    /// Transaction id for new tariff.
1122    #[serde(rename = "transactionId")]
1123    pub transaction_id: String,
1124    /// The `customData` member.
1125    #[serde(rename = "customData")]
1126    #[serde(default, skip_serializing_if = "Option::is_none")]
1127    pub custom_data: Option<crate::types::CustomData>,
1128}
1129
1130impl ChangeTransactionTariffRequest {
1131    /// Creates a `ChangeTransactionTariffRequest` from its required fields.
1132    #[must_use]
1133    pub fn new(tariff: Tariff, transaction_id: impl Into<String>) -> Self {
1134        Self {
1135            tariff,
1136            transaction_id: transaction_id.into(),
1137            custom_data: None,
1138        }
1139    }
1140
1141    /// Sets the optional `customData` field.
1142    #[must_use]
1143    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1144        self.custom_data = Some(value);
1145        self
1146    }
1147}
1148
1149impl Validate for ChangeTransactionTariffRequest {
1150    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1151        path.push_key("tariff");
1152        Validate::validate_at(&self.tariff, path, out);
1153        path.pop();
1154        path.push_key("transactionId");
1155        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
1156        path.pop();
1157        path.push_key("customData");
1158        if let Some(value) = &self.custom_data {
1159            Validate::validate_at(value, path, out);
1160        }
1161        path.pop();
1162    }
1163}
1164
1165impl Sealed for ChangeTransactionTariffRequest {}
1166impl Request for ChangeTransactionTariffRequest {
1167    type Action = Action;
1168    const ACTION: Action = Action::ChangeTransactionTariff;
1169    const KIND: MessageKind = MessageKind::Call;
1170    const ORIGIN: Origin = Origin::Csms;
1171    type Response = ChangeTransactionTariffResponse;
1172}
1173
1174impl Confirmed for ChangeTransactionTariffRequest {}
1175
1176/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1177#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1178pub struct ChangeTransactionTariffResponse {
1179    /// The `status` member.
1180    pub status: TariffChangeStatus,
1181    /// The `statusInfo` member.
1182    #[serde(rename = "statusInfo")]
1183    #[serde(default, skip_serializing_if = "Option::is_none")]
1184    pub status_info: Option<StatusInfo>,
1185    /// The `customData` member.
1186    #[serde(rename = "customData")]
1187    #[serde(default, skip_serializing_if = "Option::is_none")]
1188    pub custom_data: Option<crate::types::CustomData>,
1189}
1190
1191impl ChangeTransactionTariffResponse {
1192    /// Creates a `ChangeTransactionTariffResponse` from its required fields.
1193    #[must_use]
1194    pub fn new(status: TariffChangeStatus) -> Self {
1195        Self {
1196            status,
1197            status_info: None,
1198            custom_data: None,
1199        }
1200    }
1201
1202    /// Sets the optional `statusInfo` field.
1203    #[must_use]
1204    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1205        self.status_info = Some(value);
1206        self
1207    }
1208
1209    /// Sets the optional `customData` field.
1210    #[must_use]
1211    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1212        self.custom_data = Some(value);
1213        self
1214    }
1215}
1216
1217impl Validate for ChangeTransactionTariffResponse {
1218    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1219        path.push_key("status");
1220        Validate::validate_at(&self.status, path, out);
1221        path.pop();
1222        path.push_key("statusInfo");
1223        if let Some(value) = &self.status_info {
1224            Validate::validate_at(value, path, out);
1225        }
1226        path.pop();
1227        path.push_key("customData");
1228        if let Some(value) = &self.custom_data {
1229            Validate::validate_at(value, path, out);
1230        }
1231        path.pop();
1232    }
1233}
1234
1235impl Sealed for ChangeTransactionTariffResponse {}
1236impl Response for ChangeTransactionTariffResponse {}
1237
1238/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
1239#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1240pub struct ClearCacheRequest {
1241    /// The `customData` member.
1242    #[serde(rename = "customData")]
1243    #[serde(default, skip_serializing_if = "Option::is_none")]
1244    pub custom_data: Option<crate::types::CustomData>,
1245}
1246
1247impl ClearCacheRequest {
1248    /// Creates an empty `ClearCacheRequest`. Every field of this type is optional.
1249    #[must_use]
1250    pub fn new() -> Self {
1251        Self::default()
1252    }
1253
1254    /// Sets the optional `customData` field.
1255    #[must_use]
1256    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1257        self.custom_data = Some(value);
1258        self
1259    }
1260}
1261
1262impl Validate for ClearCacheRequest {
1263    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1264        path.push_key("customData");
1265        if let Some(value) = &self.custom_data {
1266            Validate::validate_at(value, path, out);
1267        }
1268        path.pop();
1269    }
1270}
1271
1272impl Sealed for ClearCacheRequest {}
1273impl Request for ClearCacheRequest {
1274    type Action = Action;
1275    const ACTION: Action = Action::ClearCache;
1276    const KIND: MessageKind = MessageKind::Call;
1277    const ORIGIN: Origin = Origin::Csms;
1278    type Response = ClearCacheResponse;
1279}
1280
1281impl Confirmed for ClearCacheRequest {}
1282
1283/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
1284#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1285pub struct ClearCacheResponse {
1286    /// The `status` member.
1287    pub status: ClearCacheStatus,
1288    /// The `statusInfo` member.
1289    #[serde(rename = "statusInfo")]
1290    #[serde(default, skip_serializing_if = "Option::is_none")]
1291    pub status_info: Option<StatusInfo>,
1292    /// The `customData` member.
1293    #[serde(rename = "customData")]
1294    #[serde(default, skip_serializing_if = "Option::is_none")]
1295    pub custom_data: Option<crate::types::CustomData>,
1296}
1297
1298impl ClearCacheResponse {
1299    /// Creates a `ClearCacheResponse` from its required fields.
1300    #[must_use]
1301    pub fn new(status: ClearCacheStatus) -> Self {
1302        Self {
1303            status,
1304            status_info: None,
1305            custom_data: None,
1306        }
1307    }
1308
1309    /// Sets the optional `statusInfo` field.
1310    #[must_use]
1311    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1312        self.status_info = Some(value);
1313        self
1314    }
1315
1316    /// Sets the optional `customData` field.
1317    #[must_use]
1318    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1319        self.custom_data = Some(value);
1320        self
1321    }
1322}
1323
1324impl Validate for ClearCacheResponse {
1325    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1326        path.push_key("status");
1327        Validate::validate_at(&self.status, path, out);
1328        path.pop();
1329        path.push_key("statusInfo");
1330        if let Some(value) = &self.status_info {
1331            Validate::validate_at(value, path, out);
1332        }
1333        path.pop();
1334        path.push_key("customData");
1335        if let Some(value) = &self.custom_data {
1336            Validate::validate_at(value, path, out);
1337        }
1338        path.pop();
1339    }
1340}
1341
1342impl Sealed for ClearCacheResponse {}
1343impl Response for ClearCacheResponse {}
1344
1345/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
1346#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1347pub struct ClearChargingProfileRequest {
1348    /// The Id of the charging profile to clear.
1349    #[serde(rename = "chargingProfileId")]
1350    #[serde(default, skip_serializing_if = "Option::is_none")]
1351    #[serde(deserialize_with = "crate::types::integer::option")]
1352    pub charging_profile_id: Option<i32>,
1353    /// The `chargingProfileCriteria` member.
1354    #[serde(rename = "chargingProfileCriteria")]
1355    #[serde(default, skip_serializing_if = "Option::is_none")]
1356    pub charging_profile_criteria: Option<ClearChargingProfile>,
1357    /// The `customData` member.
1358    #[serde(rename = "customData")]
1359    #[serde(default, skip_serializing_if = "Option::is_none")]
1360    pub custom_data: Option<crate::types::CustomData>,
1361}
1362
1363impl ClearChargingProfileRequest {
1364    /// Creates an empty `ClearChargingProfileRequest`. Every field of this type is optional.
1365    #[must_use]
1366    pub fn new() -> Self {
1367        Self::default()
1368    }
1369
1370    /// Sets the optional `chargingProfileId` field.
1371    #[must_use]
1372    pub fn with_charging_profile_id(mut self, value: i32) -> Self {
1373        self.charging_profile_id = Some(value);
1374        self
1375    }
1376
1377    /// Sets the optional `chargingProfileCriteria` field.
1378    #[must_use]
1379    pub fn with_charging_profile_criteria(mut self, value: ClearChargingProfile) -> Self {
1380        self.charging_profile_criteria = Some(value);
1381        self
1382    }
1383
1384    /// Sets the optional `customData` field.
1385    #[must_use]
1386    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1387        self.custom_data = Some(value);
1388        self
1389    }
1390}
1391
1392impl Validate for ClearChargingProfileRequest {
1393    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1394        path.push_key("chargingProfileCriteria");
1395        if let Some(value) = &self.charging_profile_criteria {
1396            Validate::validate_at(value, path, out);
1397        }
1398        path.pop();
1399        path.push_key("customData");
1400        if let Some(value) = &self.custom_data {
1401            Validate::validate_at(value, path, out);
1402        }
1403        path.pop();
1404    }
1405}
1406
1407impl Sealed for ClearChargingProfileRequest {}
1408impl Request for ClearChargingProfileRequest {
1409    type Action = Action;
1410    const ACTION: Action = Action::ClearChargingProfile;
1411    const KIND: MessageKind = MessageKind::Call;
1412    const ORIGIN: Origin = Origin::Csms;
1413    type Response = ClearChargingProfileResponse;
1414}
1415
1416impl Confirmed for ClearChargingProfileRequest {}
1417
1418/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
1419#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1420pub struct ClearChargingProfileResponse {
1421    /// The `status` member.
1422    pub status: ClearChargingProfileStatus,
1423    /// The `statusInfo` member.
1424    #[serde(rename = "statusInfo")]
1425    #[serde(default, skip_serializing_if = "Option::is_none")]
1426    pub status_info: Option<StatusInfo>,
1427    /// The `customData` member.
1428    #[serde(rename = "customData")]
1429    #[serde(default, skip_serializing_if = "Option::is_none")]
1430    pub custom_data: Option<crate::types::CustomData>,
1431}
1432
1433impl ClearChargingProfileResponse {
1434    /// Creates a `ClearChargingProfileResponse` from its required fields.
1435    #[must_use]
1436    pub fn new(status: ClearChargingProfileStatus) -> Self {
1437        Self {
1438            status,
1439            status_info: None,
1440            custom_data: None,
1441        }
1442    }
1443
1444    /// Sets the optional `statusInfo` field.
1445    #[must_use]
1446    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1447        self.status_info = Some(value);
1448        self
1449    }
1450
1451    /// Sets the optional `customData` field.
1452    #[must_use]
1453    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1454        self.custom_data = Some(value);
1455        self
1456    }
1457}
1458
1459impl Validate for ClearChargingProfileResponse {
1460    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1461        path.push_key("status");
1462        Validate::validate_at(&self.status, path, out);
1463        path.pop();
1464        path.push_key("statusInfo");
1465        if let Some(value) = &self.status_info {
1466            Validate::validate_at(value, path, out);
1467        }
1468        path.pop();
1469        path.push_key("customData");
1470        if let Some(value) = &self.custom_data {
1471            Validate::validate_at(value, path, out);
1472        }
1473        path.pop();
1474    }
1475}
1476
1477impl Sealed for ClearChargingProfileResponse {}
1478impl Response for ClearChargingProfileResponse {}
1479
1480/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
1481#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1482pub struct ClearDERControlRequest {
1483    /// True: clearing default DER controls. False: clearing scheduled controls.
1484    #[serde(rename = "isDefault")]
1485    pub is_default: bool,
1486    /// The `controlType` member.
1487    #[serde(rename = "controlType")]
1488    #[serde(default, skip_serializing_if = "Option::is_none")]
1489    pub control_type: Option<DERControl>,
1490    /// Id of control setting to clear. When omitted all settings for _controlType_ are cleared.
1491    #[serde(rename = "controlId")]
1492    #[serde(default, skip_serializing_if = "Option::is_none")]
1493    pub control_id: Option<String>,
1494    /// The `customData` member.
1495    #[serde(rename = "customData")]
1496    #[serde(default, skip_serializing_if = "Option::is_none")]
1497    pub custom_data: Option<crate::types::CustomData>,
1498}
1499
1500impl ClearDERControlRequest {
1501    /// Creates a `ClearDERControlRequest` from its required fields.
1502    #[must_use]
1503    pub fn new(is_default: bool) -> Self {
1504        Self {
1505            is_default,
1506            control_type: None,
1507            control_id: None,
1508            custom_data: None,
1509        }
1510    }
1511
1512    /// Sets the optional `controlType` field.
1513    #[must_use]
1514    pub fn with_control_type(mut self, value: DERControl) -> Self {
1515        self.control_type = Some(value);
1516        self
1517    }
1518
1519    /// Sets the optional `controlId` field.
1520    #[must_use]
1521    pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
1522        self.control_id = Some(value.into());
1523        self
1524    }
1525
1526    /// Sets the optional `customData` field.
1527    #[must_use]
1528    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1529        self.custom_data = Some(value);
1530        self
1531    }
1532}
1533
1534impl Validate for ClearDERControlRequest {
1535    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1536        path.push_key("controlType");
1537        if let Some(value) = &self.control_type {
1538            Validate::validate_at(value, path, out);
1539        }
1540        path.pop();
1541        path.push_key("controlId");
1542        if let Some(value) = &self.control_id {
1543            validate::string(value.as_str(), None, Some(36), path, out);
1544        }
1545        path.pop();
1546        path.push_key("customData");
1547        if let Some(value) = &self.custom_data {
1548            Validate::validate_at(value, path, out);
1549        }
1550        path.pop();
1551    }
1552}
1553
1554impl Sealed for ClearDERControlRequest {}
1555impl Request for ClearDERControlRequest {
1556    type Action = Action;
1557    const ACTION: Action = Action::ClearDERControl;
1558    const KIND: MessageKind = MessageKind::Call;
1559    const ORIGIN: Origin = Origin::Csms;
1560    type Response = ClearDERControlResponse;
1561}
1562
1563impl Confirmed for ClearDERControlRequest {}
1564
1565/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
1566#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1567pub struct ClearDERControlResponse {
1568    /// The `status` member.
1569    pub status: DERControlStatus,
1570    /// The `statusInfo` member.
1571    #[serde(rename = "statusInfo")]
1572    #[serde(default, skip_serializing_if = "Option::is_none")]
1573    pub status_info: Option<StatusInfo>,
1574    /// The `customData` member.
1575    #[serde(rename = "customData")]
1576    #[serde(default, skip_serializing_if = "Option::is_none")]
1577    pub custom_data: Option<crate::types::CustomData>,
1578}
1579
1580impl ClearDERControlResponse {
1581    /// Creates a `ClearDERControlResponse` from its required fields.
1582    #[must_use]
1583    pub fn new(status: DERControlStatus) -> Self {
1584        Self {
1585            status,
1586            status_info: None,
1587            custom_data: None,
1588        }
1589    }
1590
1591    /// Sets the optional `statusInfo` field.
1592    #[must_use]
1593    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1594        self.status_info = Some(value);
1595        self
1596    }
1597
1598    /// Sets the optional `customData` field.
1599    #[must_use]
1600    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1601        self.custom_data = Some(value);
1602        self
1603    }
1604}
1605
1606impl Validate for ClearDERControlResponse {
1607    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1608        path.push_key("status");
1609        Validate::validate_at(&self.status, path, out);
1610        path.pop();
1611        path.push_key("statusInfo");
1612        if let Some(value) = &self.status_info {
1613            Validate::validate_at(value, path, out);
1614        }
1615        path.pop();
1616        path.push_key("customData");
1617        if let Some(value) = &self.custom_data {
1618            Validate::validate_at(value, path, out);
1619        }
1620        path.pop();
1621    }
1622}
1623
1624impl Sealed for ClearDERControlResponse {}
1625impl Response for ClearDERControlResponse {}
1626
1627/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
1628#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1629pub struct ClearDisplayMessageRequest {
1630    /// Id of the message that SHALL be removed from the Charging Station.
1631    #[serde(deserialize_with = "crate::types::integer::one")]
1632    pub id: i32,
1633    /// The `customData` member.
1634    #[serde(rename = "customData")]
1635    #[serde(default, skip_serializing_if = "Option::is_none")]
1636    pub custom_data: Option<crate::types::CustomData>,
1637}
1638
1639impl ClearDisplayMessageRequest {
1640    /// Creates a `ClearDisplayMessageRequest` from its required fields.
1641    #[must_use]
1642    pub fn new(id: i32) -> Self {
1643        Self {
1644            id,
1645            custom_data: None,
1646        }
1647    }
1648
1649    /// Sets the optional `customData` field.
1650    #[must_use]
1651    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1652        self.custom_data = Some(value);
1653        self
1654    }
1655}
1656
1657impl Validate for ClearDisplayMessageRequest {
1658    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1659        path.push_key("id");
1660        validate::int_range(i64::from(self.id), Some(0), None, path, out);
1661        path.pop();
1662        path.push_key("customData");
1663        if let Some(value) = &self.custom_data {
1664            Validate::validate_at(value, path, out);
1665        }
1666        path.pop();
1667    }
1668}
1669
1670impl Sealed for ClearDisplayMessageRequest {}
1671impl Request for ClearDisplayMessageRequest {
1672    type Action = Action;
1673    const ACTION: Action = Action::ClearDisplayMessage;
1674    const KIND: MessageKind = MessageKind::Call;
1675    const ORIGIN: Origin = Origin::Csms;
1676    type Response = ClearDisplayMessageResponse;
1677}
1678
1679impl Confirmed for ClearDisplayMessageRequest {}
1680
1681/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
1682#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1683pub struct ClearDisplayMessageResponse {
1684    /// The `status` member.
1685    pub status: ClearMessageStatus,
1686    /// The `statusInfo` member.
1687    #[serde(rename = "statusInfo")]
1688    #[serde(default, skip_serializing_if = "Option::is_none")]
1689    pub status_info: Option<StatusInfo>,
1690    /// The `customData` member.
1691    #[serde(rename = "customData")]
1692    #[serde(default, skip_serializing_if = "Option::is_none")]
1693    pub custom_data: Option<crate::types::CustomData>,
1694}
1695
1696impl ClearDisplayMessageResponse {
1697    /// Creates a `ClearDisplayMessageResponse` from its required fields.
1698    #[must_use]
1699    pub fn new(status: ClearMessageStatus) -> Self {
1700        Self {
1701            status,
1702            status_info: None,
1703            custom_data: None,
1704        }
1705    }
1706
1707    /// Sets the optional `statusInfo` field.
1708    #[must_use]
1709    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1710        self.status_info = Some(value);
1711        self
1712    }
1713
1714    /// Sets the optional `customData` field.
1715    #[must_use]
1716    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1717        self.custom_data = Some(value);
1718        self
1719    }
1720}
1721
1722impl Validate for ClearDisplayMessageResponse {
1723    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1724        path.push_key("status");
1725        Validate::validate_at(&self.status, path, out);
1726        path.pop();
1727        path.push_key("statusInfo");
1728        if let Some(value) = &self.status_info {
1729            Validate::validate_at(value, path, out);
1730        }
1731        path.pop();
1732        path.push_key("customData");
1733        if let Some(value) = &self.custom_data {
1734            Validate::validate_at(value, path, out);
1735        }
1736        path.pop();
1737    }
1738}
1739
1740impl Sealed for ClearDisplayMessageResponse {}
1741impl Response for ClearDisplayMessageResponse {}
1742
1743/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1744#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1745pub struct ClearTariffsRequest {
1746    /// List of tariff Ids to clear. When absent clears all tariffs at _evseId_.
1747    #[serde(rename = "tariffIds")]
1748    #[serde(default, skip_serializing_if = "Option::is_none")]
1749    pub tariff_ids: Option<Vec<String>>,
1750    /// When present only clear tariffs matching _tariffIds_ at EVSE _evseId_.
1751    #[serde(rename = "evseId")]
1752    #[serde(default, skip_serializing_if = "Option::is_none")]
1753    #[serde(deserialize_with = "crate::types::integer::option")]
1754    pub evse_id: Option<i32>,
1755    /// The `customData` member.
1756    #[serde(rename = "customData")]
1757    #[serde(default, skip_serializing_if = "Option::is_none")]
1758    pub custom_data: Option<crate::types::CustomData>,
1759}
1760
1761impl ClearTariffsRequest {
1762    /// Creates an empty `ClearTariffsRequest`. Every field of this type is optional.
1763    #[must_use]
1764    pub fn new() -> Self {
1765        Self::default()
1766    }
1767
1768    /// Sets the optional `tariffIds` field.
1769    #[must_use]
1770    pub fn with_tariff_ids(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1771        self.tariff_ids = Some(value.into_iter().map(Into::into).collect());
1772        self
1773    }
1774
1775    /// Sets the optional `evseId` field.
1776    #[must_use]
1777    pub fn with_evse_id(mut self, value: i32) -> Self {
1778        self.evse_id = Some(value);
1779        self
1780    }
1781
1782    /// Sets the optional `customData` field.
1783    #[must_use]
1784    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1785        self.custom_data = Some(value);
1786        self
1787    }
1788}
1789
1790impl Validate for ClearTariffsRequest {
1791    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1792        path.push_key("tariffIds");
1793        if let Some(value) = &self.tariff_ids {
1794            validate::list_len(value.len(), Some(1), None, path, out);
1795            for (index, item) in value.iter().enumerate() {
1796                path.push_index(index);
1797                validate::string(item.as_str(), None, Some(60), path, out);
1798                path.pop();
1799            }
1800        }
1801        path.pop();
1802        path.push_key("evseId");
1803        if let Some(value) = &self.evse_id {
1804            validate::int_range(i64::from(*value), Some(0), None, path, out);
1805        }
1806        path.pop();
1807        path.push_key("customData");
1808        if let Some(value) = &self.custom_data {
1809            Validate::validate_at(value, path, out);
1810        }
1811        path.pop();
1812    }
1813}
1814
1815impl Sealed for ClearTariffsRequest {}
1816impl Request for ClearTariffsRequest {
1817    type Action = Action;
1818    const ACTION: Action = Action::ClearTariffs;
1819    const KIND: MessageKind = MessageKind::Call;
1820    const ORIGIN: Origin = Origin::Csms;
1821    type Response = ClearTariffsResponse;
1822}
1823
1824impl Confirmed for ClearTariffsRequest {}
1825
1826/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1827#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1828pub struct ClearTariffsResponse {
1829    /// The `clearTariffsResult` member.
1830    #[serde(rename = "clearTariffsResult")]
1831    pub clear_tariffs_result: Vec<ClearTariffsResult>,
1832    /// The `customData` member.
1833    #[serde(rename = "customData")]
1834    #[serde(default, skip_serializing_if = "Option::is_none")]
1835    pub custom_data: Option<crate::types::CustomData>,
1836}
1837
1838impl ClearTariffsResponse {
1839    /// Creates a `ClearTariffsResponse` from its required fields.
1840    #[must_use]
1841    pub fn new(clear_tariffs_result: Vec<ClearTariffsResult>) -> Self {
1842        Self {
1843            clear_tariffs_result,
1844            custom_data: None,
1845        }
1846    }
1847
1848    /// Sets the optional `customData` field.
1849    #[must_use]
1850    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1851        self.custom_data = Some(value);
1852        self
1853    }
1854}
1855
1856impl Validate for ClearTariffsResponse {
1857    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1858        path.push_key("clearTariffsResult");
1859        validate::list_len(self.clear_tariffs_result.len(), Some(1), None, path, out);
1860        for (index, item) in self.clear_tariffs_result.iter().enumerate() {
1861            path.push_index(index);
1862            Validate::validate_at(item, path, out);
1863            path.pop();
1864        }
1865        path.pop();
1866        path.push_key("customData");
1867        if let Some(value) = &self.custom_data {
1868            Validate::validate_at(value, path, out);
1869        }
1870        path.pop();
1871    }
1872}
1873
1874impl Sealed for ClearTariffsResponse {}
1875impl Response for ClearTariffsResponse {}
1876
1877/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1878#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1879pub struct ClearVariableMonitoringRequest {
1880    /// List of the monitors to be cleared, identified by there Id.
1881    #[serde(deserialize_with = "crate::types::integer::list")]
1882    pub id: Vec<i32>,
1883    /// The `customData` member.
1884    #[serde(rename = "customData")]
1885    #[serde(default, skip_serializing_if = "Option::is_none")]
1886    pub custom_data: Option<crate::types::CustomData>,
1887}
1888
1889impl ClearVariableMonitoringRequest {
1890    /// Creates a `ClearVariableMonitoringRequest` from its required fields.
1891    #[must_use]
1892    pub fn new(id: Vec<i32>) -> Self {
1893        Self {
1894            id,
1895            custom_data: None,
1896        }
1897    }
1898
1899    /// Sets the optional `customData` field.
1900    #[must_use]
1901    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1902        self.custom_data = Some(value);
1903        self
1904    }
1905}
1906
1907impl Validate for ClearVariableMonitoringRequest {
1908    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1909        path.push_key("id");
1910        validate::list_len(self.id.len(), Some(1), None, path, out);
1911        for (index, item) in self.id.iter().enumerate() {
1912            path.push_index(index);
1913            validate::int_range(i64::from(*item), Some(0), None, path, out);
1914            path.pop();
1915        }
1916        path.pop();
1917        path.push_key("customData");
1918        if let Some(value) = &self.custom_data {
1919            Validate::validate_at(value, path, out);
1920        }
1921        path.pop();
1922    }
1923}
1924
1925impl Sealed for ClearVariableMonitoringRequest {}
1926impl Request for ClearVariableMonitoringRequest {
1927    type Action = Action;
1928    const ACTION: Action = Action::ClearVariableMonitoring;
1929    const KIND: MessageKind = MessageKind::Call;
1930    const ORIGIN: Origin = Origin::Csms;
1931    type Response = ClearVariableMonitoringResponse;
1932}
1933
1934impl Confirmed for ClearVariableMonitoringRequest {}
1935
1936/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1937#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1938pub struct ClearVariableMonitoringResponse {
1939    /// The `clearMonitoringResult` member.
1940    #[serde(rename = "clearMonitoringResult")]
1941    pub clear_monitoring_result: Vec<ClearMonitoringResult>,
1942    /// The `customData` member.
1943    #[serde(rename = "customData")]
1944    #[serde(default, skip_serializing_if = "Option::is_none")]
1945    pub custom_data: Option<crate::types::CustomData>,
1946}
1947
1948impl ClearVariableMonitoringResponse {
1949    /// Creates a `ClearVariableMonitoringResponse` from its required fields.
1950    #[must_use]
1951    pub fn new(clear_monitoring_result: Vec<ClearMonitoringResult>) -> Self {
1952        Self {
1953            clear_monitoring_result,
1954            custom_data: None,
1955        }
1956    }
1957
1958    /// Sets the optional `customData` field.
1959    #[must_use]
1960    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1961        self.custom_data = Some(value);
1962        self
1963    }
1964}
1965
1966impl Validate for ClearVariableMonitoringResponse {
1967    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1968        path.push_key("clearMonitoringResult");
1969        validate::list_len(self.clear_monitoring_result.len(), Some(1), None, path, out);
1970        for (index, item) in self.clear_monitoring_result.iter().enumerate() {
1971            path.push_index(index);
1972            Validate::validate_at(item, path, out);
1973            path.pop();
1974        }
1975        path.pop();
1976        path.push_key("customData");
1977        if let Some(value) = &self.custom_data {
1978            Validate::validate_at(value, path, out);
1979        }
1980        path.pop();
1981    }
1982}
1983
1984impl Sealed for ClearVariableMonitoringResponse {}
1985impl Response for ClearVariableMonitoringResponse {}
1986
1987/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
1988#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1989pub struct ClearedChargingLimitRequest {
1990    /// Source of the charging limit. Allowed values defined in Appendix as ChargingLimitSourceEnumStringType.
1991    #[serde(rename = "chargingLimitSource")]
1992    pub charging_limit_source: String,
1993    /// EVSE Identifier.
1994    #[serde(rename = "evseId")]
1995    #[serde(default, skip_serializing_if = "Option::is_none")]
1996    #[serde(deserialize_with = "crate::types::integer::option")]
1997    pub evse_id: Option<i32>,
1998    /// The `customData` member.
1999    #[serde(rename = "customData")]
2000    #[serde(default, skip_serializing_if = "Option::is_none")]
2001    pub custom_data: Option<crate::types::CustomData>,
2002}
2003
2004impl ClearedChargingLimitRequest {
2005    /// Creates a `ClearedChargingLimitRequest` from its required fields.
2006    #[must_use]
2007    pub fn new(charging_limit_source: impl Into<String>) -> Self {
2008        Self {
2009            charging_limit_source: charging_limit_source.into(),
2010            evse_id: None,
2011            custom_data: None,
2012        }
2013    }
2014
2015    /// Sets the optional `evseId` field.
2016    #[must_use]
2017    pub fn with_evse_id(mut self, value: i32) -> Self {
2018        self.evse_id = Some(value);
2019        self
2020    }
2021
2022    /// Sets the optional `customData` field.
2023    #[must_use]
2024    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2025        self.custom_data = Some(value);
2026        self
2027    }
2028}
2029
2030impl Validate for ClearedChargingLimitRequest {
2031    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2032        path.push_key("chargingLimitSource");
2033        validate::string(
2034            self.charging_limit_source.as_str(),
2035            None,
2036            Some(20),
2037            path,
2038            out,
2039        );
2040        path.pop();
2041        path.push_key("evseId");
2042        if let Some(value) = &self.evse_id {
2043            validate::int_range(i64::from(*value), Some(0), None, path, out);
2044        }
2045        path.pop();
2046        path.push_key("customData");
2047        if let Some(value) = &self.custom_data {
2048            Validate::validate_at(value, path, out);
2049        }
2050        path.pop();
2051    }
2052}
2053
2054impl Sealed for ClearedChargingLimitRequest {}
2055impl Request for ClearedChargingLimitRequest {
2056    type Action = Action;
2057    const ACTION: Action = Action::ClearedChargingLimit;
2058    const KIND: MessageKind = MessageKind::Call;
2059    const ORIGIN: Origin = Origin::ChargingStation;
2060    type Response = ClearedChargingLimitResponse;
2061}
2062
2063impl Confirmed for ClearedChargingLimitRequest {}
2064
2065/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
2066#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2067pub struct ClearedChargingLimitResponse {
2068    /// The `customData` member.
2069    #[serde(rename = "customData")]
2070    #[serde(default, skip_serializing_if = "Option::is_none")]
2071    pub custom_data: Option<crate::types::CustomData>,
2072}
2073
2074impl ClearedChargingLimitResponse {
2075    /// Creates an empty `ClearedChargingLimitResponse`. Every field of this type is optional.
2076    #[must_use]
2077    pub fn new() -> Self {
2078        Self::default()
2079    }
2080
2081    /// Sets the optional `customData` field.
2082    #[must_use]
2083    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2084        self.custom_data = Some(value);
2085        self
2086    }
2087}
2088
2089impl Validate for ClearedChargingLimitResponse {
2090    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2091        path.push_key("customData");
2092        if let Some(value) = &self.custom_data {
2093            Validate::validate_at(value, path, out);
2094        }
2095        path.pop();
2096    }
2097}
2098
2099impl Sealed for ClearedChargingLimitResponse {}
2100impl Response for ClearedChargingLimitResponse {}
2101
2102/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
2103#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2104pub struct ClosePeriodicEventStreamRequest {
2105    /// Id of stream to close.
2106    #[serde(deserialize_with = "crate::types::integer::one")]
2107    pub id: i32,
2108    /// The `customData` member.
2109    #[serde(rename = "customData")]
2110    #[serde(default, skip_serializing_if = "Option::is_none")]
2111    pub custom_data: Option<crate::types::CustomData>,
2112}
2113
2114impl ClosePeriodicEventStreamRequest {
2115    /// Creates a `ClosePeriodicEventStreamRequest` from its required fields.
2116    #[must_use]
2117    pub fn new(id: i32) -> Self {
2118        Self {
2119            id,
2120            custom_data: None,
2121        }
2122    }
2123
2124    /// Sets the optional `customData` field.
2125    #[must_use]
2126    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2127        self.custom_data = Some(value);
2128        self
2129    }
2130}
2131
2132impl Validate for ClosePeriodicEventStreamRequest {
2133    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2134        path.push_key("id");
2135        validate::int_range(i64::from(self.id), Some(0), None, path, out);
2136        path.pop();
2137        path.push_key("customData");
2138        if let Some(value) = &self.custom_data {
2139            Validate::validate_at(value, path, out);
2140        }
2141        path.pop();
2142    }
2143}
2144
2145impl Sealed for ClosePeriodicEventStreamRequest {}
2146impl Request for ClosePeriodicEventStreamRequest {
2147    type Action = Action;
2148    const ACTION: Action = Action::ClosePeriodicEventStream;
2149    const KIND: MessageKind = MessageKind::Call;
2150    const ORIGIN: Origin = Origin::ChargingStation;
2151    type Response = ClosePeriodicEventStreamResponse;
2152}
2153
2154impl Confirmed for ClosePeriodicEventStreamRequest {}
2155
2156/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
2157#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2158pub struct ClosePeriodicEventStreamResponse {
2159    /// The `customData` member.
2160    #[serde(rename = "customData")]
2161    #[serde(default, skip_serializing_if = "Option::is_none")]
2162    pub custom_data: Option<crate::types::CustomData>,
2163}
2164
2165impl ClosePeriodicEventStreamResponse {
2166    /// Creates an empty `ClosePeriodicEventStreamResponse`. Every field of this type is optional.
2167    #[must_use]
2168    pub fn new() -> Self {
2169        Self::default()
2170    }
2171
2172    /// Sets the optional `customData` field.
2173    #[must_use]
2174    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2175        self.custom_data = Some(value);
2176        self
2177    }
2178}
2179
2180impl Validate for ClosePeriodicEventStreamResponse {
2181    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2182        path.push_key("customData");
2183        if let Some(value) = &self.custom_data {
2184            Validate::validate_at(value, path, out);
2185        }
2186        path.pop();
2187    }
2188}
2189
2190impl Sealed for ClosePeriodicEventStreamResponse {}
2191impl Response for ClosePeriodicEventStreamResponse {}
2192
2193/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
2194#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2195pub struct CostUpdatedRequest {
2196    /// Current total cost, based on the information known by the CSMS, of the transaction including taxes. In the currency configured with the configuration Variable: \[&lt;&lt;configkey-currency, Currency&gt;&gt;\]
2197    #[serde(rename = "totalCost")]
2198    pub total_cost: crate::types::Decimal,
2199    /// Transaction Id of the transaction the current cost are asked for.
2200    #[serde(rename = "transactionId")]
2201    pub transaction_id: String,
2202    /// The `customData` member.
2203    #[serde(rename = "customData")]
2204    #[serde(default, skip_serializing_if = "Option::is_none")]
2205    pub custom_data: Option<crate::types::CustomData>,
2206}
2207
2208impl CostUpdatedRequest {
2209    /// Creates a `CostUpdatedRequest` from its required fields.
2210    #[must_use]
2211    pub fn new(
2212        total_cost: impl Into<crate::types::Decimal>,
2213        transaction_id: impl Into<String>,
2214    ) -> Self {
2215        Self {
2216            total_cost: total_cost.into(),
2217            transaction_id: transaction_id.into(),
2218            custom_data: None,
2219        }
2220    }
2221
2222    /// Sets the optional `customData` field.
2223    #[must_use]
2224    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2225        self.custom_data = Some(value);
2226        self
2227    }
2228}
2229
2230impl Validate for CostUpdatedRequest {
2231    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2232        path.push_key("transactionId");
2233        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
2234        path.pop();
2235        path.push_key("customData");
2236        if let Some(value) = &self.custom_data {
2237            Validate::validate_at(value, path, out);
2238        }
2239        path.pop();
2240    }
2241}
2242
2243impl Sealed for CostUpdatedRequest {}
2244impl Request for CostUpdatedRequest {
2245    type Action = Action;
2246    const ACTION: Action = Action::CostUpdated;
2247    const KIND: MessageKind = MessageKind::Call;
2248    const ORIGIN: Origin = Origin::Csms;
2249    type Response = CostUpdatedResponse;
2250}
2251
2252impl Confirmed for CostUpdatedRequest {}
2253
2254/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
2255#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2256pub struct CostUpdatedResponse {
2257    /// The `customData` member.
2258    #[serde(rename = "customData")]
2259    #[serde(default, skip_serializing_if = "Option::is_none")]
2260    pub custom_data: Option<crate::types::CustomData>,
2261}
2262
2263impl CostUpdatedResponse {
2264    /// Creates an empty `CostUpdatedResponse`. Every field of this type is optional.
2265    #[must_use]
2266    pub fn new() -> Self {
2267        Self::default()
2268    }
2269
2270    /// Sets the optional `customData` field.
2271    #[must_use]
2272    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2273        self.custom_data = Some(value);
2274        self
2275    }
2276}
2277
2278impl Validate for CostUpdatedResponse {
2279    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2280        path.push_key("customData");
2281        if let Some(value) = &self.custom_data {
2282            Validate::validate_at(value, path, out);
2283        }
2284        path.pop();
2285    }
2286}
2287
2288impl Sealed for CostUpdatedResponse {}
2289impl Response for CostUpdatedResponse {}
2290
2291/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
2292#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2293pub struct CustomerInformationRequest {
2294    /// The Id of the request.
2295    #[serde(rename = "requestId")]
2296    #[serde(deserialize_with = "crate::types::integer::one")]
2297    pub request_id: i32,
2298    /// Flag indicating whether the Charging Station should return NotifyCustomerInformationRequest messages containing information about the customer referred to.
2299    pub report: bool,
2300    /// Flag indicating whether the Charging Station should clear all information about the customer referred to.
2301    pub clear: bool,
2302    /// The `customerCertificate` member.
2303    #[serde(rename = "customerCertificate")]
2304    #[serde(default, skip_serializing_if = "Option::is_none")]
2305    pub customer_certificate: Option<CertificateHashData>,
2306    /// The `idToken` member.
2307    #[serde(rename = "idToken")]
2308    #[serde(default, skip_serializing_if = "Option::is_none")]
2309    pub id_token: Option<IdToken>,
2310    /// A (e.g. vendor specific) identifier of the customer this request refers to. This field contains a custom identifier other than IdToken and Certificate.
2311    /// One of the possible identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the request message.
2312    #[serde(rename = "customerIdentifier")]
2313    #[serde(default, skip_serializing_if = "Option::is_none")]
2314    pub customer_identifier: Option<String>,
2315    /// The `customData` member.
2316    #[serde(rename = "customData")]
2317    #[serde(default, skip_serializing_if = "Option::is_none")]
2318    pub custom_data: Option<crate::types::CustomData>,
2319}
2320
2321impl CustomerInformationRequest {
2322    /// Creates a `CustomerInformationRequest` from its required fields.
2323    #[must_use]
2324    pub fn new(request_id: i32, report: bool, clear: bool) -> Self {
2325        Self {
2326            request_id,
2327            report,
2328            clear,
2329            customer_certificate: None,
2330            id_token: None,
2331            customer_identifier: None,
2332            custom_data: None,
2333        }
2334    }
2335
2336    /// Sets the optional `customerCertificate` field.
2337    #[must_use]
2338    pub fn with_customer_certificate(mut self, value: CertificateHashData) -> Self {
2339        self.customer_certificate = Some(value);
2340        self
2341    }
2342
2343    /// Sets the optional `idToken` field.
2344    #[must_use]
2345    pub fn with_id_token(mut self, value: IdToken) -> Self {
2346        self.id_token = Some(value);
2347        self
2348    }
2349
2350    /// Sets the optional `customerIdentifier` field.
2351    #[must_use]
2352    pub fn with_customer_identifier(mut self, value: impl Into<String>) -> Self {
2353        self.customer_identifier = Some(value.into());
2354        self
2355    }
2356
2357    /// Sets the optional `customData` field.
2358    #[must_use]
2359    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2360        self.custom_data = Some(value);
2361        self
2362    }
2363}
2364
2365impl Validate for CustomerInformationRequest {
2366    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2367        path.push_key("requestId");
2368        validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
2369        path.pop();
2370        path.push_key("customerCertificate");
2371        if let Some(value) = &self.customer_certificate {
2372            Validate::validate_at(value, path, out);
2373        }
2374        path.pop();
2375        path.push_key("idToken");
2376        if let Some(value) = &self.id_token {
2377            Validate::validate_at(value, path, out);
2378        }
2379        path.pop();
2380        path.push_key("customerIdentifier");
2381        if let Some(value) = &self.customer_identifier {
2382            validate::string(value.as_str(), None, Some(64), path, out);
2383        }
2384        path.pop();
2385        path.push_key("customData");
2386        if let Some(value) = &self.custom_data {
2387            Validate::validate_at(value, path, out);
2388        }
2389        path.pop();
2390    }
2391}
2392
2393impl Sealed for CustomerInformationRequest {}
2394impl Request for CustomerInformationRequest {
2395    type Action = Action;
2396    const ACTION: Action = Action::CustomerInformation;
2397    const KIND: MessageKind = MessageKind::Call;
2398    const ORIGIN: Origin = Origin::Csms;
2399    type Response = CustomerInformationResponse;
2400}
2401
2402impl Confirmed for CustomerInformationRequest {}
2403
2404/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
2405#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2406pub struct CustomerInformationResponse {
2407    /// The `status` member.
2408    pub status: CustomerInformationStatus,
2409    /// The `statusInfo` member.
2410    #[serde(rename = "statusInfo")]
2411    #[serde(default, skip_serializing_if = "Option::is_none")]
2412    pub status_info: Option<StatusInfo>,
2413    /// The `customData` member.
2414    #[serde(rename = "customData")]
2415    #[serde(default, skip_serializing_if = "Option::is_none")]
2416    pub custom_data: Option<crate::types::CustomData>,
2417}
2418
2419impl CustomerInformationResponse {
2420    /// Creates a `CustomerInformationResponse` from its required fields.
2421    #[must_use]
2422    pub fn new(status: CustomerInformationStatus) -> Self {
2423        Self {
2424            status,
2425            status_info: None,
2426            custom_data: None,
2427        }
2428    }
2429
2430    /// Sets the optional `statusInfo` field.
2431    #[must_use]
2432    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2433        self.status_info = Some(value);
2434        self
2435    }
2436
2437    /// Sets the optional `customData` field.
2438    #[must_use]
2439    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2440        self.custom_data = Some(value);
2441        self
2442    }
2443}
2444
2445impl Validate for CustomerInformationResponse {
2446    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2447        path.push_key("status");
2448        Validate::validate_at(&self.status, path, out);
2449        path.pop();
2450        path.push_key("statusInfo");
2451        if let Some(value) = &self.status_info {
2452            Validate::validate_at(value, path, out);
2453        }
2454        path.pop();
2455        path.push_key("customData");
2456        if let Some(value) = &self.custom_data {
2457            Validate::validate_at(value, path, out);
2458        }
2459        path.pop();
2460    }
2461}
2462
2463impl Sealed for CustomerInformationResponse {}
2464impl Response for CustomerInformationResponse {}
2465
2466/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
2467#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2468pub struct DataTransferRequest {
2469    /// This identifies the Vendor specific implementation
2470    #[serde(rename = "vendorId")]
2471    pub vendor_id: String,
2472    /// May be used to indicate a specific message or implementation.
2473    #[serde(rename = "messageId")]
2474    #[serde(default, skip_serializing_if = "Option::is_none")]
2475    pub message_id: Option<String>,
2476    /// Data without specified length or format. This needs to be decided by both parties (Open to implementation).
2477    #[serde(default, skip_serializing_if = "Option::is_none")]
2478    pub data: Option<serde_json::Value>,
2479    /// The `customData` member.
2480    #[serde(rename = "customData")]
2481    #[serde(default, skip_serializing_if = "Option::is_none")]
2482    pub custom_data: Option<crate::types::CustomData>,
2483}
2484
2485impl DataTransferRequest {
2486    /// Creates a `DataTransferRequest` from its required fields.
2487    #[must_use]
2488    pub fn new(vendor_id: impl Into<String>) -> Self {
2489        Self {
2490            vendor_id: vendor_id.into(),
2491            message_id: None,
2492            data: None,
2493            custom_data: None,
2494        }
2495    }
2496
2497    /// Sets the optional `messageId` field.
2498    #[must_use]
2499    pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
2500        self.message_id = Some(value.into());
2501        self
2502    }
2503
2504    /// Sets the optional `data` field.
2505    #[must_use]
2506    pub fn with_data(mut self, value: serde_json::Value) -> Self {
2507        self.data = Some(value);
2508        self
2509    }
2510
2511    /// Sets the optional `customData` field.
2512    #[must_use]
2513    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2514        self.custom_data = Some(value);
2515        self
2516    }
2517}
2518
2519impl Validate for DataTransferRequest {
2520    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2521        path.push_key("vendorId");
2522        validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
2523        path.pop();
2524        path.push_key("messageId");
2525        if let Some(value) = &self.message_id {
2526            validate::string(value.as_str(), None, Some(50), path, out);
2527        }
2528        path.pop();
2529        path.push_key("customData");
2530        if let Some(value) = &self.custom_data {
2531            Validate::validate_at(value, path, out);
2532        }
2533        path.pop();
2534    }
2535}
2536
2537impl Sealed for DataTransferRequest {}
2538impl Request for DataTransferRequest {
2539    type Action = Action;
2540    const ACTION: Action = Action::DataTransfer;
2541    const KIND: MessageKind = MessageKind::Call;
2542    const ORIGIN: Origin = Origin::Both;
2543    type Response = DataTransferResponse;
2544}
2545
2546impl Confirmed for DataTransferRequest {}
2547
2548/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
2549#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2550pub struct DataTransferResponse {
2551    /// The `status` member.
2552    pub status: DataTransferStatus,
2553    /// The `statusInfo` member.
2554    #[serde(rename = "statusInfo")]
2555    #[serde(default, skip_serializing_if = "Option::is_none")]
2556    pub status_info: Option<StatusInfo>,
2557    /// Data without specified length or format, in response to request.
2558    #[serde(default, skip_serializing_if = "Option::is_none")]
2559    pub data: Option<serde_json::Value>,
2560    /// The `customData` member.
2561    #[serde(rename = "customData")]
2562    #[serde(default, skip_serializing_if = "Option::is_none")]
2563    pub custom_data: Option<crate::types::CustomData>,
2564}
2565
2566impl DataTransferResponse {
2567    /// Creates a `DataTransferResponse` from its required fields.
2568    #[must_use]
2569    pub fn new(status: DataTransferStatus) -> Self {
2570        Self {
2571            status,
2572            status_info: None,
2573            data: None,
2574            custom_data: None,
2575        }
2576    }
2577
2578    /// Sets the optional `statusInfo` field.
2579    #[must_use]
2580    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2581        self.status_info = Some(value);
2582        self
2583    }
2584
2585    /// Sets the optional `data` field.
2586    #[must_use]
2587    pub fn with_data(mut self, value: serde_json::Value) -> Self {
2588        self.data = Some(value);
2589        self
2590    }
2591
2592    /// Sets the optional `customData` field.
2593    #[must_use]
2594    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2595        self.custom_data = Some(value);
2596        self
2597    }
2598}
2599
2600impl Validate for DataTransferResponse {
2601    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2602        path.push_key("status");
2603        Validate::validate_at(&self.status, path, out);
2604        path.pop();
2605        path.push_key("statusInfo");
2606        if let Some(value) = &self.status_info {
2607            Validate::validate_at(value, path, out);
2608        }
2609        path.pop();
2610        path.push_key("customData");
2611        if let Some(value) = &self.custom_data {
2612            Validate::validate_at(value, path, out);
2613        }
2614        path.pop();
2615    }
2616}
2617
2618impl Sealed for DataTransferResponse {}
2619impl Response for DataTransferResponse {}
2620
2621/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2622#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2623pub struct DeleteCertificateRequest {
2624    /// The `certificateHashData` member.
2625    #[serde(rename = "certificateHashData")]
2626    pub certificate_hash_data: CertificateHashData,
2627    /// The `customData` member.
2628    #[serde(rename = "customData")]
2629    #[serde(default, skip_serializing_if = "Option::is_none")]
2630    pub custom_data: Option<crate::types::CustomData>,
2631}
2632
2633impl DeleteCertificateRequest {
2634    /// Creates a `DeleteCertificateRequest` from its required fields.
2635    #[must_use]
2636    pub fn new(certificate_hash_data: CertificateHashData) -> Self {
2637        Self {
2638            certificate_hash_data,
2639            custom_data: None,
2640        }
2641    }
2642
2643    /// Sets the optional `customData` field.
2644    #[must_use]
2645    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2646        self.custom_data = Some(value);
2647        self
2648    }
2649}
2650
2651impl Validate for DeleteCertificateRequest {
2652    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2653        path.push_key("certificateHashData");
2654        Validate::validate_at(&self.certificate_hash_data, path, out);
2655        path.pop();
2656        path.push_key("customData");
2657        if let Some(value) = &self.custom_data {
2658            Validate::validate_at(value, path, out);
2659        }
2660        path.pop();
2661    }
2662}
2663
2664impl Sealed for DeleteCertificateRequest {}
2665impl Request for DeleteCertificateRequest {
2666    type Action = Action;
2667    const ACTION: Action = Action::DeleteCertificate;
2668    const KIND: MessageKind = MessageKind::Call;
2669    const ORIGIN: Origin = Origin::Csms;
2670    type Response = DeleteCertificateResponse;
2671}
2672
2673impl Confirmed for DeleteCertificateRequest {}
2674
2675/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2676#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2677pub struct DeleteCertificateResponse {
2678    /// The `status` member.
2679    pub status: DeleteCertificateStatus,
2680    /// The `statusInfo` member.
2681    #[serde(rename = "statusInfo")]
2682    #[serde(default, skip_serializing_if = "Option::is_none")]
2683    pub status_info: Option<StatusInfo>,
2684    /// The `customData` member.
2685    #[serde(rename = "customData")]
2686    #[serde(default, skip_serializing_if = "Option::is_none")]
2687    pub custom_data: Option<crate::types::CustomData>,
2688}
2689
2690impl DeleteCertificateResponse {
2691    /// Creates a `DeleteCertificateResponse` from its required fields.
2692    #[must_use]
2693    pub fn new(status: DeleteCertificateStatus) -> Self {
2694        Self {
2695            status,
2696            status_info: None,
2697            custom_data: None,
2698        }
2699    }
2700
2701    /// Sets the optional `statusInfo` field.
2702    #[must_use]
2703    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2704        self.status_info = Some(value);
2705        self
2706    }
2707
2708    /// Sets the optional `customData` field.
2709    #[must_use]
2710    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2711        self.custom_data = Some(value);
2712        self
2713    }
2714}
2715
2716impl Validate for DeleteCertificateResponse {
2717    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2718        path.push_key("status");
2719        Validate::validate_at(&self.status, path, out);
2720        path.pop();
2721        path.push_key("statusInfo");
2722        if let Some(value) = &self.status_info {
2723            Validate::validate_at(value, path, out);
2724        }
2725        path.pop();
2726        path.push_key("customData");
2727        if let Some(value) = &self.custom_data {
2728            Validate::validate_at(value, path, out);
2729        }
2730        path.pop();
2731    }
2732}
2733
2734impl Sealed for DeleteCertificateResponse {}
2735impl Response for DeleteCertificateResponse {}
2736
2737/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
2738#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2739pub struct FirmwareStatusNotificationRequest {
2740    /// The `status` member.
2741    pub status: FirmwareStatus,
2742    /// The request id that was provided in the
2743    /// UpdateFirmwareRequest that started this firmware update.
2744    /// This field is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no firmware update ongoing.
2745    #[serde(rename = "requestId")]
2746    #[serde(default, skip_serializing_if = "Option::is_none")]
2747    #[serde(deserialize_with = "crate::types::integer::option")]
2748    pub request_id: Option<i32>,
2749    /// The `statusInfo` member.
2750    #[serde(rename = "statusInfo")]
2751    #[serde(default, skip_serializing_if = "Option::is_none")]
2752    pub status_info: Option<StatusInfo>,
2753    /// The `customData` member.
2754    #[serde(rename = "customData")]
2755    #[serde(default, skip_serializing_if = "Option::is_none")]
2756    pub custom_data: Option<crate::types::CustomData>,
2757}
2758
2759impl FirmwareStatusNotificationRequest {
2760    /// Creates a `FirmwareStatusNotificationRequest` from its required fields.
2761    #[must_use]
2762    pub fn new(status: FirmwareStatus) -> Self {
2763        Self {
2764            status,
2765            request_id: None,
2766            status_info: None,
2767            custom_data: None,
2768        }
2769    }
2770
2771    /// Sets the optional `requestId` field.
2772    #[must_use]
2773    pub fn with_request_id(mut self, value: i32) -> Self {
2774        self.request_id = Some(value);
2775        self
2776    }
2777
2778    /// Sets the optional `statusInfo` field.
2779    #[must_use]
2780    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2781        self.status_info = Some(value);
2782        self
2783    }
2784
2785    /// Sets the optional `customData` field.
2786    #[must_use]
2787    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2788        self.custom_data = Some(value);
2789        self
2790    }
2791}
2792
2793impl Validate for FirmwareStatusNotificationRequest {
2794    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2795        path.push_key("status");
2796        Validate::validate_at(&self.status, path, out);
2797        path.pop();
2798        path.push_key("statusInfo");
2799        if let Some(value) = &self.status_info {
2800            Validate::validate_at(value, path, out);
2801        }
2802        path.pop();
2803        path.push_key("customData");
2804        if let Some(value) = &self.custom_data {
2805            Validate::validate_at(value, path, out);
2806        }
2807        path.pop();
2808    }
2809}
2810
2811impl Sealed for FirmwareStatusNotificationRequest {}
2812impl Request for FirmwareStatusNotificationRequest {
2813    type Action = Action;
2814    const ACTION: Action = Action::FirmwareStatusNotification;
2815    const KIND: MessageKind = MessageKind::Call;
2816    const ORIGIN: Origin = Origin::ChargingStation;
2817    type Response = FirmwareStatusNotificationResponse;
2818}
2819
2820impl Confirmed for FirmwareStatusNotificationRequest {}
2821
2822/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
2823#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2824pub struct FirmwareStatusNotificationResponse {
2825    /// The `customData` member.
2826    #[serde(rename = "customData")]
2827    #[serde(default, skip_serializing_if = "Option::is_none")]
2828    pub custom_data: Option<crate::types::CustomData>,
2829}
2830
2831impl FirmwareStatusNotificationResponse {
2832    /// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
2833    #[must_use]
2834    pub fn new() -> Self {
2835        Self::default()
2836    }
2837
2838    /// Sets the optional `customData` field.
2839    #[must_use]
2840    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2841        self.custom_data = Some(value);
2842        self
2843    }
2844}
2845
2846impl Validate for FirmwareStatusNotificationResponse {
2847    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2848        path.push_key("customData");
2849        if let Some(value) = &self.custom_data {
2850            Validate::validate_at(value, path, out);
2851        }
2852        path.pop();
2853    }
2854}
2855
2856impl Sealed for FirmwareStatusNotificationResponse {}
2857impl Response for FirmwareStatusNotificationResponse {}
2858
2859/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2860#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2861pub struct Get15118EVCertificateRequest {
2862    /// Schema version currently used for the 15118 session between EV and Charging Station. Needed for parsing of the EXI stream by the CSMS.
2863    #[serde(rename = "iso15118SchemaVersion")]
2864    pub iso15118_schema_version: String,
2865    /// The `action` member.
2866    pub action: CertificateAction,
2867    /// *(2.1)* Raw CertificateInstallationReq request from EV, Base64 encoded. +
2868    /// Extended to support ISO 15118-20 certificates. The minimum supported length is 11000. If a longer _exiRequest_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateRequest.exiRequest" \].
2869    #[serde(rename = "exiRequest")]
2870    pub exi_request: String,
2871    /// *(2.1)* Absent during ISO 15118-2 session. Required during ISO 15118-20 session. +
2872    /// Maximum number of contracts that EV wants to install.
2873    #[serde(rename = "maximumContractCertificateChains")]
2874    #[serde(default, skip_serializing_if = "Option::is_none")]
2875    #[serde(deserialize_with = "crate::types::integer::option")]
2876    pub maximum_contract_certificate_chains: Option<i32>,
2877    /// *(2.1)*  Absent during ISO 15118-2 session. Optional during ISO 15118-20 session. List of EMAIDs for which contract certificates must be requested first, in case there are more certificates than allowed by _maximumContractCertificateChains_.
2878    #[serde(rename = "prioritizedEMAIDs")]
2879    #[serde(default, skip_serializing_if = "Option::is_none")]
2880    pub prioritized_emai_ds: Option<Vec<String>>,
2881    /// The `customData` member.
2882    #[serde(rename = "customData")]
2883    #[serde(default, skip_serializing_if = "Option::is_none")]
2884    pub custom_data: Option<crate::types::CustomData>,
2885}
2886
2887impl Get15118EVCertificateRequest {
2888    /// Creates a `Get15118EVCertificateRequest` from its required fields.
2889    #[must_use]
2890    pub fn new(
2891        iso15118_schema_version: impl Into<String>,
2892        action: CertificateAction,
2893        exi_request: impl Into<String>,
2894    ) -> Self {
2895        Self {
2896            iso15118_schema_version: iso15118_schema_version.into(),
2897            action,
2898            exi_request: exi_request.into(),
2899            maximum_contract_certificate_chains: None,
2900            prioritized_emai_ds: None,
2901            custom_data: None,
2902        }
2903    }
2904
2905    /// Sets the optional `maximumContractCertificateChains` field.
2906    #[must_use]
2907    pub fn with_maximum_contract_certificate_chains(mut self, value: i32) -> Self {
2908        self.maximum_contract_certificate_chains = Some(value);
2909        self
2910    }
2911
2912    /// Sets the optional `prioritizedEMAIDs` field.
2913    #[must_use]
2914    pub fn with_prioritized_emai_ds(
2915        mut self,
2916        value: impl IntoIterator<Item = impl Into<String>>,
2917    ) -> Self {
2918        self.prioritized_emai_ds = Some(value.into_iter().map(Into::into).collect());
2919        self
2920    }
2921
2922    /// Sets the optional `customData` field.
2923    #[must_use]
2924    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2925        self.custom_data = Some(value);
2926        self
2927    }
2928}
2929
2930impl Validate for Get15118EVCertificateRequest {
2931    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2932        path.push_key("iso15118SchemaVersion");
2933        validate::string(
2934            self.iso15118_schema_version.as_str(),
2935            None,
2936            Some(50),
2937            path,
2938            out,
2939        );
2940        path.pop();
2941        path.push_key("action");
2942        Validate::validate_at(&self.action, path, out);
2943        path.pop();
2944        path.push_key("exiRequest");
2945        validate::string(self.exi_request.as_str(), None, Some(11000), path, out);
2946        path.pop();
2947        path.push_key("maximumContractCertificateChains");
2948        if let Some(value) = &self.maximum_contract_certificate_chains {
2949            validate::int_range(i64::from(*value), Some(0), None, path, out);
2950        }
2951        path.pop();
2952        path.push_key("prioritizedEMAIDs");
2953        if let Some(value) = &self.prioritized_emai_ds {
2954            validate::list_len(value.len(), Some(1), Some(8), path, out);
2955            for (index, item) in value.iter().enumerate() {
2956                path.push_index(index);
2957                validate::string(item.as_str(), None, Some(255), path, out);
2958                path.pop();
2959            }
2960        }
2961        path.pop();
2962        path.push_key("customData");
2963        if let Some(value) = &self.custom_data {
2964            Validate::validate_at(value, path, out);
2965        }
2966        path.pop();
2967    }
2968}
2969
2970impl Sealed for Get15118EVCertificateRequest {}
2971impl Request for Get15118EVCertificateRequest {
2972    type Action = Action;
2973    const ACTION: Action = Action::Get15118EVCertificate;
2974    const KIND: MessageKind = MessageKind::Call;
2975    const ORIGIN: Origin = Origin::ChargingStation;
2976    type Response = Get15118EVCertificateResponse;
2977}
2978
2979impl Confirmed for Get15118EVCertificateRequest {}
2980
2981/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2982#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2983pub struct Get15118EVCertificateResponse {
2984    /// The `status` member.
2985    pub status: Iso15118EVCertificateStatus,
2986    /// *(2/1)* Raw CertificateInstallationRes response for the EV, Base64 encoded. +
2987    /// Extended to support ISO 15118-20 certificates. The minimum supported length is 17000. If a longer _exiResponse_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateResponse.exiResponse" \].
2988    #[serde(rename = "exiResponse")]
2989    pub exi_response: String,
2990    /// The `statusInfo` member.
2991    #[serde(rename = "statusInfo")]
2992    #[serde(default, skip_serializing_if = "Option::is_none")]
2993    pub status_info: Option<StatusInfo>,
2994    /// *(2.1)* Number of contracts that can be retrieved with additional requests.
2995    #[serde(rename = "remainingContracts")]
2996    #[serde(default, skip_serializing_if = "Option::is_none")]
2997    #[serde(deserialize_with = "crate::types::integer::option")]
2998    pub remaining_contracts: Option<i32>,
2999    /// The `customData` member.
3000    #[serde(rename = "customData")]
3001    #[serde(default, skip_serializing_if = "Option::is_none")]
3002    pub custom_data: Option<crate::types::CustomData>,
3003}
3004
3005impl Get15118EVCertificateResponse {
3006    /// Creates a `Get15118EVCertificateResponse` from its required fields.
3007    #[must_use]
3008    pub fn new(status: Iso15118EVCertificateStatus, exi_response: impl Into<String>) -> Self {
3009        Self {
3010            status,
3011            exi_response: exi_response.into(),
3012            status_info: None,
3013            remaining_contracts: None,
3014            custom_data: None,
3015        }
3016    }
3017
3018    /// Sets the optional `statusInfo` field.
3019    #[must_use]
3020    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3021        self.status_info = Some(value);
3022        self
3023    }
3024
3025    /// Sets the optional `remainingContracts` field.
3026    #[must_use]
3027    pub fn with_remaining_contracts(mut self, value: i32) -> Self {
3028        self.remaining_contracts = Some(value);
3029        self
3030    }
3031
3032    /// Sets the optional `customData` field.
3033    #[must_use]
3034    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3035        self.custom_data = Some(value);
3036        self
3037    }
3038}
3039
3040impl Validate for Get15118EVCertificateResponse {
3041    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3042        path.push_key("status");
3043        Validate::validate_at(&self.status, path, out);
3044        path.pop();
3045        path.push_key("exiResponse");
3046        validate::string(self.exi_response.as_str(), None, Some(17000), path, out);
3047        path.pop();
3048        path.push_key("statusInfo");
3049        if let Some(value) = &self.status_info {
3050            Validate::validate_at(value, path, out);
3051        }
3052        path.pop();
3053        path.push_key("remainingContracts");
3054        if let Some(value) = &self.remaining_contracts {
3055            validate::int_range(i64::from(*value), Some(0), None, path, out);
3056        }
3057        path.pop();
3058        path.push_key("customData");
3059        if let Some(value) = &self.custom_data {
3060            Validate::validate_at(value, path, out);
3061        }
3062        path.pop();
3063    }
3064}
3065
3066impl Sealed for Get15118EVCertificateResponse {}
3067impl Response for Get15118EVCertificateResponse {}
3068
3069/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
3070#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3071pub struct GetBaseReportRequest {
3072    /// The Id of the request.
3073    #[serde(rename = "requestId")]
3074    #[serde(deserialize_with = "crate::types::integer::one")]
3075    pub request_id: i32,
3076    /// The `reportBase` member.
3077    #[serde(rename = "reportBase")]
3078    pub report_base: ReportBase,
3079    /// The `customData` member.
3080    #[serde(rename = "customData")]
3081    #[serde(default, skip_serializing_if = "Option::is_none")]
3082    pub custom_data: Option<crate::types::CustomData>,
3083}
3084
3085impl GetBaseReportRequest {
3086    /// Creates a `GetBaseReportRequest` from its required fields.
3087    #[must_use]
3088    pub fn new(request_id: i32, report_base: ReportBase) -> Self {
3089        Self {
3090            request_id,
3091            report_base,
3092            custom_data: None,
3093        }
3094    }
3095
3096    /// Sets the optional `customData` field.
3097    #[must_use]
3098    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3099        self.custom_data = Some(value);
3100        self
3101    }
3102}
3103
3104impl Validate for GetBaseReportRequest {
3105    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3106        path.push_key("reportBase");
3107        Validate::validate_at(&self.report_base, path, out);
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
3117impl Sealed for GetBaseReportRequest {}
3118impl Request for GetBaseReportRequest {
3119    type Action = Action;
3120    const ACTION: Action = Action::GetBaseReport;
3121    const KIND: MessageKind = MessageKind::Call;
3122    const ORIGIN: Origin = Origin::Csms;
3123    type Response = GetBaseReportResponse;
3124}
3125
3126impl Confirmed for GetBaseReportRequest {}
3127
3128/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
3129#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3130pub struct GetBaseReportResponse {
3131    /// The `status` member.
3132    pub status: GenericDeviceModelStatus,
3133    /// The `statusInfo` member.
3134    #[serde(rename = "statusInfo")]
3135    #[serde(default, skip_serializing_if = "Option::is_none")]
3136    pub status_info: Option<StatusInfo>,
3137    /// The `customData` member.
3138    #[serde(rename = "customData")]
3139    #[serde(default, skip_serializing_if = "Option::is_none")]
3140    pub custom_data: Option<crate::types::CustomData>,
3141}
3142
3143impl GetBaseReportResponse {
3144    /// Creates a `GetBaseReportResponse` from its required fields.
3145    #[must_use]
3146    pub fn new(status: GenericDeviceModelStatus) -> Self {
3147        Self {
3148            status,
3149            status_info: None,
3150            custom_data: None,
3151        }
3152    }
3153
3154    /// Sets the optional `statusInfo` field.
3155    #[must_use]
3156    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3157        self.status_info = Some(value);
3158        self
3159    }
3160
3161    /// Sets the optional `customData` field.
3162    #[must_use]
3163    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3164        self.custom_data = Some(value);
3165        self
3166    }
3167}
3168
3169impl Validate for GetBaseReportResponse {
3170    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3171        path.push_key("status");
3172        Validate::validate_at(&self.status, path, out);
3173        path.pop();
3174        path.push_key("statusInfo");
3175        if let Some(value) = &self.status_info {
3176            Validate::validate_at(value, path, out);
3177        }
3178        path.pop();
3179        path.push_key("customData");
3180        if let Some(value) = &self.custom_data {
3181            Validate::validate_at(value, path, out);
3182        }
3183        path.pop();
3184    }
3185}
3186
3187impl Sealed for GetBaseReportResponse {}
3188impl Response for GetBaseReportResponse {}
3189
3190/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3191#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3192pub struct GetCertificateChainStatusRequest {
3193    /// The `certificateStatusRequests` member.
3194    #[serde(rename = "certificateStatusRequests")]
3195    pub certificate_status_requests: Vec<CertificateStatusRequestInfo>,
3196    /// The `customData` member.
3197    #[serde(rename = "customData")]
3198    #[serde(default, skip_serializing_if = "Option::is_none")]
3199    pub custom_data: Option<crate::types::CustomData>,
3200}
3201
3202impl GetCertificateChainStatusRequest {
3203    /// Creates a `GetCertificateChainStatusRequest` from its required fields.
3204    #[must_use]
3205    pub fn new(certificate_status_requests: Vec<CertificateStatusRequestInfo>) -> Self {
3206        Self {
3207            certificate_status_requests,
3208            custom_data: None,
3209        }
3210    }
3211
3212    /// Sets the optional `customData` field.
3213    #[must_use]
3214    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3215        self.custom_data = Some(value);
3216        self
3217    }
3218}
3219
3220impl Validate for GetCertificateChainStatusRequest {
3221    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3222        path.push_key("certificateStatusRequests");
3223        validate::list_len(
3224            self.certificate_status_requests.len(),
3225            Some(1),
3226            Some(4),
3227            path,
3228            out,
3229        );
3230        for (index, item) in self.certificate_status_requests.iter().enumerate() {
3231            path.push_index(index);
3232            Validate::validate_at(item, path, out);
3233            path.pop();
3234        }
3235        path.pop();
3236        path.push_key("customData");
3237        if let Some(value) = &self.custom_data {
3238            Validate::validate_at(value, path, out);
3239        }
3240        path.pop();
3241    }
3242}
3243
3244impl Sealed for GetCertificateChainStatusRequest {}
3245impl Request for GetCertificateChainStatusRequest {
3246    type Action = Action;
3247    const ACTION: Action = Action::GetCertificateChainStatus;
3248    const KIND: MessageKind = MessageKind::Call;
3249    const ORIGIN: Origin = Origin::ChargingStation;
3250    type Response = GetCertificateChainStatusResponse;
3251}
3252
3253impl Confirmed for GetCertificateChainStatusRequest {}
3254
3255/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3256#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3257pub struct GetCertificateChainStatusResponse {
3258    /// The `certificateStatus` member.
3259    #[serde(rename = "certificateStatus")]
3260    pub certificate_status: Vec<CertificateStatus>,
3261    /// The `customData` member.
3262    #[serde(rename = "customData")]
3263    #[serde(default, skip_serializing_if = "Option::is_none")]
3264    pub custom_data: Option<crate::types::CustomData>,
3265}
3266
3267impl GetCertificateChainStatusResponse {
3268    /// Creates a `GetCertificateChainStatusResponse` from its required fields.
3269    #[must_use]
3270    pub fn new(certificate_status: Vec<CertificateStatus>) -> Self {
3271        Self {
3272            certificate_status,
3273            custom_data: None,
3274        }
3275    }
3276
3277    /// Sets the optional `customData` field.
3278    #[must_use]
3279    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3280        self.custom_data = Some(value);
3281        self
3282    }
3283}
3284
3285impl Validate for GetCertificateChainStatusResponse {
3286    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3287        path.push_key("certificateStatus");
3288        validate::list_len(self.certificate_status.len(), Some(1), Some(4), path, out);
3289        for (index, item) in self.certificate_status.iter().enumerate() {
3290            path.push_index(index);
3291            Validate::validate_at(item, path, out);
3292            path.pop();
3293        }
3294        path.pop();
3295        path.push_key("customData");
3296        if let Some(value) = &self.custom_data {
3297            Validate::validate_at(value, path, out);
3298        }
3299        path.pop();
3300    }
3301}
3302
3303impl Sealed for GetCertificateChainStatusResponse {}
3304impl Response for GetCertificateChainStatusResponse {}
3305
3306/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3307#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3308pub struct GetCertificateStatusRequest {
3309    /// The `ocspRequestData` member.
3310    #[serde(rename = "ocspRequestData")]
3311    pub ocsp_request_data: OCSPRequestData,
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 GetCertificateStatusRequest {
3319    /// Creates a `GetCertificateStatusRequest` from its required fields.
3320    #[must_use]
3321    pub fn new(ocsp_request_data: OCSPRequestData) -> Self {
3322        Self {
3323            ocsp_request_data,
3324            custom_data: None,
3325        }
3326    }
3327
3328    /// Sets the optional `customData` field.
3329    #[must_use]
3330    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3331        self.custom_data = Some(value);
3332        self
3333    }
3334}
3335
3336impl Validate for GetCertificateStatusRequest {
3337    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3338        path.push_key("ocspRequestData");
3339        Validate::validate_at(&self.ocsp_request_data, path, out);
3340        path.pop();
3341        path.push_key("customData");
3342        if let Some(value) = &self.custom_data {
3343            Validate::validate_at(value, path, out);
3344        }
3345        path.pop();
3346    }
3347}
3348
3349impl Sealed for GetCertificateStatusRequest {}
3350impl Request for GetCertificateStatusRequest {
3351    type Action = Action;
3352    const ACTION: Action = Action::GetCertificateStatus;
3353    const KIND: MessageKind = MessageKind::Call;
3354    const ORIGIN: Origin = Origin::ChargingStation;
3355    type Response = GetCertificateStatusResponse;
3356}
3357
3358impl Confirmed for GetCertificateStatusRequest {}
3359
3360/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3361#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3362pub struct GetCertificateStatusResponse {
3363    /// The `status` member.
3364    pub status: GetCertificateStatusEnum,
3365    /// The `statusInfo` member.
3366    #[serde(rename = "statusInfo")]
3367    #[serde(default, skip_serializing_if = "Option::is_none")]
3368    pub status_info: Option<StatusInfo>,
3369    /// *(2.1)* OCSPResponse class as defined in &lt;&lt;ref-ocpp_security_24, IETF RFC 6960&gt;&gt;. DER encoded (as defined in &lt;&lt;ref-ocpp_security_24, IETF RFC 6960&gt;&gt;), and then base64 encoded. MAY only be omitted when status is not Accepted. +
3370    /// The minimum supported length is 18000. If a longer _ocspResult_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "GetCertificateStatusResponse.ocspResult" \].
3371    #[serde(rename = "ocspResult")]
3372    #[serde(default, skip_serializing_if = "Option::is_none")]
3373    pub ocsp_result: Option<String>,
3374    /// The `customData` member.
3375    #[serde(rename = "customData")]
3376    #[serde(default, skip_serializing_if = "Option::is_none")]
3377    pub custom_data: Option<crate::types::CustomData>,
3378}
3379
3380impl GetCertificateStatusResponse {
3381    /// Creates a `GetCertificateStatusResponse` from its required fields.
3382    #[must_use]
3383    pub fn new(status: GetCertificateStatusEnum) -> Self {
3384        Self {
3385            status,
3386            status_info: None,
3387            ocsp_result: None,
3388            custom_data: None,
3389        }
3390    }
3391
3392    /// Sets the optional `statusInfo` field.
3393    #[must_use]
3394    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3395        self.status_info = Some(value);
3396        self
3397    }
3398
3399    /// Sets the optional `ocspResult` field.
3400    #[must_use]
3401    pub fn with_ocsp_result(mut self, value: impl Into<String>) -> Self {
3402        self.ocsp_result = Some(value.into());
3403        self
3404    }
3405
3406    /// Sets the optional `customData` field.
3407    #[must_use]
3408    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3409        self.custom_data = Some(value);
3410        self
3411    }
3412}
3413
3414impl Validate for GetCertificateStatusResponse {
3415    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3416        path.push_key("status");
3417        Validate::validate_at(&self.status, path, out);
3418        path.pop();
3419        path.push_key("statusInfo");
3420        if let Some(value) = &self.status_info {
3421            Validate::validate_at(value, path, out);
3422        }
3423        path.pop();
3424        path.push_key("ocspResult");
3425        if let Some(value) = &self.ocsp_result {
3426            validate::string(value.as_str(), None, Some(18000), path, out);
3427        }
3428        path.pop();
3429        path.push_key("customData");
3430        if let Some(value) = &self.custom_data {
3431            Validate::validate_at(value, path, out);
3432        }
3433        path.pop();
3434    }
3435}
3436
3437impl Sealed for GetCertificateStatusResponse {}
3438impl Response for GetCertificateStatusResponse {}
3439
3440/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3441#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3442pub struct GetChargingProfilesRequest {
3443    /// Reference identification that is to be used by the Charging Station in the &lt;&lt;reportchargingprofilesrequest, ReportChargingProfilesRequest&gt;&gt; when provided.
3444    #[serde(rename = "requestId")]
3445    #[serde(deserialize_with = "crate::types::integer::one")]
3446    pub request_id: i32,
3447    /// The `chargingProfile` member.
3448    #[serde(rename = "chargingProfile")]
3449    pub charging_profile: ChargingProfileCriterion,
3450    /// For which EVSE installed charging profiles SHALL be reported. If 0, only charging profiles installed on the Charging Station itself (the grid connection) SHALL be reported. If omitted, all installed charging profiles SHALL be reported. +
3451    /// Reported charging profiles SHALL match the criteria in field _chargingProfile_.
3452    #[serde(rename = "evseId")]
3453    #[serde(default, skip_serializing_if = "Option::is_none")]
3454    #[serde(deserialize_with = "crate::types::integer::option")]
3455    pub evse_id: Option<i32>,
3456    /// The `customData` member.
3457    #[serde(rename = "customData")]
3458    #[serde(default, skip_serializing_if = "Option::is_none")]
3459    pub custom_data: Option<crate::types::CustomData>,
3460}
3461
3462impl GetChargingProfilesRequest {
3463    /// Creates a `GetChargingProfilesRequest` from its required fields.
3464    #[must_use]
3465    pub fn new(request_id: i32, charging_profile: ChargingProfileCriterion) -> Self {
3466        Self {
3467            request_id,
3468            charging_profile,
3469            evse_id: None,
3470            custom_data: None,
3471        }
3472    }
3473
3474    /// Sets the optional `evseId` field.
3475    #[must_use]
3476    pub fn with_evse_id(mut self, value: i32) -> Self {
3477        self.evse_id = Some(value);
3478        self
3479    }
3480
3481    /// Sets the optional `customData` field.
3482    #[must_use]
3483    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3484        self.custom_data = Some(value);
3485        self
3486    }
3487}
3488
3489impl Validate for GetChargingProfilesRequest {
3490    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3491        path.push_key("chargingProfile");
3492        Validate::validate_at(&self.charging_profile, path, out);
3493        path.pop();
3494        path.push_key("evseId");
3495        if let Some(value) = &self.evse_id {
3496            validate::int_range(i64::from(*value), Some(0), None, path, out);
3497        }
3498        path.pop();
3499        path.push_key("customData");
3500        if let Some(value) = &self.custom_data {
3501            Validate::validate_at(value, path, out);
3502        }
3503        path.pop();
3504    }
3505}
3506
3507impl Sealed for GetChargingProfilesRequest {}
3508impl Request for GetChargingProfilesRequest {
3509    type Action = Action;
3510    const ACTION: Action = Action::GetChargingProfiles;
3511    const KIND: MessageKind = MessageKind::Call;
3512    const ORIGIN: Origin = Origin::Csms;
3513    type Response = GetChargingProfilesResponse;
3514}
3515
3516impl Confirmed for GetChargingProfilesRequest {}
3517
3518/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3519#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3520pub struct GetChargingProfilesResponse {
3521    /// The `status` member.
3522    pub status: GetChargingProfileStatus,
3523    /// The `statusInfo` member.
3524    #[serde(rename = "statusInfo")]
3525    #[serde(default, skip_serializing_if = "Option::is_none")]
3526    pub status_info: Option<StatusInfo>,
3527    /// The `customData` member.
3528    #[serde(rename = "customData")]
3529    #[serde(default, skip_serializing_if = "Option::is_none")]
3530    pub custom_data: Option<crate::types::CustomData>,
3531}
3532
3533impl GetChargingProfilesResponse {
3534    /// Creates a `GetChargingProfilesResponse` from its required fields.
3535    #[must_use]
3536    pub fn new(status: GetChargingProfileStatus) -> Self {
3537        Self {
3538            status,
3539            status_info: None,
3540            custom_data: None,
3541        }
3542    }
3543
3544    /// Sets the optional `statusInfo` field.
3545    #[must_use]
3546    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3547        self.status_info = Some(value);
3548        self
3549    }
3550
3551    /// Sets the optional `customData` field.
3552    #[must_use]
3553    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3554        self.custom_data = Some(value);
3555        self
3556    }
3557}
3558
3559impl Validate for GetChargingProfilesResponse {
3560    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3561        path.push_key("status");
3562        Validate::validate_at(&self.status, path, out);
3563        path.pop();
3564        path.push_key("statusInfo");
3565        if let Some(value) = &self.status_info {
3566            Validate::validate_at(value, path, out);
3567        }
3568        path.pop();
3569        path.push_key("customData");
3570        if let Some(value) = &self.custom_data {
3571            Validate::validate_at(value, path, out);
3572        }
3573        path.pop();
3574    }
3575}
3576
3577impl Sealed for GetChargingProfilesResponse {}
3578impl Response for GetChargingProfilesResponse {}
3579
3580/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3581#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3582pub struct GetCompositeScheduleRequest {
3583    /// Length of the requested schedule in seconds.
3584    #[serde(deserialize_with = "crate::types::integer::one")]
3585    pub duration: i32,
3586    /// The ID of the EVSE for which the schedule is requested. When evseid=0, the Charging Station will calculate the expected consumption for the grid connection.
3587    #[serde(rename = "evseId")]
3588    #[serde(deserialize_with = "crate::types::integer::one")]
3589    pub evse_id: i32,
3590    /// The `chargingRateUnit` member.
3591    #[serde(rename = "chargingRateUnit")]
3592    #[serde(default, skip_serializing_if = "Option::is_none")]
3593    pub charging_rate_unit: Option<ChargingRateUnit>,
3594    /// The `customData` member.
3595    #[serde(rename = "customData")]
3596    #[serde(default, skip_serializing_if = "Option::is_none")]
3597    pub custom_data: Option<crate::types::CustomData>,
3598}
3599
3600impl GetCompositeScheduleRequest {
3601    /// Creates a `GetCompositeScheduleRequest` from its required fields.
3602    #[must_use]
3603    pub fn new(duration: i32, evse_id: i32) -> Self {
3604        Self {
3605            duration,
3606            evse_id,
3607            charging_rate_unit: None,
3608            custom_data: None,
3609        }
3610    }
3611
3612    /// Sets the optional `chargingRateUnit` field.
3613    #[must_use]
3614    pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
3615        self.charging_rate_unit = Some(value);
3616        self
3617    }
3618
3619    /// Sets the optional `customData` field.
3620    #[must_use]
3621    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3622        self.custom_data = Some(value);
3623        self
3624    }
3625}
3626
3627impl Validate for GetCompositeScheduleRequest {
3628    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3629        path.push_key("evseId");
3630        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
3631        path.pop();
3632        path.push_key("chargingRateUnit");
3633        if let Some(value) = &self.charging_rate_unit {
3634            Validate::validate_at(value, path, out);
3635        }
3636        path.pop();
3637        path.push_key("customData");
3638        if let Some(value) = &self.custom_data {
3639            Validate::validate_at(value, path, out);
3640        }
3641        path.pop();
3642    }
3643}
3644
3645impl Sealed for GetCompositeScheduleRequest {}
3646impl Request for GetCompositeScheduleRequest {
3647    type Action = Action;
3648    const ACTION: Action = Action::GetCompositeSchedule;
3649    const KIND: MessageKind = MessageKind::Call;
3650    const ORIGIN: Origin = Origin::Csms;
3651    type Response = GetCompositeScheduleResponse;
3652}
3653
3654impl Confirmed for GetCompositeScheduleRequest {}
3655
3656/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3657#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3658pub struct GetCompositeScheduleResponse {
3659    /// The `status` member.
3660    pub status: GenericStatus,
3661    /// The `statusInfo` member.
3662    #[serde(rename = "statusInfo")]
3663    #[serde(default, skip_serializing_if = "Option::is_none")]
3664    pub status_info: Option<StatusInfo>,
3665    /// The `schedule` member.
3666    #[serde(default, skip_serializing_if = "Option::is_none")]
3667    pub schedule: Option<CompositeSchedule>,
3668    /// The `customData` member.
3669    #[serde(rename = "customData")]
3670    #[serde(default, skip_serializing_if = "Option::is_none")]
3671    pub custom_data: Option<crate::types::CustomData>,
3672}
3673
3674impl GetCompositeScheduleResponse {
3675    /// Creates a `GetCompositeScheduleResponse` from its required fields.
3676    #[must_use]
3677    pub fn new(status: GenericStatus) -> Self {
3678        Self {
3679            status,
3680            status_info: None,
3681            schedule: None,
3682            custom_data: None,
3683        }
3684    }
3685
3686    /// Sets the optional `statusInfo` field.
3687    #[must_use]
3688    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3689        self.status_info = Some(value);
3690        self
3691    }
3692
3693    /// Sets the optional `schedule` field.
3694    #[must_use]
3695    pub fn with_schedule(mut self, value: CompositeSchedule) -> Self {
3696        self.schedule = Some(value);
3697        self
3698    }
3699
3700    /// Sets the optional `customData` field.
3701    #[must_use]
3702    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3703        self.custom_data = Some(value);
3704        self
3705    }
3706}
3707
3708impl Validate for GetCompositeScheduleResponse {
3709    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3710        path.push_key("status");
3711        Validate::validate_at(&self.status, path, out);
3712        path.pop();
3713        path.push_key("statusInfo");
3714        if let Some(value) = &self.status_info {
3715            Validate::validate_at(value, path, out);
3716        }
3717        path.pop();
3718        path.push_key("schedule");
3719        if let Some(value) = &self.schedule {
3720            Validate::validate_at(value, path, out);
3721        }
3722        path.pop();
3723        path.push_key("customData");
3724        if let Some(value) = &self.custom_data {
3725            Validate::validate_at(value, path, out);
3726        }
3727        path.pop();
3728    }
3729}
3730
3731impl Sealed for GetCompositeScheduleResponse {}
3732impl Response for GetCompositeScheduleResponse {}
3733
3734/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
3735#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3736pub struct GetDERControlRequest {
3737    /// RequestId to be used in ReportDERControlRequest.
3738    #[serde(rename = "requestId")]
3739    #[serde(deserialize_with = "crate::types::integer::one")]
3740    pub request_id: i32,
3741    /// True: get a default DER control. False: get a scheduled control.
3742    #[serde(rename = "isDefault")]
3743    #[serde(default, skip_serializing_if = "Option::is_none")]
3744    pub is_default: Option<bool>,
3745    /// The `controlType` member.
3746    #[serde(rename = "controlType")]
3747    #[serde(default, skip_serializing_if = "Option::is_none")]
3748    pub control_type: Option<DERControl>,
3749    /// Id of setting to get. When omitted all settings for _controlType_ are retrieved.
3750    #[serde(rename = "controlId")]
3751    #[serde(default, skip_serializing_if = "Option::is_none")]
3752    pub control_id: Option<String>,
3753    /// The `customData` member.
3754    #[serde(rename = "customData")]
3755    #[serde(default, skip_serializing_if = "Option::is_none")]
3756    pub custom_data: Option<crate::types::CustomData>,
3757}
3758
3759impl GetDERControlRequest {
3760    /// Creates a `GetDERControlRequest` from its required fields.
3761    #[must_use]
3762    pub fn new(request_id: i32) -> Self {
3763        Self {
3764            request_id,
3765            is_default: None,
3766            control_type: None,
3767            control_id: None,
3768            custom_data: None,
3769        }
3770    }
3771
3772    /// Sets the optional `isDefault` field.
3773    #[must_use]
3774    pub fn with_is_default(mut self, value: bool) -> Self {
3775        self.is_default = Some(value);
3776        self
3777    }
3778
3779    /// Sets the optional `controlType` field.
3780    #[must_use]
3781    pub fn with_control_type(mut self, value: DERControl) -> Self {
3782        self.control_type = Some(value);
3783        self
3784    }
3785
3786    /// Sets the optional `controlId` field.
3787    #[must_use]
3788    pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
3789        self.control_id = Some(value.into());
3790        self
3791    }
3792
3793    /// Sets the optional `customData` field.
3794    #[must_use]
3795    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3796        self.custom_data = Some(value);
3797        self
3798    }
3799}
3800
3801impl Validate for GetDERControlRequest {
3802    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3803        path.push_key("controlType");
3804        if let Some(value) = &self.control_type {
3805            Validate::validate_at(value, path, out);
3806        }
3807        path.pop();
3808        path.push_key("controlId");
3809        if let Some(value) = &self.control_id {
3810            validate::string(value.as_str(), None, Some(36), path, out);
3811        }
3812        path.pop();
3813        path.push_key("customData");
3814        if let Some(value) = &self.custom_data {
3815            Validate::validate_at(value, path, out);
3816        }
3817        path.pop();
3818    }
3819}
3820
3821impl Sealed for GetDERControlRequest {}
3822impl Request for GetDERControlRequest {
3823    type Action = Action;
3824    const ACTION: Action = Action::GetDERControl;
3825    const KIND: MessageKind = MessageKind::Call;
3826    const ORIGIN: Origin = Origin::Csms;
3827    type Response = GetDERControlResponse;
3828}
3829
3830impl Confirmed for GetDERControlRequest {}
3831
3832/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
3833#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3834pub struct GetDERControlResponse {
3835    /// The `status` member.
3836    pub status: DERControlStatus,
3837    /// The `statusInfo` member.
3838    #[serde(rename = "statusInfo")]
3839    #[serde(default, skip_serializing_if = "Option::is_none")]
3840    pub status_info: Option<StatusInfo>,
3841    /// The `customData` member.
3842    #[serde(rename = "customData")]
3843    #[serde(default, skip_serializing_if = "Option::is_none")]
3844    pub custom_data: Option<crate::types::CustomData>,
3845}
3846
3847impl GetDERControlResponse {
3848    /// Creates a `GetDERControlResponse` from its required fields.
3849    #[must_use]
3850    pub fn new(status: DERControlStatus) -> Self {
3851        Self {
3852            status,
3853            status_info: None,
3854            custom_data: None,
3855        }
3856    }
3857
3858    /// Sets the optional `statusInfo` field.
3859    #[must_use]
3860    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3861        self.status_info = Some(value);
3862        self
3863    }
3864
3865    /// Sets the optional `customData` field.
3866    #[must_use]
3867    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3868        self.custom_data = Some(value);
3869        self
3870    }
3871}
3872
3873impl Validate for GetDERControlResponse {
3874    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3875        path.push_key("status");
3876        Validate::validate_at(&self.status, path, out);
3877        path.pop();
3878        path.push_key("statusInfo");
3879        if let Some(value) = &self.status_info {
3880            Validate::validate_at(value, path, out);
3881        }
3882        path.pop();
3883        path.push_key("customData");
3884        if let Some(value) = &self.custom_data {
3885            Validate::validate_at(value, path, out);
3886        }
3887        path.pop();
3888    }
3889}
3890
3891impl Sealed for GetDERControlResponse {}
3892impl Response for GetDERControlResponse {}
3893
3894/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
3895#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3896pub struct GetDisplayMessagesRequest {
3897    /// The Id of this request.
3898    #[serde(rename = "requestId")]
3899    #[serde(deserialize_with = "crate::types::integer::one")]
3900    pub request_id: i32,
3901    /// If provided the Charging Station shall return Display Messages of the given ids. This field SHALL NOT contain more ids than set in &lt;&lt;configkey-number-of-display-messages,NumberOfDisplayMessages.maxLimit&gt;&gt;
3902    #[serde(default, skip_serializing_if = "Option::is_none")]
3903    #[serde(deserialize_with = "crate::types::integer::option_list")]
3904    pub id: Option<Vec<i32>>,
3905    /// The `priority` member.
3906    #[serde(default, skip_serializing_if = "Option::is_none")]
3907    pub priority: Option<MessagePriority>,
3908    /// The `state` member.
3909    #[serde(default, skip_serializing_if = "Option::is_none")]
3910    pub state: Option<MessageState>,
3911    /// The `customData` member.
3912    #[serde(rename = "customData")]
3913    #[serde(default, skip_serializing_if = "Option::is_none")]
3914    pub custom_data: Option<crate::types::CustomData>,
3915}
3916
3917impl GetDisplayMessagesRequest {
3918    /// Creates a `GetDisplayMessagesRequest` from its required fields.
3919    #[must_use]
3920    pub fn new(request_id: i32) -> Self {
3921        Self {
3922            request_id,
3923            id: None,
3924            priority: None,
3925            state: None,
3926            custom_data: None,
3927        }
3928    }
3929
3930    /// Sets the optional `id` field.
3931    #[must_use]
3932    pub fn with_id(mut self, value: Vec<i32>) -> Self {
3933        self.id = Some(value);
3934        self
3935    }
3936
3937    /// Sets the optional `priority` field.
3938    #[must_use]
3939    pub fn with_priority(mut self, value: MessagePriority) -> Self {
3940        self.priority = Some(value);
3941        self
3942    }
3943
3944    /// Sets the optional `state` field.
3945    #[must_use]
3946    pub fn with_state(mut self, value: MessageState) -> Self {
3947        self.state = Some(value);
3948        self
3949    }
3950
3951    /// Sets the optional `customData` field.
3952    #[must_use]
3953    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3954        self.custom_data = Some(value);
3955        self
3956    }
3957}
3958
3959impl Validate for GetDisplayMessagesRequest {
3960    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3961        path.push_key("id");
3962        if let Some(value) = &self.id {
3963            validate::list_len(value.len(), Some(1), None, path, out);
3964            for (index, item) in value.iter().enumerate() {
3965                path.push_index(index);
3966                validate::int_range(i64::from(*item), Some(0), None, path, out);
3967                path.pop();
3968            }
3969        }
3970        path.pop();
3971        path.push_key("priority");
3972        if let Some(value) = &self.priority {
3973            Validate::validate_at(value, path, out);
3974        }
3975        path.pop();
3976        path.push_key("state");
3977        if let Some(value) = &self.state {
3978            Validate::validate_at(value, path, out);
3979        }
3980        path.pop();
3981        path.push_key("customData");
3982        if let Some(value) = &self.custom_data {
3983            Validate::validate_at(value, path, out);
3984        }
3985        path.pop();
3986    }
3987}
3988
3989impl Sealed for GetDisplayMessagesRequest {}
3990impl Request for GetDisplayMessagesRequest {
3991    type Action = Action;
3992    const ACTION: Action = Action::GetDisplayMessages;
3993    const KIND: MessageKind = MessageKind::Call;
3994    const ORIGIN: Origin = Origin::Csms;
3995    type Response = GetDisplayMessagesResponse;
3996}
3997
3998impl Confirmed for GetDisplayMessagesRequest {}
3999
4000/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
4001#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4002pub struct GetDisplayMessagesResponse {
4003    /// The `status` member.
4004    pub status: GetDisplayMessagesStatus,
4005    /// The `statusInfo` member.
4006    #[serde(rename = "statusInfo")]
4007    #[serde(default, skip_serializing_if = "Option::is_none")]
4008    pub status_info: Option<StatusInfo>,
4009    /// The `customData` member.
4010    #[serde(rename = "customData")]
4011    #[serde(default, skip_serializing_if = "Option::is_none")]
4012    pub custom_data: Option<crate::types::CustomData>,
4013}
4014
4015impl GetDisplayMessagesResponse {
4016    /// Creates a `GetDisplayMessagesResponse` from its required fields.
4017    #[must_use]
4018    pub fn new(status: GetDisplayMessagesStatus) -> Self {
4019        Self {
4020            status,
4021            status_info: None,
4022            custom_data: None,
4023        }
4024    }
4025
4026    /// Sets the optional `statusInfo` field.
4027    #[must_use]
4028    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4029        self.status_info = Some(value);
4030        self
4031    }
4032
4033    /// Sets the optional `customData` field.
4034    #[must_use]
4035    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4036        self.custom_data = Some(value);
4037        self
4038    }
4039}
4040
4041impl Validate for GetDisplayMessagesResponse {
4042    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4043        path.push_key("status");
4044        Validate::validate_at(&self.status, path, out);
4045        path.pop();
4046        path.push_key("statusInfo");
4047        if let Some(value) = &self.status_info {
4048            Validate::validate_at(value, path, out);
4049        }
4050        path.pop();
4051        path.push_key("customData");
4052        if let Some(value) = &self.custom_data {
4053            Validate::validate_at(value, path, out);
4054        }
4055        path.pop();
4056    }
4057}
4058
4059impl Sealed for GetDisplayMessagesResponse {}
4060impl Response for GetDisplayMessagesResponse {}
4061
4062/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
4063#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4064pub struct GetInstalledCertificateIdsRequest {
4065    /// Indicates the type of certificates requested. When omitted, all certificate types are requested.
4066    #[serde(rename = "certificateType")]
4067    #[serde(default, skip_serializing_if = "Option::is_none")]
4068    pub certificate_type: Option<Vec<GetCertificateIdUse>>,
4069    /// The `customData` member.
4070    #[serde(rename = "customData")]
4071    #[serde(default, skip_serializing_if = "Option::is_none")]
4072    pub custom_data: Option<crate::types::CustomData>,
4073}
4074
4075impl GetInstalledCertificateIdsRequest {
4076    /// Creates an empty `GetInstalledCertificateIdsRequest`. Every field of this type is optional.
4077    #[must_use]
4078    pub fn new() -> Self {
4079        Self::default()
4080    }
4081
4082    /// Sets the optional `certificateType` field.
4083    #[must_use]
4084    pub fn with_certificate_type(mut self, value: Vec<GetCertificateIdUse>) -> Self {
4085        self.certificate_type = Some(value);
4086        self
4087    }
4088
4089    /// Sets the optional `customData` field.
4090    #[must_use]
4091    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4092        self.custom_data = Some(value);
4093        self
4094    }
4095}
4096
4097impl Validate for GetInstalledCertificateIdsRequest {
4098    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4099        path.push_key("certificateType");
4100        if let Some(value) = &self.certificate_type {
4101            validate::list_len(value.len(), Some(1), None, path, out);
4102            for (index, item) in value.iter().enumerate() {
4103                path.push_index(index);
4104                Validate::validate_at(item, path, out);
4105                path.pop();
4106            }
4107        }
4108        path.pop();
4109        path.push_key("customData");
4110        if let Some(value) = &self.custom_data {
4111            Validate::validate_at(value, path, out);
4112        }
4113        path.pop();
4114    }
4115}
4116
4117impl Sealed for GetInstalledCertificateIdsRequest {}
4118impl Request for GetInstalledCertificateIdsRequest {
4119    type Action = Action;
4120    const ACTION: Action = Action::GetInstalledCertificateIds;
4121    const KIND: MessageKind = MessageKind::Call;
4122    const ORIGIN: Origin = Origin::Csms;
4123    type Response = GetInstalledCertificateIdsResponse;
4124}
4125
4126impl Confirmed for GetInstalledCertificateIdsRequest {}
4127
4128/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
4129#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4130pub struct GetInstalledCertificateIdsResponse {
4131    /// The `status` member.
4132    pub status: GetInstalledCertificateStatus,
4133    /// The `statusInfo` member.
4134    #[serde(rename = "statusInfo")]
4135    #[serde(default, skip_serializing_if = "Option::is_none")]
4136    pub status_info: Option<StatusInfo>,
4137    /// The `certificateHashDataChain` member.
4138    #[serde(rename = "certificateHashDataChain")]
4139    #[serde(default, skip_serializing_if = "Option::is_none")]
4140    pub certificate_hash_data_chain: Option<Vec<CertificateHashDataChain>>,
4141    /// The `customData` member.
4142    #[serde(rename = "customData")]
4143    #[serde(default, skip_serializing_if = "Option::is_none")]
4144    pub custom_data: Option<crate::types::CustomData>,
4145}
4146
4147impl GetInstalledCertificateIdsResponse {
4148    /// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
4149    #[must_use]
4150    pub fn new(status: GetInstalledCertificateStatus) -> Self {
4151        Self {
4152            status,
4153            status_info: None,
4154            certificate_hash_data_chain: None,
4155            custom_data: None,
4156        }
4157    }
4158
4159    /// Sets the optional `statusInfo` field.
4160    #[must_use]
4161    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4162        self.status_info = Some(value);
4163        self
4164    }
4165
4166    /// Sets the optional `certificateHashDataChain` field.
4167    #[must_use]
4168    pub fn with_certificate_hash_data_chain(
4169        mut self,
4170        value: Vec<CertificateHashDataChain>,
4171    ) -> Self {
4172        self.certificate_hash_data_chain = Some(value);
4173        self
4174    }
4175
4176    /// Sets the optional `customData` field.
4177    #[must_use]
4178    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4179        self.custom_data = Some(value);
4180        self
4181    }
4182}
4183
4184impl Validate for GetInstalledCertificateIdsResponse {
4185    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4186        path.push_key("status");
4187        Validate::validate_at(&self.status, path, out);
4188        path.pop();
4189        path.push_key("statusInfo");
4190        if let Some(value) = &self.status_info {
4191            Validate::validate_at(value, path, out);
4192        }
4193        path.pop();
4194        path.push_key("certificateHashDataChain");
4195        if let Some(value) = &self.certificate_hash_data_chain {
4196            validate::list_len(value.len(), Some(1), None, path, out);
4197            for (index, item) in value.iter().enumerate() {
4198                path.push_index(index);
4199                Validate::validate_at(item, path, out);
4200                path.pop();
4201            }
4202        }
4203        path.pop();
4204        path.push_key("customData");
4205        if let Some(value) = &self.custom_data {
4206            Validate::validate_at(value, path, out);
4207        }
4208        path.pop();
4209    }
4210}
4211
4212impl Sealed for GetInstalledCertificateIdsResponse {}
4213impl Response for GetInstalledCertificateIdsResponse {}
4214
4215/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
4216#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4217pub struct GetLocalListVersionRequest {
4218    /// The `customData` member.
4219    #[serde(rename = "customData")]
4220    #[serde(default, skip_serializing_if = "Option::is_none")]
4221    pub custom_data: Option<crate::types::CustomData>,
4222}
4223
4224impl GetLocalListVersionRequest {
4225    /// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
4226    #[must_use]
4227    pub fn new() -> Self {
4228        Self::default()
4229    }
4230
4231    /// Sets the optional `customData` field.
4232    #[must_use]
4233    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4234        self.custom_data = Some(value);
4235        self
4236    }
4237}
4238
4239impl Validate for GetLocalListVersionRequest {
4240    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4241        path.push_key("customData");
4242        if let Some(value) = &self.custom_data {
4243            Validate::validate_at(value, path, out);
4244        }
4245        path.pop();
4246    }
4247}
4248
4249impl Sealed for GetLocalListVersionRequest {}
4250impl Request for GetLocalListVersionRequest {
4251    type Action = Action;
4252    const ACTION: Action = Action::GetLocalListVersion;
4253    const KIND: MessageKind = MessageKind::Call;
4254    const ORIGIN: Origin = Origin::Csms;
4255    type Response = GetLocalListVersionResponse;
4256}
4257
4258impl Confirmed for GetLocalListVersionRequest {}
4259
4260/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
4261#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4262pub struct GetLocalListVersionResponse {
4263    /// This contains the current version number of the local authorization list in the Charging Station.
4264    #[serde(rename = "versionNumber")]
4265    #[serde(deserialize_with = "crate::types::integer::one")]
4266    pub version_number: i32,
4267    /// The `customData` member.
4268    #[serde(rename = "customData")]
4269    #[serde(default, skip_serializing_if = "Option::is_none")]
4270    pub custom_data: Option<crate::types::CustomData>,
4271}
4272
4273impl GetLocalListVersionResponse {
4274    /// Creates a `GetLocalListVersionResponse` from its required fields.
4275    #[must_use]
4276    pub fn new(version_number: i32) -> Self {
4277        Self {
4278            version_number,
4279            custom_data: None,
4280        }
4281    }
4282
4283    /// Sets the optional `customData` field.
4284    #[must_use]
4285    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4286        self.custom_data = Some(value);
4287        self
4288    }
4289}
4290
4291impl Validate for GetLocalListVersionResponse {
4292    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4293        path.push_key("customData");
4294        if let Some(value) = &self.custom_data {
4295            Validate::validate_at(value, path, out);
4296        }
4297        path.pop();
4298    }
4299}
4300
4301impl Sealed for GetLocalListVersionResponse {}
4302impl Response for GetLocalListVersionResponse {}
4303
4304/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4305#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4306pub struct GetLogRequest {
4307    /// The `log` member.
4308    pub log: LogParameters,
4309    /// The `logType` member.
4310    #[serde(rename = "logType")]
4311    pub log_type: Log,
4312    /// The Id of this request
4313    #[serde(rename = "requestId")]
4314    #[serde(deserialize_with = "crate::types::integer::one")]
4315    pub request_id: i32,
4316    /// This specifies how many times the Charging Station must retry to upload the log before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry. If the value is 0, it means: no retries.
4317    #[serde(default, skip_serializing_if = "Option::is_none")]
4318    #[serde(deserialize_with = "crate::types::integer::option")]
4319    pub retries: Option<i32>,
4320    /// The interval in seconds after which a retry may be attempted. If this field is not present, it is left to Charging Station to decide how long to wait between attempts.
4321    #[serde(rename = "retryInterval")]
4322    #[serde(default, skip_serializing_if = "Option::is_none")]
4323    #[serde(deserialize_with = "crate::types::integer::option")]
4324    pub retry_interval: Option<i32>,
4325    /// The `customData` member.
4326    #[serde(rename = "customData")]
4327    #[serde(default, skip_serializing_if = "Option::is_none")]
4328    pub custom_data: Option<crate::types::CustomData>,
4329}
4330
4331impl GetLogRequest {
4332    /// Creates a `GetLogRequest` from its required fields.
4333    #[must_use]
4334    pub fn new(log: LogParameters, log_type: Log, request_id: i32) -> Self {
4335        Self {
4336            log,
4337            log_type,
4338            request_id,
4339            retries: None,
4340            retry_interval: None,
4341            custom_data: None,
4342        }
4343    }
4344
4345    /// Sets the optional `retries` field.
4346    #[must_use]
4347    pub fn with_retries(mut self, value: i32) -> Self {
4348        self.retries = Some(value);
4349        self
4350    }
4351
4352    /// Sets the optional `retryInterval` field.
4353    #[must_use]
4354    pub fn with_retry_interval(mut self, value: i32) -> Self {
4355        self.retry_interval = Some(value);
4356        self
4357    }
4358
4359    /// Sets the optional `customData` field.
4360    #[must_use]
4361    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4362        self.custom_data = Some(value);
4363        self
4364    }
4365}
4366
4367impl Validate for GetLogRequest {
4368    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4369        path.push_key("log");
4370        Validate::validate_at(&self.log, path, out);
4371        path.pop();
4372        path.push_key("logType");
4373        Validate::validate_at(&self.log_type, path, out);
4374        path.pop();
4375        path.push_key("retries");
4376        if let Some(value) = &self.retries {
4377            validate::int_range(i64::from(*value), Some(0), None, path, out);
4378        }
4379        path.pop();
4380        path.push_key("customData");
4381        if let Some(value) = &self.custom_data {
4382            Validate::validate_at(value, path, out);
4383        }
4384        path.pop();
4385    }
4386}
4387
4388impl Sealed for GetLogRequest {}
4389impl Request for GetLogRequest {
4390    type Action = Action;
4391    const ACTION: Action = Action::GetLog;
4392    const KIND: MessageKind = MessageKind::Call;
4393    const ORIGIN: Origin = Origin::Csms;
4394    type Response = GetLogResponse;
4395}
4396
4397impl Confirmed for GetLogRequest {}
4398
4399/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4400#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4401pub struct GetLogResponse {
4402    /// The `status` member.
4403    pub status: LogStatus,
4404    /// The `statusInfo` member.
4405    #[serde(rename = "statusInfo")]
4406    #[serde(default, skip_serializing_if = "Option::is_none")]
4407    pub status_info: Option<StatusInfo>,
4408    /// This contains the name of the log file that will be uploaded. This field is not present when no logging information is available.
4409    #[serde(default, skip_serializing_if = "Option::is_none")]
4410    pub filename: Option<String>,
4411    /// The `customData` member.
4412    #[serde(rename = "customData")]
4413    #[serde(default, skip_serializing_if = "Option::is_none")]
4414    pub custom_data: Option<crate::types::CustomData>,
4415}
4416
4417impl GetLogResponse {
4418    /// Creates a `GetLogResponse` from its required fields.
4419    #[must_use]
4420    pub fn new(status: LogStatus) -> Self {
4421        Self {
4422            status,
4423            status_info: None,
4424            filename: None,
4425            custom_data: None,
4426        }
4427    }
4428
4429    /// Sets the optional `statusInfo` field.
4430    #[must_use]
4431    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4432        self.status_info = Some(value);
4433        self
4434    }
4435
4436    /// Sets the optional `filename` field.
4437    #[must_use]
4438    pub fn with_filename(mut self, value: impl Into<String>) -> Self {
4439        self.filename = Some(value.into());
4440        self
4441    }
4442
4443    /// Sets the optional `customData` field.
4444    #[must_use]
4445    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4446        self.custom_data = Some(value);
4447        self
4448    }
4449}
4450
4451impl Validate for GetLogResponse {
4452    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4453        path.push_key("status");
4454        Validate::validate_at(&self.status, path, out);
4455        path.pop();
4456        path.push_key("statusInfo");
4457        if let Some(value) = &self.status_info {
4458            Validate::validate_at(value, path, out);
4459        }
4460        path.pop();
4461        path.push_key("filename");
4462        if let Some(value) = &self.filename {
4463            validate::string(value.as_str(), None, Some(255), path, out);
4464        }
4465        path.pop();
4466        path.push_key("customData");
4467        if let Some(value) = &self.custom_data {
4468            Validate::validate_at(value, path, out);
4469        }
4470        path.pop();
4471    }
4472}
4473
4474impl Sealed for GetLogResponse {}
4475impl Response for GetLogResponse {}
4476
4477/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4478#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4479pub struct GetMonitoringReportRequest {
4480    /// The Id of the request.
4481    #[serde(rename = "requestId")]
4482    #[serde(deserialize_with = "crate::types::integer::one")]
4483    pub request_id: i32,
4484    /// The `componentVariable` member.
4485    #[serde(rename = "componentVariable")]
4486    #[serde(default, skip_serializing_if = "Option::is_none")]
4487    pub component_variable: Option<Vec<ComponentVariable>>,
4488    /// This field contains criteria for components for which a monitoring report is requested
4489    #[serde(rename = "monitoringCriteria")]
4490    #[serde(default, skip_serializing_if = "Option::is_none")]
4491    pub monitoring_criteria: Option<Vec<MonitoringCriterion>>,
4492    /// The `customData` member.
4493    #[serde(rename = "customData")]
4494    #[serde(default, skip_serializing_if = "Option::is_none")]
4495    pub custom_data: Option<crate::types::CustomData>,
4496}
4497
4498impl GetMonitoringReportRequest {
4499    /// Creates a `GetMonitoringReportRequest` from its required fields.
4500    #[must_use]
4501    pub fn new(request_id: i32) -> Self {
4502        Self {
4503            request_id,
4504            component_variable: None,
4505            monitoring_criteria: None,
4506            custom_data: None,
4507        }
4508    }
4509
4510    /// Sets the optional `componentVariable` field.
4511    #[must_use]
4512    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
4513        self.component_variable = Some(value);
4514        self
4515    }
4516
4517    /// Sets the optional `monitoringCriteria` field.
4518    #[must_use]
4519    pub fn with_monitoring_criteria(mut self, value: Vec<MonitoringCriterion>) -> Self {
4520        self.monitoring_criteria = Some(value);
4521        self
4522    }
4523
4524    /// Sets the optional `customData` field.
4525    #[must_use]
4526    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4527        self.custom_data = Some(value);
4528        self
4529    }
4530}
4531
4532impl Validate for GetMonitoringReportRequest {
4533    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4534        path.push_key("componentVariable");
4535        if let Some(value) = &self.component_variable {
4536            validate::list_len(value.len(), Some(1), None, path, out);
4537            for (index, item) in value.iter().enumerate() {
4538                path.push_index(index);
4539                Validate::validate_at(item, path, out);
4540                path.pop();
4541            }
4542        }
4543        path.pop();
4544        path.push_key("monitoringCriteria");
4545        if let Some(value) = &self.monitoring_criteria {
4546            validate::list_len(value.len(), Some(1), Some(3), path, out);
4547            for (index, item) in value.iter().enumerate() {
4548                path.push_index(index);
4549                Validate::validate_at(item, path, out);
4550                path.pop();
4551            }
4552        }
4553        path.pop();
4554        path.push_key("customData");
4555        if let Some(value) = &self.custom_data {
4556            Validate::validate_at(value, path, out);
4557        }
4558        path.pop();
4559    }
4560}
4561
4562impl Sealed for GetMonitoringReportRequest {}
4563impl Request for GetMonitoringReportRequest {
4564    type Action = Action;
4565    const ACTION: Action = Action::GetMonitoringReport;
4566    const KIND: MessageKind = MessageKind::Call;
4567    const ORIGIN: Origin = Origin::Csms;
4568    type Response = GetMonitoringReportResponse;
4569}
4570
4571impl Confirmed for GetMonitoringReportRequest {}
4572
4573/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4574#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4575pub struct GetMonitoringReportResponse {
4576    /// The `status` member.
4577    pub status: GenericDeviceModelStatus,
4578    /// The `statusInfo` member.
4579    #[serde(rename = "statusInfo")]
4580    #[serde(default, skip_serializing_if = "Option::is_none")]
4581    pub status_info: Option<StatusInfo>,
4582    /// The `customData` member.
4583    #[serde(rename = "customData")]
4584    #[serde(default, skip_serializing_if = "Option::is_none")]
4585    pub custom_data: Option<crate::types::CustomData>,
4586}
4587
4588impl GetMonitoringReportResponse {
4589    /// Creates a `GetMonitoringReportResponse` from its required fields.
4590    #[must_use]
4591    pub fn new(status: GenericDeviceModelStatus) -> Self {
4592        Self {
4593            status,
4594            status_info: None,
4595            custom_data: None,
4596        }
4597    }
4598
4599    /// Sets the optional `statusInfo` field.
4600    #[must_use]
4601    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4602        self.status_info = Some(value);
4603        self
4604    }
4605
4606    /// Sets the optional `customData` field.
4607    #[must_use]
4608    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4609        self.custom_data = Some(value);
4610        self
4611    }
4612}
4613
4614impl Validate for GetMonitoringReportResponse {
4615    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4616        path.push_key("status");
4617        Validate::validate_at(&self.status, path, out);
4618        path.pop();
4619        path.push_key("statusInfo");
4620        if let Some(value) = &self.status_info {
4621            Validate::validate_at(value, path, out);
4622        }
4623        path.pop();
4624        path.push_key("customData");
4625        if let Some(value) = &self.custom_data {
4626            Validate::validate_at(value, path, out);
4627        }
4628        path.pop();
4629    }
4630}
4631
4632impl Sealed for GetMonitoringReportResponse {}
4633impl Response for GetMonitoringReportResponse {}
4634
4635/// This message is empty. It has no fields.
4636///
4637/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4638#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4639pub struct GetPeriodicEventStreamRequest {
4640    /// The `customData` member.
4641    #[serde(rename = "customData")]
4642    #[serde(default, skip_serializing_if = "Option::is_none")]
4643    pub custom_data: Option<crate::types::CustomData>,
4644}
4645
4646impl GetPeriodicEventStreamRequest {
4647    /// Creates an empty `GetPeriodicEventStreamRequest`. Every field of this type is optional.
4648    #[must_use]
4649    pub fn new() -> Self {
4650        Self::default()
4651    }
4652
4653    /// Sets the optional `customData` field.
4654    #[must_use]
4655    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4656        self.custom_data = Some(value);
4657        self
4658    }
4659}
4660
4661impl Validate for GetPeriodicEventStreamRequest {
4662    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4663        path.push_key("customData");
4664        if let Some(value) = &self.custom_data {
4665            Validate::validate_at(value, path, out);
4666        }
4667        path.pop();
4668    }
4669}
4670
4671impl Sealed for GetPeriodicEventStreamRequest {}
4672impl Request for GetPeriodicEventStreamRequest {
4673    type Action = Action;
4674    const ACTION: Action = Action::GetPeriodicEventStream;
4675    const KIND: MessageKind = MessageKind::Call;
4676    const ORIGIN: Origin = Origin::Csms;
4677    type Response = GetPeriodicEventStreamResponse;
4678}
4679
4680impl Confirmed for GetPeriodicEventStreamRequest {}
4681
4682/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4683#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4684pub struct GetPeriodicEventStreamResponse {
4685    /// The `constantStreamData` member.
4686    #[serde(rename = "constantStreamData")]
4687    #[serde(default, skip_serializing_if = "Option::is_none")]
4688    pub constant_stream_data: Option<Vec<ConstantStreamData>>,
4689    /// The `customData` member.
4690    #[serde(rename = "customData")]
4691    #[serde(default, skip_serializing_if = "Option::is_none")]
4692    pub custom_data: Option<crate::types::CustomData>,
4693}
4694
4695impl GetPeriodicEventStreamResponse {
4696    /// Creates an empty `GetPeriodicEventStreamResponse`. Every field of this type is optional.
4697    #[must_use]
4698    pub fn new() -> Self {
4699        Self::default()
4700    }
4701
4702    /// Sets the optional `constantStreamData` field.
4703    #[must_use]
4704    pub fn with_constant_stream_data(mut self, value: Vec<ConstantStreamData>) -> Self {
4705        self.constant_stream_data = Some(value);
4706        self
4707    }
4708
4709    /// Sets the optional `customData` field.
4710    #[must_use]
4711    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4712        self.custom_data = Some(value);
4713        self
4714    }
4715}
4716
4717impl Validate for GetPeriodicEventStreamResponse {
4718    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4719        path.push_key("constantStreamData");
4720        if let Some(value) = &self.constant_stream_data {
4721            validate::list_len(value.len(), Some(1), None, path, out);
4722            for (index, item) in value.iter().enumerate() {
4723                path.push_index(index);
4724                Validate::validate_at(item, path, out);
4725                path.pop();
4726            }
4727        }
4728        path.pop();
4729        path.push_key("customData");
4730        if let Some(value) = &self.custom_data {
4731            Validate::validate_at(value, path, out);
4732        }
4733        path.pop();
4734    }
4735}
4736
4737impl Sealed for GetPeriodicEventStreamResponse {}
4738impl Response for GetPeriodicEventStreamResponse {}
4739
4740/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
4741#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4742pub struct GetReportRequest {
4743    /// The Id of the request.
4744    #[serde(rename = "requestId")]
4745    #[serde(deserialize_with = "crate::types::integer::one")]
4746    pub request_id: i32,
4747    /// The `componentVariable` member.
4748    #[serde(rename = "componentVariable")]
4749    #[serde(default, skip_serializing_if = "Option::is_none")]
4750    pub component_variable: Option<Vec<ComponentVariable>>,
4751    /// This field contains criteria for components for which a report is requested
4752    #[serde(rename = "componentCriteria")]
4753    #[serde(default, skip_serializing_if = "Option::is_none")]
4754    pub component_criteria: Option<Vec<ComponentCriterion>>,
4755    /// The `customData` member.
4756    #[serde(rename = "customData")]
4757    #[serde(default, skip_serializing_if = "Option::is_none")]
4758    pub custom_data: Option<crate::types::CustomData>,
4759}
4760
4761impl GetReportRequest {
4762    /// Creates a `GetReportRequest` from its required fields.
4763    #[must_use]
4764    pub fn new(request_id: i32) -> Self {
4765        Self {
4766            request_id,
4767            component_variable: None,
4768            component_criteria: None,
4769            custom_data: None,
4770        }
4771    }
4772
4773    /// Sets the optional `componentVariable` field.
4774    #[must_use]
4775    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
4776        self.component_variable = Some(value);
4777        self
4778    }
4779
4780    /// Sets the optional `componentCriteria` field.
4781    #[must_use]
4782    pub fn with_component_criteria(mut self, value: Vec<ComponentCriterion>) -> Self {
4783        self.component_criteria = Some(value);
4784        self
4785    }
4786
4787    /// Sets the optional `customData` field.
4788    #[must_use]
4789    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4790        self.custom_data = Some(value);
4791        self
4792    }
4793}
4794
4795impl Validate for GetReportRequest {
4796    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4797        path.push_key("componentVariable");
4798        if let Some(value) = &self.component_variable {
4799            validate::list_len(value.len(), Some(1), None, path, out);
4800            for (index, item) in value.iter().enumerate() {
4801                path.push_index(index);
4802                Validate::validate_at(item, path, out);
4803                path.pop();
4804            }
4805        }
4806        path.pop();
4807        path.push_key("componentCriteria");
4808        if let Some(value) = &self.component_criteria {
4809            validate::list_len(value.len(), Some(1), Some(4), path, out);
4810            for (index, item) in value.iter().enumerate() {
4811                path.push_index(index);
4812                Validate::validate_at(item, path, out);
4813                path.pop();
4814            }
4815        }
4816        path.pop();
4817        path.push_key("customData");
4818        if let Some(value) = &self.custom_data {
4819            Validate::validate_at(value, path, out);
4820        }
4821        path.pop();
4822    }
4823}
4824
4825impl Sealed for GetReportRequest {}
4826impl Request for GetReportRequest {
4827    type Action = Action;
4828    const ACTION: Action = Action::GetReport;
4829    const KIND: MessageKind = MessageKind::Call;
4830    const ORIGIN: Origin = Origin::Csms;
4831    type Response = GetReportResponse;
4832}
4833
4834impl Confirmed for GetReportRequest {}
4835
4836/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
4837#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4838pub struct GetReportResponse {
4839    /// The `status` member.
4840    pub status: GenericDeviceModelStatus,
4841    /// The `statusInfo` member.
4842    #[serde(rename = "statusInfo")]
4843    #[serde(default, skip_serializing_if = "Option::is_none")]
4844    pub status_info: Option<StatusInfo>,
4845    /// The `customData` member.
4846    #[serde(rename = "customData")]
4847    #[serde(default, skip_serializing_if = "Option::is_none")]
4848    pub custom_data: Option<crate::types::CustomData>,
4849}
4850
4851impl GetReportResponse {
4852    /// Creates a `GetReportResponse` from its required fields.
4853    #[must_use]
4854    pub fn new(status: GenericDeviceModelStatus) -> Self {
4855        Self {
4856            status,
4857            status_info: None,
4858            custom_data: None,
4859        }
4860    }
4861
4862    /// Sets the optional `statusInfo` field.
4863    #[must_use]
4864    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4865        self.status_info = Some(value);
4866        self
4867    }
4868
4869    /// Sets the optional `customData` field.
4870    #[must_use]
4871    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4872        self.custom_data = Some(value);
4873        self
4874    }
4875}
4876
4877impl Validate for GetReportResponse {
4878    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4879        path.push_key("status");
4880        Validate::validate_at(&self.status, path, out);
4881        path.pop();
4882        path.push_key("statusInfo");
4883        if let Some(value) = &self.status_info {
4884            Validate::validate_at(value, path, out);
4885        }
4886        path.pop();
4887        path.push_key("customData");
4888        if let Some(value) = &self.custom_data {
4889            Validate::validate_at(value, path, out);
4890        }
4891        path.pop();
4892    }
4893}
4894
4895impl Sealed for GetReportResponse {}
4896impl Response for GetReportResponse {}
4897
4898/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
4899#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4900pub struct GetTariffsRequest {
4901    /// EVSE id to get tariff from. When _evseId_ = 0, this gets tariffs from all EVSEs.
4902    #[serde(rename = "evseId")]
4903    #[serde(deserialize_with = "crate::types::integer::one")]
4904    pub evse_id: i32,
4905    /// The `customData` member.
4906    #[serde(rename = "customData")]
4907    #[serde(default, skip_serializing_if = "Option::is_none")]
4908    pub custom_data: Option<crate::types::CustomData>,
4909}
4910
4911impl GetTariffsRequest {
4912    /// Creates a `GetTariffsRequest` from its required fields.
4913    #[must_use]
4914    pub fn new(evse_id: i32) -> Self {
4915        Self {
4916            evse_id,
4917            custom_data: None,
4918        }
4919    }
4920
4921    /// Sets the optional `customData` field.
4922    #[must_use]
4923    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4924        self.custom_data = Some(value);
4925        self
4926    }
4927}
4928
4929impl Validate for GetTariffsRequest {
4930    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4931        path.push_key("evseId");
4932        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
4933        path.pop();
4934        path.push_key("customData");
4935        if let Some(value) = &self.custom_data {
4936            Validate::validate_at(value, path, out);
4937        }
4938        path.pop();
4939    }
4940}
4941
4942impl Sealed for GetTariffsRequest {}
4943impl Request for GetTariffsRequest {
4944    type Action = Action;
4945    const ACTION: Action = Action::GetTariffs;
4946    const KIND: MessageKind = MessageKind::Call;
4947    const ORIGIN: Origin = Origin::Csms;
4948    type Response = GetTariffsResponse;
4949}
4950
4951impl Confirmed for GetTariffsRequest {}
4952
4953/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
4954#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4955pub struct GetTariffsResponse {
4956    /// The `status` member.
4957    pub status: TariffGetStatus,
4958    /// The `statusInfo` member.
4959    #[serde(rename = "statusInfo")]
4960    #[serde(default, skip_serializing_if = "Option::is_none")]
4961    pub status_info: Option<StatusInfo>,
4962    /// The `tariffAssignments` member.
4963    #[serde(rename = "tariffAssignments")]
4964    #[serde(default, skip_serializing_if = "Option::is_none")]
4965    pub tariff_assignments: Option<Vec<TariffAssignment>>,
4966    /// The `customData` member.
4967    #[serde(rename = "customData")]
4968    #[serde(default, skip_serializing_if = "Option::is_none")]
4969    pub custom_data: Option<crate::types::CustomData>,
4970}
4971
4972impl GetTariffsResponse {
4973    /// Creates a `GetTariffsResponse` from its required fields.
4974    #[must_use]
4975    pub fn new(status: TariffGetStatus) -> Self {
4976        Self {
4977            status,
4978            status_info: None,
4979            tariff_assignments: None,
4980            custom_data: None,
4981        }
4982    }
4983
4984    /// Sets the optional `statusInfo` field.
4985    #[must_use]
4986    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4987        self.status_info = Some(value);
4988        self
4989    }
4990
4991    /// Sets the optional `tariffAssignments` field.
4992    #[must_use]
4993    pub fn with_tariff_assignments(mut self, value: Vec<TariffAssignment>) -> Self {
4994        self.tariff_assignments = Some(value);
4995        self
4996    }
4997
4998    /// Sets the optional `customData` field.
4999    #[must_use]
5000    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5001        self.custom_data = Some(value);
5002        self
5003    }
5004}
5005
5006impl Validate for GetTariffsResponse {
5007    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5008        path.push_key("status");
5009        Validate::validate_at(&self.status, path, out);
5010        path.pop();
5011        path.push_key("statusInfo");
5012        if let Some(value) = &self.status_info {
5013            Validate::validate_at(value, path, out);
5014        }
5015        path.pop();
5016        path.push_key("tariffAssignments");
5017        if let Some(value) = &self.tariff_assignments {
5018            validate::list_len(value.len(), Some(1), None, path, out);
5019            for (index, item) in value.iter().enumerate() {
5020                path.push_index(index);
5021                Validate::validate_at(item, path, out);
5022                path.pop();
5023            }
5024        }
5025        path.pop();
5026        path.push_key("customData");
5027        if let Some(value) = &self.custom_data {
5028            Validate::validate_at(value, path, out);
5029        }
5030        path.pop();
5031    }
5032}
5033
5034impl Sealed for GetTariffsResponse {}
5035impl Response for GetTariffsResponse {}
5036
5037/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
5038#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5039pub struct GetTransactionStatusRequest {
5040    /// The Id of the transaction for which the status is requested.
5041    #[serde(rename = "transactionId")]
5042    #[serde(default, skip_serializing_if = "Option::is_none")]
5043    pub transaction_id: Option<String>,
5044    /// The `customData` member.
5045    #[serde(rename = "customData")]
5046    #[serde(default, skip_serializing_if = "Option::is_none")]
5047    pub custom_data: Option<crate::types::CustomData>,
5048}
5049
5050impl GetTransactionStatusRequest {
5051    /// Creates an empty `GetTransactionStatusRequest`. Every field of this type is optional.
5052    #[must_use]
5053    pub fn new() -> Self {
5054        Self::default()
5055    }
5056
5057    /// Sets the optional `transactionId` field.
5058    #[must_use]
5059    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5060        self.transaction_id = Some(value.into());
5061        self
5062    }
5063
5064    /// Sets the optional `customData` field.
5065    #[must_use]
5066    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5067        self.custom_data = Some(value);
5068        self
5069    }
5070}
5071
5072impl Validate for GetTransactionStatusRequest {
5073    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5074        path.push_key("transactionId");
5075        if let Some(value) = &self.transaction_id {
5076            validate::string(value.as_str(), None, Some(36), path, out);
5077        }
5078        path.pop();
5079        path.push_key("customData");
5080        if let Some(value) = &self.custom_data {
5081            Validate::validate_at(value, path, out);
5082        }
5083        path.pop();
5084    }
5085}
5086
5087impl Sealed for GetTransactionStatusRequest {}
5088impl Request for GetTransactionStatusRequest {
5089    type Action = Action;
5090    const ACTION: Action = Action::GetTransactionStatus;
5091    const KIND: MessageKind = MessageKind::Call;
5092    const ORIGIN: Origin = Origin::Csms;
5093    type Response = GetTransactionStatusResponse;
5094}
5095
5096impl Confirmed for GetTransactionStatusRequest {}
5097
5098/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
5099#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5100pub struct GetTransactionStatusResponse {
5101    /// Whether there are still message to be delivered.
5102    #[serde(rename = "messagesInQueue")]
5103    pub messages_in_queue: bool,
5104    /// Whether the transaction is still ongoing.
5105    #[serde(rename = "ongoingIndicator")]
5106    #[serde(default, skip_serializing_if = "Option::is_none")]
5107    pub ongoing_indicator: Option<bool>,
5108    /// The `customData` member.
5109    #[serde(rename = "customData")]
5110    #[serde(default, skip_serializing_if = "Option::is_none")]
5111    pub custom_data: Option<crate::types::CustomData>,
5112}
5113
5114impl GetTransactionStatusResponse {
5115    /// Creates a `GetTransactionStatusResponse` from its required fields.
5116    #[must_use]
5117    pub fn new(messages_in_queue: bool) -> Self {
5118        Self {
5119            messages_in_queue,
5120            ongoing_indicator: None,
5121            custom_data: None,
5122        }
5123    }
5124
5125    /// Sets the optional `ongoingIndicator` field.
5126    #[must_use]
5127    pub fn with_ongoing_indicator(mut self, value: bool) -> Self {
5128        self.ongoing_indicator = Some(value);
5129        self
5130    }
5131
5132    /// Sets the optional `customData` field.
5133    #[must_use]
5134    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5135        self.custom_data = Some(value);
5136        self
5137    }
5138}
5139
5140impl Validate for GetTransactionStatusResponse {
5141    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5142        path.push_key("customData");
5143        if let Some(value) = &self.custom_data {
5144            Validate::validate_at(value, path, out);
5145        }
5146        path.pop();
5147    }
5148}
5149
5150impl Sealed for GetTransactionStatusResponse {}
5151impl Response for GetTransactionStatusResponse {}
5152
5153/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
5154#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5155pub struct GetVariablesRequest {
5156    /// The `getVariableData` member.
5157    #[serde(rename = "getVariableData")]
5158    pub get_variable_data: Vec<GetVariableData>,
5159    /// The `customData` member.
5160    #[serde(rename = "customData")]
5161    #[serde(default, skip_serializing_if = "Option::is_none")]
5162    pub custom_data: Option<crate::types::CustomData>,
5163}
5164
5165impl GetVariablesRequest {
5166    /// Creates a `GetVariablesRequest` from its required fields.
5167    #[must_use]
5168    pub fn new(get_variable_data: Vec<GetVariableData>) -> Self {
5169        Self {
5170            get_variable_data,
5171            custom_data: None,
5172        }
5173    }
5174
5175    /// Sets the optional `customData` field.
5176    #[must_use]
5177    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5178        self.custom_data = Some(value);
5179        self
5180    }
5181}
5182
5183impl Validate for GetVariablesRequest {
5184    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5185        path.push_key("getVariableData");
5186        validate::list_len(self.get_variable_data.len(), Some(1), None, path, out);
5187        for (index, item) in self.get_variable_data.iter().enumerate() {
5188            path.push_index(index);
5189            Validate::validate_at(item, path, out);
5190            path.pop();
5191        }
5192        path.pop();
5193        path.push_key("customData");
5194        if let Some(value) = &self.custom_data {
5195            Validate::validate_at(value, path, out);
5196        }
5197        path.pop();
5198    }
5199}
5200
5201impl Sealed for GetVariablesRequest {}
5202impl Request for GetVariablesRequest {
5203    type Action = Action;
5204    const ACTION: Action = Action::GetVariables;
5205    const KIND: MessageKind = MessageKind::Call;
5206    const ORIGIN: Origin = Origin::Csms;
5207    type Response = GetVariablesResponse;
5208}
5209
5210impl Confirmed for GetVariablesRequest {}
5211
5212/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
5213#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5214pub struct GetVariablesResponse {
5215    /// The `getVariableResult` member.
5216    #[serde(rename = "getVariableResult")]
5217    pub get_variable_result: Vec<GetVariableResult>,
5218    /// The `customData` member.
5219    #[serde(rename = "customData")]
5220    #[serde(default, skip_serializing_if = "Option::is_none")]
5221    pub custom_data: Option<crate::types::CustomData>,
5222}
5223
5224impl GetVariablesResponse {
5225    /// Creates a `GetVariablesResponse` from its required fields.
5226    #[must_use]
5227    pub fn new(get_variable_result: Vec<GetVariableResult>) -> Self {
5228        Self {
5229            get_variable_result,
5230            custom_data: None,
5231        }
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 GetVariablesResponse {
5243    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5244        path.push_key("getVariableResult");
5245        validate::list_len(self.get_variable_result.len(), Some(1), None, path, out);
5246        for (index, item) in self.get_variable_result.iter().enumerate() {
5247            path.push_index(index);
5248            Validate::validate_at(item, path, out);
5249            path.pop();
5250        }
5251        path.pop();
5252        path.push_key("customData");
5253        if let Some(value) = &self.custom_data {
5254            Validate::validate_at(value, path, out);
5255        }
5256        path.pop();
5257    }
5258}
5259
5260impl Sealed for GetVariablesResponse {}
5261impl Response for GetVariablesResponse {}
5262
5263/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
5264#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5265pub struct HeartbeatRequest {
5266    /// The `customData` member.
5267    #[serde(rename = "customData")]
5268    #[serde(default, skip_serializing_if = "Option::is_none")]
5269    pub custom_data: Option<crate::types::CustomData>,
5270}
5271
5272impl HeartbeatRequest {
5273    /// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
5274    #[must_use]
5275    pub fn new() -> Self {
5276        Self::default()
5277    }
5278
5279    /// Sets the optional `customData` field.
5280    #[must_use]
5281    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5282        self.custom_data = Some(value);
5283        self
5284    }
5285}
5286
5287impl Validate for HeartbeatRequest {
5288    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5289        path.push_key("customData");
5290        if let Some(value) = &self.custom_data {
5291            Validate::validate_at(value, path, out);
5292        }
5293        path.pop();
5294    }
5295}
5296
5297impl Sealed for HeartbeatRequest {}
5298impl Request for HeartbeatRequest {
5299    type Action = Action;
5300    const ACTION: Action = Action::Heartbeat;
5301    const KIND: MessageKind = MessageKind::Call;
5302    const ORIGIN: Origin = Origin::ChargingStation;
5303    type Response = HeartbeatResponse;
5304}
5305
5306impl Confirmed for HeartbeatRequest {}
5307
5308/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
5309#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5310pub struct HeartbeatResponse {
5311    /// Contains the current time of the CSMS.
5312    #[serde(rename = "currentTime")]
5313    pub current_time: crate::types::DateTime,
5314    /// The `customData` member.
5315    #[serde(rename = "customData")]
5316    #[serde(default, skip_serializing_if = "Option::is_none")]
5317    pub custom_data: Option<crate::types::CustomData>,
5318}
5319
5320impl HeartbeatResponse {
5321    /// Creates a `HeartbeatResponse` from its required fields.
5322    #[must_use]
5323    pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
5324        Self {
5325            current_time: current_time.into(),
5326            custom_data: None,
5327        }
5328    }
5329
5330    /// Sets the optional `customData` field.
5331    #[must_use]
5332    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5333        self.custom_data = Some(value);
5334        self
5335    }
5336}
5337
5338impl Validate for HeartbeatResponse {
5339    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5340        path.push_key("customData");
5341        if let Some(value) = &self.custom_data {
5342            Validate::validate_at(value, path, out);
5343        }
5344        path.pop();
5345    }
5346}
5347
5348impl Sealed for HeartbeatResponse {}
5349impl Response for HeartbeatResponse {}
5350
5351/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
5352#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5353pub struct InstallCertificateRequest {
5354    /// The `certificateType` member.
5355    #[serde(rename = "certificateType")]
5356    pub certificate_type: InstallCertificateUse,
5357    /// A PEM encoded X.509 certificate.
5358    pub certificate: String,
5359    /// The `customData` member.
5360    #[serde(rename = "customData")]
5361    #[serde(default, skip_serializing_if = "Option::is_none")]
5362    pub custom_data: Option<crate::types::CustomData>,
5363}
5364
5365impl InstallCertificateRequest {
5366    /// Creates a `InstallCertificateRequest` from its required fields.
5367    #[must_use]
5368    pub fn new(certificate_type: InstallCertificateUse, certificate: impl Into<String>) -> Self {
5369        Self {
5370            certificate_type,
5371            certificate: certificate.into(),
5372            custom_data: None,
5373        }
5374    }
5375
5376    /// Sets the optional `customData` field.
5377    #[must_use]
5378    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5379        self.custom_data = Some(value);
5380        self
5381    }
5382}
5383
5384impl Validate for InstallCertificateRequest {
5385    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5386        path.push_key("certificateType");
5387        Validate::validate_at(&self.certificate_type, path, out);
5388        path.pop();
5389        path.push_key("certificate");
5390        validate::string(self.certificate.as_str(), None, Some(10000), path, out);
5391        path.pop();
5392        path.push_key("customData");
5393        if let Some(value) = &self.custom_data {
5394            Validate::validate_at(value, path, out);
5395        }
5396        path.pop();
5397    }
5398}
5399
5400impl Sealed for InstallCertificateRequest {}
5401impl Request for InstallCertificateRequest {
5402    type Action = Action;
5403    const ACTION: Action = Action::InstallCertificate;
5404    const KIND: MessageKind = MessageKind::Call;
5405    const ORIGIN: Origin = Origin::Csms;
5406    type Response = InstallCertificateResponse;
5407}
5408
5409impl Confirmed for InstallCertificateRequest {}
5410
5411/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
5412#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5413pub struct InstallCertificateResponse {
5414    /// The `status` member.
5415    pub status: InstallCertificateStatus,
5416    /// The `statusInfo` member.
5417    #[serde(rename = "statusInfo")]
5418    #[serde(default, skip_serializing_if = "Option::is_none")]
5419    pub status_info: Option<StatusInfo>,
5420    /// The `customData` member.
5421    #[serde(rename = "customData")]
5422    #[serde(default, skip_serializing_if = "Option::is_none")]
5423    pub custom_data: Option<crate::types::CustomData>,
5424}
5425
5426impl InstallCertificateResponse {
5427    /// Creates a `InstallCertificateResponse` from its required fields.
5428    #[must_use]
5429    pub fn new(status: InstallCertificateStatus) -> Self {
5430        Self {
5431            status,
5432            status_info: None,
5433            custom_data: None,
5434        }
5435    }
5436
5437    /// Sets the optional `statusInfo` field.
5438    #[must_use]
5439    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5440        self.status_info = Some(value);
5441        self
5442    }
5443
5444    /// Sets the optional `customData` field.
5445    #[must_use]
5446    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5447        self.custom_data = Some(value);
5448        self
5449    }
5450}
5451
5452impl Validate for InstallCertificateResponse {
5453    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5454        path.push_key("status");
5455        Validate::validate_at(&self.status, path, out);
5456        path.pop();
5457        path.push_key("statusInfo");
5458        if let Some(value) = &self.status_info {
5459            Validate::validate_at(value, path, out);
5460        }
5461        path.pop();
5462        path.push_key("customData");
5463        if let Some(value) = &self.custom_data {
5464            Validate::validate_at(value, path, out);
5465        }
5466        path.pop();
5467    }
5468}
5469
5470impl Sealed for InstallCertificateResponse {}
5471impl Response for InstallCertificateResponse {}
5472
5473/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5474#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5475pub struct LogStatusNotificationRequest {
5476    /// The `status` member.
5477    pub status: UploadLogStatus,
5478    /// The request id that was provided in GetLogRequest that started this log upload. This field is mandatory,
5479    /// unless the message was triggered by a TriggerMessageRequest AND there is no log upload ongoing.
5480    #[serde(rename = "requestId")]
5481    #[serde(default, skip_serializing_if = "Option::is_none")]
5482    #[serde(deserialize_with = "crate::types::integer::option")]
5483    pub request_id: Option<i32>,
5484    /// The `statusInfo` member.
5485    #[serde(rename = "statusInfo")]
5486    #[serde(default, skip_serializing_if = "Option::is_none")]
5487    pub status_info: Option<StatusInfo>,
5488    /// The `customData` member.
5489    #[serde(rename = "customData")]
5490    #[serde(default, skip_serializing_if = "Option::is_none")]
5491    pub custom_data: Option<crate::types::CustomData>,
5492}
5493
5494impl LogStatusNotificationRequest {
5495    /// Creates a `LogStatusNotificationRequest` from its required fields.
5496    #[must_use]
5497    pub fn new(status: UploadLogStatus) -> Self {
5498        Self {
5499            status,
5500            request_id: None,
5501            status_info: None,
5502            custom_data: None,
5503        }
5504    }
5505
5506    /// Sets the optional `requestId` field.
5507    #[must_use]
5508    pub fn with_request_id(mut self, value: i32) -> Self {
5509        self.request_id = Some(value);
5510        self
5511    }
5512
5513    /// Sets the optional `statusInfo` field.
5514    #[must_use]
5515    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5516        self.status_info = Some(value);
5517        self
5518    }
5519
5520    /// Sets the optional `customData` field.
5521    #[must_use]
5522    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5523        self.custom_data = Some(value);
5524        self
5525    }
5526}
5527
5528impl Validate for LogStatusNotificationRequest {
5529    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5530        path.push_key("status");
5531        Validate::validate_at(&self.status, path, out);
5532        path.pop();
5533        path.push_key("statusInfo");
5534        if let Some(value) = &self.status_info {
5535            Validate::validate_at(value, path, out);
5536        }
5537        path.pop();
5538        path.push_key("customData");
5539        if let Some(value) = &self.custom_data {
5540            Validate::validate_at(value, path, out);
5541        }
5542        path.pop();
5543    }
5544}
5545
5546impl Sealed for LogStatusNotificationRequest {}
5547impl Request for LogStatusNotificationRequest {
5548    type Action = Action;
5549    const ACTION: Action = Action::LogStatusNotification;
5550    const KIND: MessageKind = MessageKind::Call;
5551    const ORIGIN: Origin = Origin::ChargingStation;
5552    type Response = LogStatusNotificationResponse;
5553}
5554
5555impl Confirmed for LogStatusNotificationRequest {}
5556
5557/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5558#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5559pub struct LogStatusNotificationResponse {
5560    /// The `customData` member.
5561    #[serde(rename = "customData")]
5562    #[serde(default, skip_serializing_if = "Option::is_none")]
5563    pub custom_data: Option<crate::types::CustomData>,
5564}
5565
5566impl LogStatusNotificationResponse {
5567    /// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
5568    #[must_use]
5569    pub fn new() -> Self {
5570        Self::default()
5571    }
5572
5573    /// Sets the optional `customData` field.
5574    #[must_use]
5575    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5576        self.custom_data = Some(value);
5577        self
5578    }
5579}
5580
5581impl Validate for LogStatusNotificationResponse {
5582    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5583        path.push_key("customData");
5584        if let Some(value) = &self.custom_data {
5585            Validate::validate_at(value, path, out);
5586        }
5587        path.pop();
5588    }
5589}
5590
5591impl Sealed for LogStatusNotificationResponse {}
5592impl Response for LogStatusNotificationResponse {}
5593
5594/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
5595#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5596pub struct MeterValuesRequest {
5597    /// This contains a number (&gt;0) designating an EVSE of the Charging Station. ‘0’ (zero) is used to designate the main power meter.
5598    #[serde(rename = "evseId")]
5599    #[serde(deserialize_with = "crate::types::integer::one")]
5600    pub evse_id: i32,
5601    /// The `meterValue` member.
5602    #[serde(rename = "meterValue")]
5603    pub meter_value: Vec<MeterValue>,
5604    /// The `customData` member.
5605    #[serde(rename = "customData")]
5606    #[serde(default, skip_serializing_if = "Option::is_none")]
5607    pub custom_data: Option<crate::types::CustomData>,
5608}
5609
5610impl MeterValuesRequest {
5611    /// Creates a `MeterValuesRequest` from its required fields.
5612    #[must_use]
5613    pub fn new(evse_id: i32, meter_value: Vec<MeterValue>) -> Self {
5614        Self {
5615            evse_id,
5616            meter_value,
5617            custom_data: None,
5618        }
5619    }
5620
5621    /// Sets the optional `customData` field.
5622    #[must_use]
5623    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5624        self.custom_data = Some(value);
5625        self
5626    }
5627}
5628
5629impl Validate for MeterValuesRequest {
5630    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5631        path.push_key("evseId");
5632        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
5633        path.pop();
5634        path.push_key("meterValue");
5635        validate::list_len(self.meter_value.len(), Some(1), None, path, out);
5636        for (index, item) in self.meter_value.iter().enumerate() {
5637            path.push_index(index);
5638            Validate::validate_at(item, path, out);
5639            path.pop();
5640        }
5641        path.pop();
5642        path.push_key("customData");
5643        if let Some(value) = &self.custom_data {
5644            Validate::validate_at(value, path, out);
5645        }
5646        path.pop();
5647    }
5648}
5649
5650impl Sealed for MeterValuesRequest {}
5651impl Request for MeterValuesRequest {
5652    type Action = Action;
5653    const ACTION: Action = Action::MeterValues;
5654    const KIND: MessageKind = MessageKind::Call;
5655    const ORIGIN: Origin = Origin::ChargingStation;
5656    type Response = MeterValuesResponse;
5657}
5658
5659impl Confirmed for MeterValuesRequest {}
5660
5661/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
5662#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5663pub struct MeterValuesResponse {
5664    /// The `customData` member.
5665    #[serde(rename = "customData")]
5666    #[serde(default, skip_serializing_if = "Option::is_none")]
5667    pub custom_data: Option<crate::types::CustomData>,
5668}
5669
5670impl MeterValuesResponse {
5671    /// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
5672    #[must_use]
5673    pub fn new() -> Self {
5674        Self::default()
5675    }
5676
5677    /// Sets the optional `customData` field.
5678    #[must_use]
5679    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5680        self.custom_data = Some(value);
5681        self
5682    }
5683}
5684
5685impl Validate for MeterValuesResponse {
5686    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5687        path.push_key("customData");
5688        if let Some(value) = &self.custom_data {
5689            Validate::validate_at(value, path, out);
5690        }
5691        path.pop();
5692    }
5693}
5694
5695impl Sealed for MeterValuesResponse {}
5696impl Response for MeterValuesResponse {}
5697
5698/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
5699#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5700pub struct NotifyAllowedEnergyTransferRequest {
5701    /// The transaction for which the allowed energy transfer is allowed.
5702    #[serde(rename = "transactionId")]
5703    pub transaction_id: String,
5704    /// Modes of energy transfer that are accepted by CSMS.
5705    #[serde(rename = "allowedEnergyTransfer")]
5706    pub allowed_energy_transfer: Vec<EnergyTransferMode>,
5707    /// The `customData` member.
5708    #[serde(rename = "customData")]
5709    #[serde(default, skip_serializing_if = "Option::is_none")]
5710    pub custom_data: Option<crate::types::CustomData>,
5711}
5712
5713impl NotifyAllowedEnergyTransferRequest {
5714    /// Creates a `NotifyAllowedEnergyTransferRequest` from its required fields.
5715    #[must_use]
5716    pub fn new(
5717        transaction_id: impl Into<String>,
5718        allowed_energy_transfer: Vec<EnergyTransferMode>,
5719    ) -> Self {
5720        Self {
5721            transaction_id: transaction_id.into(),
5722            allowed_energy_transfer,
5723            custom_data: None,
5724        }
5725    }
5726
5727    /// Sets the optional `customData` field.
5728    #[must_use]
5729    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5730        self.custom_data = Some(value);
5731        self
5732    }
5733}
5734
5735impl Validate for NotifyAllowedEnergyTransferRequest {
5736    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5737        path.push_key("transactionId");
5738        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
5739        path.pop();
5740        path.push_key("allowedEnergyTransfer");
5741        validate::list_len(self.allowed_energy_transfer.len(), Some(1), None, path, out);
5742        for (index, item) in self.allowed_energy_transfer.iter().enumerate() {
5743            path.push_index(index);
5744            Validate::validate_at(item, path, out);
5745            path.pop();
5746        }
5747        path.pop();
5748        path.push_key("customData");
5749        if let Some(value) = &self.custom_data {
5750            Validate::validate_at(value, path, out);
5751        }
5752        path.pop();
5753    }
5754}
5755
5756impl Sealed for NotifyAllowedEnergyTransferRequest {}
5757impl Request for NotifyAllowedEnergyTransferRequest {
5758    type Action = Action;
5759    const ACTION: Action = Action::NotifyAllowedEnergyTransfer;
5760    const KIND: MessageKind = MessageKind::Call;
5761    const ORIGIN: Origin = Origin::Csms;
5762    type Response = NotifyAllowedEnergyTransferResponse;
5763}
5764
5765impl Confirmed for NotifyAllowedEnergyTransferRequest {}
5766
5767/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
5768#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5769pub struct NotifyAllowedEnergyTransferResponse {
5770    /// The `status` member.
5771    pub status: NotifyAllowedEnergyTransferStatus,
5772    /// The `statusInfo` member.
5773    #[serde(rename = "statusInfo")]
5774    #[serde(default, skip_serializing_if = "Option::is_none")]
5775    pub status_info: Option<StatusInfo>,
5776    /// The `customData` member.
5777    #[serde(rename = "customData")]
5778    #[serde(default, skip_serializing_if = "Option::is_none")]
5779    pub custom_data: Option<crate::types::CustomData>,
5780}
5781
5782impl NotifyAllowedEnergyTransferResponse {
5783    /// Creates a `NotifyAllowedEnergyTransferResponse` from its required fields.
5784    #[must_use]
5785    pub fn new(status: NotifyAllowedEnergyTransferStatus) -> Self {
5786        Self {
5787            status,
5788            status_info: None,
5789            custom_data: None,
5790        }
5791    }
5792
5793    /// Sets the optional `statusInfo` field.
5794    #[must_use]
5795    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5796        self.status_info = Some(value);
5797        self
5798    }
5799
5800    /// Sets the optional `customData` field.
5801    #[must_use]
5802    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5803        self.custom_data = Some(value);
5804        self
5805    }
5806}
5807
5808impl Validate for NotifyAllowedEnergyTransferResponse {
5809    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5810        path.push_key("status");
5811        Validate::validate_at(&self.status, path, out);
5812        path.pop();
5813        path.push_key("statusInfo");
5814        if let Some(value) = &self.status_info {
5815            Validate::validate_at(value, path, out);
5816        }
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
5826impl Sealed for NotifyAllowedEnergyTransferResponse {}
5827impl Response for NotifyAllowedEnergyTransferResponse {}
5828
5829/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5830#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5831pub struct NotifyChargingLimitRequest {
5832    /// The `chargingLimit` member.
5833    #[serde(rename = "chargingLimit")]
5834    pub charging_limit: ChargingLimit,
5835    /// The `chargingSchedule` member.
5836    #[serde(rename = "chargingSchedule")]
5837    #[serde(default, skip_serializing_if = "Option::is_none")]
5838    pub charging_schedule: Option<Vec<ChargingSchedule>>,
5839    /// The EVSE to which the charging limit is set. If absent or when zero, it applies to the entire Charging Station.
5840    #[serde(rename = "evseId")]
5841    #[serde(default, skip_serializing_if = "Option::is_none")]
5842    #[serde(deserialize_with = "crate::types::integer::option")]
5843    pub evse_id: Option<i32>,
5844    /// The `customData` member.
5845    #[serde(rename = "customData")]
5846    #[serde(default, skip_serializing_if = "Option::is_none")]
5847    pub custom_data: Option<crate::types::CustomData>,
5848}
5849
5850impl NotifyChargingLimitRequest {
5851    /// Creates a `NotifyChargingLimitRequest` from its required fields.
5852    #[must_use]
5853    pub fn new(charging_limit: ChargingLimit) -> Self {
5854        Self {
5855            charging_limit,
5856            charging_schedule: None,
5857            evse_id: None,
5858            custom_data: None,
5859        }
5860    }
5861
5862    /// Sets the optional `chargingSchedule` field.
5863    #[must_use]
5864    pub fn with_charging_schedule(mut self, value: Vec<ChargingSchedule>) -> Self {
5865        self.charging_schedule = Some(value);
5866        self
5867    }
5868
5869    /// Sets the optional `evseId` field.
5870    #[must_use]
5871    pub fn with_evse_id(mut self, value: i32) -> Self {
5872        self.evse_id = Some(value);
5873        self
5874    }
5875
5876    /// Sets the optional `customData` field.
5877    #[must_use]
5878    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5879        self.custom_data = Some(value);
5880        self
5881    }
5882}
5883
5884impl Validate for NotifyChargingLimitRequest {
5885    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5886        path.push_key("chargingLimit");
5887        Validate::validate_at(&self.charging_limit, path, out);
5888        path.pop();
5889        path.push_key("chargingSchedule");
5890        if let Some(value) = &self.charging_schedule {
5891            validate::list_len(value.len(), Some(1), None, path, out);
5892            for (index, item) in value.iter().enumerate() {
5893                path.push_index(index);
5894                Validate::validate_at(item, path, out);
5895                path.pop();
5896            }
5897        }
5898        path.pop();
5899        path.push_key("evseId");
5900        if let Some(value) = &self.evse_id {
5901            validate::int_range(i64::from(*value), Some(0), None, path, out);
5902        }
5903        path.pop();
5904        path.push_key("customData");
5905        if let Some(value) = &self.custom_data {
5906            Validate::validate_at(value, path, out);
5907        }
5908        path.pop();
5909    }
5910}
5911
5912impl Sealed for NotifyChargingLimitRequest {}
5913impl Request for NotifyChargingLimitRequest {
5914    type Action = Action;
5915    const ACTION: Action = Action::NotifyChargingLimit;
5916    const KIND: MessageKind = MessageKind::Call;
5917    const ORIGIN: Origin = Origin::ChargingStation;
5918    type Response = NotifyChargingLimitResponse;
5919}
5920
5921impl Confirmed for NotifyChargingLimitRequest {}
5922
5923/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5924#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5925pub struct NotifyChargingLimitResponse {
5926    /// The `customData` member.
5927    #[serde(rename = "customData")]
5928    #[serde(default, skip_serializing_if = "Option::is_none")]
5929    pub custom_data: Option<crate::types::CustomData>,
5930}
5931
5932impl NotifyChargingLimitResponse {
5933    /// Creates an empty `NotifyChargingLimitResponse`. Every field of this type is optional.
5934    #[must_use]
5935    pub fn new() -> Self {
5936        Self::default()
5937    }
5938
5939    /// Sets the optional `customData` field.
5940    #[must_use]
5941    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5942        self.custom_data = Some(value);
5943        self
5944    }
5945}
5946
5947impl Validate for NotifyChargingLimitResponse {
5948    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5949        path.push_key("customData");
5950        if let Some(value) = &self.custom_data {
5951            Validate::validate_at(value, path, out);
5952        }
5953        path.pop();
5954    }
5955}
5956
5957impl Sealed for NotifyChargingLimitResponse {}
5958impl Response for NotifyChargingLimitResponse {}
5959
5960/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5961#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5962pub struct NotifyCustomerInformationRequest {
5963    /// (Part of) the requested data. No format specified in which the data is returned. Should be human readable.
5964    pub data: String,
5965    /// Sequence number of this message. First message starts at 0.
5966    #[serde(rename = "seqNo")]
5967    #[serde(deserialize_with = "crate::types::integer::one")]
5968    pub seq_no: i32,
5969    ///  Timestamp of the moment this message was generated at the Charging Station.
5970    #[serde(rename = "generatedAt")]
5971    pub generated_at: crate::types::DateTime,
5972    /// The Id of the request.
5973    #[serde(rename = "requestId")]
5974    #[serde(deserialize_with = "crate::types::integer::one")]
5975    pub request_id: i32,
5976    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
5977    /// Schema default: `false`.
5978    #[serde(default, skip_serializing_if = "Option::is_none")]
5979    pub tbc: Option<bool>,
5980    /// The `customData` member.
5981    #[serde(rename = "customData")]
5982    #[serde(default, skip_serializing_if = "Option::is_none")]
5983    pub custom_data: Option<crate::types::CustomData>,
5984}
5985
5986impl NotifyCustomerInformationRequest {
5987    /// Creates a `NotifyCustomerInformationRequest` from its required fields.
5988    #[must_use]
5989    pub fn new(
5990        data: impl Into<String>,
5991        seq_no: i32,
5992        generated_at: impl Into<crate::types::DateTime>,
5993        request_id: i32,
5994    ) -> Self {
5995        Self {
5996            data: data.into(),
5997            seq_no,
5998            generated_at: generated_at.into(),
5999            request_id,
6000            tbc: None,
6001            custom_data: None,
6002        }
6003    }
6004
6005    /// Sets the optional `tbc` field.
6006    #[must_use]
6007    pub fn with_tbc(mut self, value: bool) -> Self {
6008        self.tbc = Some(value);
6009        self
6010    }
6011
6012    /// Sets the optional `customData` field.
6013    #[must_use]
6014    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6015        self.custom_data = Some(value);
6016        self
6017    }
6018}
6019
6020impl Validate for NotifyCustomerInformationRequest {
6021    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6022        path.push_key("data");
6023        validate::string(self.data.as_str(), None, Some(512), path, out);
6024        path.pop();
6025        path.push_key("seqNo");
6026        validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
6027        path.pop();
6028        path.push_key("requestId");
6029        validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
6030        path.pop();
6031        path.push_key("customData");
6032        if let Some(value) = &self.custom_data {
6033            Validate::validate_at(value, path, out);
6034        }
6035        path.pop();
6036    }
6037}
6038
6039impl Sealed for NotifyCustomerInformationRequest {}
6040impl Request for NotifyCustomerInformationRequest {
6041    type Action = Action;
6042    const ACTION: Action = Action::NotifyCustomerInformation;
6043    const KIND: MessageKind = MessageKind::Call;
6044    const ORIGIN: Origin = Origin::ChargingStation;
6045    type Response = NotifyCustomerInformationResponse;
6046}
6047
6048impl Confirmed for NotifyCustomerInformationRequest {}
6049
6050/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6051#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6052pub struct NotifyCustomerInformationResponse {
6053    /// The `customData` member.
6054    #[serde(rename = "customData")]
6055    #[serde(default, skip_serializing_if = "Option::is_none")]
6056    pub custom_data: Option<crate::types::CustomData>,
6057}
6058
6059impl NotifyCustomerInformationResponse {
6060    /// Creates an empty `NotifyCustomerInformationResponse`. Every field of this type is optional.
6061    #[must_use]
6062    pub fn new() -> Self {
6063        Self::default()
6064    }
6065
6066    /// Sets the optional `customData` field.
6067    #[must_use]
6068    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6069        self.custom_data = Some(value);
6070        self
6071    }
6072}
6073
6074impl Validate for NotifyCustomerInformationResponse {
6075    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6076        path.push_key("customData");
6077        if let Some(value) = &self.custom_data {
6078            Validate::validate_at(value, path, out);
6079        }
6080        path.pop();
6081    }
6082}
6083
6084impl Sealed for NotifyCustomerInformationResponse {}
6085impl Response for NotifyCustomerInformationResponse {}
6086
6087/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6088#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6089pub struct NotifyDERAlarmRequest {
6090    /// The `controlType` member.
6091    #[serde(rename = "controlType")]
6092    pub control_type: DERControl,
6093    /// Time of start or end of alarm.
6094    pub timestamp: crate::types::DateTime,
6095    /// The `gridEventFault` member.
6096    #[serde(rename = "gridEventFault")]
6097    #[serde(default, skip_serializing_if = "Option::is_none")]
6098    pub grid_event_fault: Option<GridEventFault>,
6099    /// True when error condition has ended.
6100    /// Absent or false when alarm has started.
6101    #[serde(rename = "alarmEnded")]
6102    #[serde(default, skip_serializing_if = "Option::is_none")]
6103    pub alarm_ended: Option<bool>,
6104    /// Optional info provided by EV.
6105    #[serde(rename = "extraInfo")]
6106    #[serde(default, skip_serializing_if = "Option::is_none")]
6107    pub extra_info: Option<String>,
6108    /// The `customData` member.
6109    #[serde(rename = "customData")]
6110    #[serde(default, skip_serializing_if = "Option::is_none")]
6111    pub custom_data: Option<crate::types::CustomData>,
6112}
6113
6114impl NotifyDERAlarmRequest {
6115    /// Creates a `NotifyDERAlarmRequest` from its required fields.
6116    #[must_use]
6117    pub fn new(control_type: DERControl, timestamp: impl Into<crate::types::DateTime>) -> Self {
6118        Self {
6119            control_type,
6120            timestamp: timestamp.into(),
6121            grid_event_fault: None,
6122            alarm_ended: None,
6123            extra_info: None,
6124            custom_data: None,
6125        }
6126    }
6127
6128    /// Sets the optional `gridEventFault` field.
6129    #[must_use]
6130    pub fn with_grid_event_fault(mut self, value: GridEventFault) -> Self {
6131        self.grid_event_fault = Some(value);
6132        self
6133    }
6134
6135    /// Sets the optional `alarmEnded` field.
6136    #[must_use]
6137    pub fn with_alarm_ended(mut self, value: bool) -> Self {
6138        self.alarm_ended = Some(value);
6139        self
6140    }
6141
6142    /// Sets the optional `extraInfo` field.
6143    #[must_use]
6144    pub fn with_extra_info(mut self, value: impl Into<String>) -> Self {
6145        self.extra_info = Some(value.into());
6146        self
6147    }
6148
6149    /// Sets the optional `customData` field.
6150    #[must_use]
6151    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6152        self.custom_data = Some(value);
6153        self
6154    }
6155}
6156
6157impl Validate for NotifyDERAlarmRequest {
6158    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6159        path.push_key("controlType");
6160        Validate::validate_at(&self.control_type, path, out);
6161        path.pop();
6162        path.push_key("gridEventFault");
6163        if let Some(value) = &self.grid_event_fault {
6164            Validate::validate_at(value, path, out);
6165        }
6166        path.pop();
6167        path.push_key("extraInfo");
6168        if let Some(value) = &self.extra_info {
6169            validate::string(value.as_str(), None, Some(200), path, out);
6170        }
6171        path.pop();
6172        path.push_key("customData");
6173        if let Some(value) = &self.custom_data {
6174            Validate::validate_at(value, path, out);
6175        }
6176        path.pop();
6177    }
6178}
6179
6180impl Sealed for NotifyDERAlarmRequest {}
6181impl Request for NotifyDERAlarmRequest {
6182    type Action = Action;
6183    const ACTION: Action = Action::NotifyDERAlarm;
6184    const KIND: MessageKind = MessageKind::Call;
6185    const ORIGIN: Origin = Origin::ChargingStation;
6186    type Response = NotifyDERAlarmResponse;
6187}
6188
6189impl Confirmed for NotifyDERAlarmRequest {}
6190
6191/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6192#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6193pub struct NotifyDERAlarmResponse {
6194    /// The `customData` member.
6195    #[serde(rename = "customData")]
6196    #[serde(default, skip_serializing_if = "Option::is_none")]
6197    pub custom_data: Option<crate::types::CustomData>,
6198}
6199
6200impl NotifyDERAlarmResponse {
6201    /// Creates an empty `NotifyDERAlarmResponse`. Every field of this type is optional.
6202    #[must_use]
6203    pub fn new() -> Self {
6204        Self::default()
6205    }
6206
6207    /// Sets the optional `customData` field.
6208    #[must_use]
6209    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6210        self.custom_data = Some(value);
6211        self
6212    }
6213}
6214
6215impl Validate for NotifyDERAlarmResponse {
6216    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6217        path.push_key("customData");
6218        if let Some(value) = &self.custom_data {
6219            Validate::validate_at(value, path, out);
6220        }
6221        path.pop();
6222    }
6223}
6224
6225impl Sealed for NotifyDERAlarmResponse {}
6226impl Response for NotifyDERAlarmResponse {}
6227
6228/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6229#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6230pub struct NotifyDERStartStopRequest {
6231    /// Id of the started or stopped DER control.
6232    /// Corresponds to the _controlId_ of the SetDERControlRequest.
6233    #[serde(rename = "controlId")]
6234    pub control_id: String,
6235    /// True if DER control has started. False if it has ended.
6236    pub started: bool,
6237    /// Time of start or end of event.
6238    pub timestamp: crate::types::DateTime,
6239    /// List of controlIds that are superseded as a result of this control starting.
6240    #[serde(rename = "supersededIds")]
6241    #[serde(default, skip_serializing_if = "Option::is_none")]
6242    pub superseded_ids: Option<Vec<String>>,
6243    /// The `customData` member.
6244    #[serde(rename = "customData")]
6245    #[serde(default, skip_serializing_if = "Option::is_none")]
6246    pub custom_data: Option<crate::types::CustomData>,
6247}
6248
6249impl NotifyDERStartStopRequest {
6250    /// Creates a `NotifyDERStartStopRequest` from its required fields.
6251    #[must_use]
6252    pub fn new(
6253        control_id: impl Into<String>,
6254        started: bool,
6255        timestamp: impl Into<crate::types::DateTime>,
6256    ) -> Self {
6257        Self {
6258            control_id: control_id.into(),
6259            started,
6260            timestamp: timestamp.into(),
6261            superseded_ids: None,
6262            custom_data: None,
6263        }
6264    }
6265
6266    /// Sets the optional `supersededIds` field.
6267    #[must_use]
6268    pub fn with_superseded_ids(
6269        mut self,
6270        value: impl IntoIterator<Item = impl Into<String>>,
6271    ) -> Self {
6272        self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
6273        self
6274    }
6275
6276    /// Sets the optional `customData` field.
6277    #[must_use]
6278    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6279        self.custom_data = Some(value);
6280        self
6281    }
6282}
6283
6284impl Validate for NotifyDERStartStopRequest {
6285    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6286        path.push_key("controlId");
6287        validate::string(self.control_id.as_str(), None, Some(36), path, out);
6288        path.pop();
6289        path.push_key("supersededIds");
6290        if let Some(value) = &self.superseded_ids {
6291            validate::list_len(value.len(), Some(1), Some(24), path, out);
6292            for (index, item) in value.iter().enumerate() {
6293                path.push_index(index);
6294                validate::string(item.as_str(), None, Some(36), path, out);
6295                path.pop();
6296            }
6297        }
6298        path.pop();
6299        path.push_key("customData");
6300        if let Some(value) = &self.custom_data {
6301            Validate::validate_at(value, path, out);
6302        }
6303        path.pop();
6304    }
6305}
6306
6307impl Sealed for NotifyDERStartStopRequest {}
6308impl Request for NotifyDERStartStopRequest {
6309    type Action = Action;
6310    const ACTION: Action = Action::NotifyDERStartStop;
6311    const KIND: MessageKind = MessageKind::Call;
6312    const ORIGIN: Origin = Origin::ChargingStation;
6313    type Response = NotifyDERStartStopResponse;
6314}
6315
6316impl Confirmed for NotifyDERStartStopRequest {}
6317
6318/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6319#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6320pub struct NotifyDERStartStopResponse {
6321    /// The `customData` member.
6322    #[serde(rename = "customData")]
6323    #[serde(default, skip_serializing_if = "Option::is_none")]
6324    pub custom_data: Option<crate::types::CustomData>,
6325}
6326
6327impl NotifyDERStartStopResponse {
6328    /// Creates an empty `NotifyDERStartStopResponse`. Every field of this type is optional.
6329    #[must_use]
6330    pub fn new() -> Self {
6331        Self::default()
6332    }
6333
6334    /// Sets the optional `customData` field.
6335    #[must_use]
6336    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6337        self.custom_data = Some(value);
6338        self
6339    }
6340}
6341
6342impl Validate for NotifyDERStartStopResponse {
6343    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6344        path.push_key("customData");
6345        if let Some(value) = &self.custom_data {
6346            Validate::validate_at(value, path, out);
6347        }
6348        path.pop();
6349    }
6350}
6351
6352impl Sealed for NotifyDERStartStopResponse {}
6353impl Response for NotifyDERStartStopResponse {}
6354
6355/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
6356#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6357pub struct NotifyDisplayMessagesRequest {
6358    /// The id of the &lt;&lt;getdisplaymessagesrequest,GetDisplayMessagesRequest&gt;&gt; that requested this message.
6359    #[serde(rename = "requestId")]
6360    #[serde(deserialize_with = "crate::types::integer::one")]
6361    pub request_id: i32,
6362    /// The `messageInfo` member.
6363    #[serde(rename = "messageInfo")]
6364    #[serde(default, skip_serializing_if = "Option::is_none")]
6365    pub message_info: Option<Vec<MessageInfo>>,
6366    /// "to be continued" indicator. Indicates whether another part of the report follows in an upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
6367    /// Schema default: `false`.
6368    #[serde(default, skip_serializing_if = "Option::is_none")]
6369    pub tbc: Option<bool>,
6370    /// The `customData` member.
6371    #[serde(rename = "customData")]
6372    #[serde(default, skip_serializing_if = "Option::is_none")]
6373    pub custom_data: Option<crate::types::CustomData>,
6374}
6375
6376impl NotifyDisplayMessagesRequest {
6377    /// Creates a `NotifyDisplayMessagesRequest` from its required fields.
6378    #[must_use]
6379    pub fn new(request_id: i32) -> Self {
6380        Self {
6381            request_id,
6382            message_info: None,
6383            tbc: None,
6384            custom_data: None,
6385        }
6386    }
6387
6388    /// Sets the optional `messageInfo` field.
6389    #[must_use]
6390    pub fn with_message_info(mut self, value: Vec<MessageInfo>) -> Self {
6391        self.message_info = Some(value);
6392        self
6393    }
6394
6395    /// Sets the optional `tbc` field.
6396    #[must_use]
6397    pub fn with_tbc(mut self, value: bool) -> Self {
6398        self.tbc = Some(value);
6399        self
6400    }
6401
6402    /// Sets the optional `customData` field.
6403    #[must_use]
6404    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6405        self.custom_data = Some(value);
6406        self
6407    }
6408}
6409
6410impl Validate for NotifyDisplayMessagesRequest {
6411    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6412        path.push_key("messageInfo");
6413        if let Some(value) = &self.message_info {
6414            validate::list_len(value.len(), Some(1), None, path, out);
6415            for (index, item) in value.iter().enumerate() {
6416                path.push_index(index);
6417                Validate::validate_at(item, path, out);
6418                path.pop();
6419            }
6420        }
6421        path.pop();
6422        path.push_key("customData");
6423        if let Some(value) = &self.custom_data {
6424            Validate::validate_at(value, path, out);
6425        }
6426        path.pop();
6427    }
6428}
6429
6430impl Sealed for NotifyDisplayMessagesRequest {}
6431impl Request for NotifyDisplayMessagesRequest {
6432    type Action = Action;
6433    const ACTION: Action = Action::NotifyDisplayMessages;
6434    const KIND: MessageKind = MessageKind::Call;
6435    const ORIGIN: Origin = Origin::ChargingStation;
6436    type Response = NotifyDisplayMessagesResponse;
6437}
6438
6439impl Confirmed for NotifyDisplayMessagesRequest {}
6440
6441/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
6442#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6443pub struct NotifyDisplayMessagesResponse {
6444    /// The `customData` member.
6445    #[serde(rename = "customData")]
6446    #[serde(default, skip_serializing_if = "Option::is_none")]
6447    pub custom_data: Option<crate::types::CustomData>,
6448}
6449
6450impl NotifyDisplayMessagesResponse {
6451    /// Creates an empty `NotifyDisplayMessagesResponse`. Every field of this type is optional.
6452    #[must_use]
6453    pub fn new() -> Self {
6454        Self::default()
6455    }
6456
6457    /// Sets the optional `customData` field.
6458    #[must_use]
6459    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6460        self.custom_data = Some(value);
6461        self
6462    }
6463}
6464
6465impl Validate for NotifyDisplayMessagesResponse {
6466    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6467        path.push_key("customData");
6468        if let Some(value) = &self.custom_data {
6469            Validate::validate_at(value, path, out);
6470        }
6471        path.pop();
6472    }
6473}
6474
6475impl Sealed for NotifyDisplayMessagesResponse {}
6476impl Response for NotifyDisplayMessagesResponse {}
6477
6478/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6479#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6480pub struct NotifyEVChargingNeedsRequest {
6481    /// Defines the EVSE and connector to which the EV is connected. EvseId may not be 0.
6482    #[serde(rename = "evseId")]
6483    #[serde(deserialize_with = "crate::types::integer::one")]
6484    pub evse_id: i32,
6485    /// The `chargingNeeds` member.
6486    #[serde(rename = "chargingNeeds")]
6487    pub charging_needs: ChargingNeeds,
6488    /// Contains the maximum elements the EV supports for: +
6489    /// - ISO 15118-2: schedule tuples in SASchedule (both Pmax and Tariff). +
6490    /// - ISO 15118-20: PowerScheduleEntry, PriceRule and PriceLevelScheduleEntries.
6491    #[serde(rename = "maxScheduleTuples")]
6492    #[serde(default, skip_serializing_if = "Option::is_none")]
6493    #[serde(deserialize_with = "crate::types::integer::option")]
6494    pub max_schedule_tuples: Option<i32>,
6495    /// *(2.1)* Time when EV charging needs were received. +
6496    /// Field can be added when charging station was offline when charging needs were received.
6497    #[serde(default, skip_serializing_if = "Option::is_none")]
6498    pub timestamp: Option<crate::types::DateTime>,
6499    /// The `customData` member.
6500    #[serde(rename = "customData")]
6501    #[serde(default, skip_serializing_if = "Option::is_none")]
6502    pub custom_data: Option<crate::types::CustomData>,
6503}
6504
6505impl NotifyEVChargingNeedsRequest {
6506    /// Creates a `NotifyEVChargingNeedsRequest` from its required fields.
6507    #[must_use]
6508    pub fn new(evse_id: i32, charging_needs: ChargingNeeds) -> Self {
6509        Self {
6510            evse_id,
6511            charging_needs,
6512            max_schedule_tuples: None,
6513            timestamp: None,
6514            custom_data: None,
6515        }
6516    }
6517
6518    /// Sets the optional `maxScheduleTuples` field.
6519    #[must_use]
6520    pub fn with_max_schedule_tuples(mut self, value: i32) -> Self {
6521        self.max_schedule_tuples = Some(value);
6522        self
6523    }
6524
6525    /// Sets the optional `timestamp` field.
6526    #[must_use]
6527    pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6528        self.timestamp = 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 NotifyEVChargingNeedsRequest {
6541    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6542        path.push_key("evseId");
6543        validate::int_range(i64::from(self.evse_id), Some(1), None, path, out);
6544        path.pop();
6545        path.push_key("chargingNeeds");
6546        Validate::validate_at(&self.charging_needs, path, out);
6547        path.pop();
6548        path.push_key("maxScheduleTuples");
6549        if let Some(value) = &self.max_schedule_tuples {
6550            validate::int_range(i64::from(*value), Some(0), None, path, out);
6551        }
6552        path.pop();
6553        path.push_key("customData");
6554        if let Some(value) = &self.custom_data {
6555            Validate::validate_at(value, path, out);
6556        }
6557        path.pop();
6558    }
6559}
6560
6561impl Sealed for NotifyEVChargingNeedsRequest {}
6562impl Request for NotifyEVChargingNeedsRequest {
6563    type Action = Action;
6564    const ACTION: Action = Action::NotifyEVChargingNeeds;
6565    const KIND: MessageKind = MessageKind::Call;
6566    const ORIGIN: Origin = Origin::ChargingStation;
6567    type Response = NotifyEVChargingNeedsResponse;
6568}
6569
6570impl Confirmed for NotifyEVChargingNeedsRequest {}
6571
6572/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6573#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6574pub struct NotifyEVChargingNeedsResponse {
6575    /// The `status` member.
6576    pub status: NotifyEVChargingNeedsStatus,
6577    /// The `statusInfo` member.
6578    #[serde(rename = "statusInfo")]
6579    #[serde(default, skip_serializing_if = "Option::is_none")]
6580    pub status_info: Option<StatusInfo>,
6581    /// The `customData` member.
6582    #[serde(rename = "customData")]
6583    #[serde(default, skip_serializing_if = "Option::is_none")]
6584    pub custom_data: Option<crate::types::CustomData>,
6585}
6586
6587impl NotifyEVChargingNeedsResponse {
6588    /// Creates a `NotifyEVChargingNeedsResponse` from its required fields.
6589    #[must_use]
6590    pub fn new(status: NotifyEVChargingNeedsStatus) -> Self {
6591        Self {
6592            status,
6593            status_info: None,
6594            custom_data: None,
6595        }
6596    }
6597
6598    /// Sets the optional `statusInfo` field.
6599    #[must_use]
6600    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6601        self.status_info = Some(value);
6602        self
6603    }
6604
6605    /// Sets the optional `customData` field.
6606    #[must_use]
6607    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6608        self.custom_data = Some(value);
6609        self
6610    }
6611}
6612
6613impl Validate for NotifyEVChargingNeedsResponse {
6614    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6615        path.push_key("status");
6616        Validate::validate_at(&self.status, path, out);
6617        path.pop();
6618        path.push_key("statusInfo");
6619        if let Some(value) = &self.status_info {
6620            Validate::validate_at(value, path, out);
6621        }
6622        path.pop();
6623        path.push_key("customData");
6624        if let Some(value) = &self.custom_data {
6625            Validate::validate_at(value, path, out);
6626        }
6627        path.pop();
6628    }
6629}
6630
6631impl Sealed for NotifyEVChargingNeedsResponse {}
6632impl Response for NotifyEVChargingNeedsResponse {}
6633
6634/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6635#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6636pub struct NotifyEVChargingScheduleRequest {
6637    /// Periods contained in the charging profile are relative to this point in time.
6638    #[serde(rename = "timeBase")]
6639    pub time_base: crate::types::DateTime,
6640    /// The `chargingSchedule` member.
6641    #[serde(rename = "chargingSchedule")]
6642    pub charging_schedule: ChargingSchedule,
6643    /// The charging schedule contained in this notification applies to an EVSE. EvseId must be &gt; 0.
6644    #[serde(rename = "evseId")]
6645    #[serde(deserialize_with = "crate::types::integer::one")]
6646    pub evse_id: i32,
6647    /// *(2.1)* Id  of the _chargingSchedule_ that EV selected from the provided ChargingProfile.
6648    #[serde(rename = "selectedChargingScheduleId")]
6649    #[serde(default, skip_serializing_if = "Option::is_none")]
6650    #[serde(deserialize_with = "crate::types::integer::option")]
6651    pub selected_charging_schedule_id: Option<i32>,
6652    /// *(2.1)* True when power tolerance is accepted by EV.
6653    /// This value is taken from EVPowerProfile.PowerToleranceAcceptance in the ISO 15118-20 PowerDeliverReq message..
6654    #[serde(rename = "powerToleranceAcceptance")]
6655    #[serde(default, skip_serializing_if = "Option::is_none")]
6656    pub power_tolerance_acceptance: Option<bool>,
6657    /// The `customData` member.
6658    #[serde(rename = "customData")]
6659    #[serde(default, skip_serializing_if = "Option::is_none")]
6660    pub custom_data: Option<crate::types::CustomData>,
6661}
6662
6663impl NotifyEVChargingScheduleRequest {
6664    /// Creates a `NotifyEVChargingScheduleRequest` from its required fields.
6665    #[must_use]
6666    pub fn new(
6667        time_base: impl Into<crate::types::DateTime>,
6668        charging_schedule: ChargingSchedule,
6669        evse_id: i32,
6670    ) -> Self {
6671        Self {
6672            time_base: time_base.into(),
6673            charging_schedule,
6674            evse_id,
6675            selected_charging_schedule_id: None,
6676            power_tolerance_acceptance: None,
6677            custom_data: None,
6678        }
6679    }
6680
6681    /// Sets the optional `selectedChargingScheduleId` field.
6682    #[must_use]
6683    pub fn with_selected_charging_schedule_id(mut self, value: i32) -> Self {
6684        self.selected_charging_schedule_id = Some(value);
6685        self
6686    }
6687
6688    /// Sets the optional `powerToleranceAcceptance` field.
6689    #[must_use]
6690    pub fn with_power_tolerance_acceptance(mut self, value: bool) -> Self {
6691        self.power_tolerance_acceptance = Some(value);
6692        self
6693    }
6694
6695    /// Sets the optional `customData` field.
6696    #[must_use]
6697    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6698        self.custom_data = Some(value);
6699        self
6700    }
6701}
6702
6703impl Validate for NotifyEVChargingScheduleRequest {
6704    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6705        path.push_key("chargingSchedule");
6706        Validate::validate_at(&self.charging_schedule, path, out);
6707        path.pop();
6708        path.push_key("evseId");
6709        validate::int_range(i64::from(self.evse_id), Some(1), None, path, out);
6710        path.pop();
6711        path.push_key("selectedChargingScheduleId");
6712        if let Some(value) = &self.selected_charging_schedule_id {
6713            validate::int_range(i64::from(*value), Some(0), None, path, out);
6714        }
6715        path.pop();
6716        path.push_key("customData");
6717        if let Some(value) = &self.custom_data {
6718            Validate::validate_at(value, path, out);
6719        }
6720        path.pop();
6721    }
6722}
6723
6724impl Sealed for NotifyEVChargingScheduleRequest {}
6725impl Request for NotifyEVChargingScheduleRequest {
6726    type Action = Action;
6727    const ACTION: Action = Action::NotifyEVChargingSchedule;
6728    const KIND: MessageKind = MessageKind::Call;
6729    const ORIGIN: Origin = Origin::ChargingStation;
6730    type Response = NotifyEVChargingScheduleResponse;
6731}
6732
6733impl Confirmed for NotifyEVChargingScheduleRequest {}
6734
6735/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6736#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6737pub struct NotifyEVChargingScheduleResponse {
6738    /// The `status` member.
6739    pub status: GenericStatus,
6740    /// The `statusInfo` member.
6741    #[serde(rename = "statusInfo")]
6742    #[serde(default, skip_serializing_if = "Option::is_none")]
6743    pub status_info: Option<StatusInfo>,
6744    /// The `customData` member.
6745    #[serde(rename = "customData")]
6746    #[serde(default, skip_serializing_if = "Option::is_none")]
6747    pub custom_data: Option<crate::types::CustomData>,
6748}
6749
6750impl NotifyEVChargingScheduleResponse {
6751    /// Creates a `NotifyEVChargingScheduleResponse` from its required fields.
6752    #[must_use]
6753    pub fn new(status: GenericStatus) -> Self {
6754        Self {
6755            status,
6756            status_info: None,
6757            custom_data: None,
6758        }
6759    }
6760
6761    /// Sets the optional `statusInfo` field.
6762    #[must_use]
6763    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6764        self.status_info = Some(value);
6765        self
6766    }
6767
6768    /// Sets the optional `customData` field.
6769    #[must_use]
6770    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6771        self.custom_data = Some(value);
6772        self
6773    }
6774}
6775
6776impl Validate for NotifyEVChargingScheduleResponse {
6777    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6778        path.push_key("status");
6779        Validate::validate_at(&self.status, path, out);
6780        path.pop();
6781        path.push_key("statusInfo");
6782        if let Some(value) = &self.status_info {
6783            Validate::validate_at(value, path, out);
6784        }
6785        path.pop();
6786        path.push_key("customData");
6787        if let Some(value) = &self.custom_data {
6788            Validate::validate_at(value, path, out);
6789        }
6790        path.pop();
6791    }
6792}
6793
6794impl Sealed for NotifyEVChargingScheduleResponse {}
6795impl Response for NotifyEVChargingScheduleResponse {}
6796
6797/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6798#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6799pub struct NotifyEventRequest {
6800    /// Timestamp of the moment this message was generated at the Charging Station.
6801    #[serde(rename = "generatedAt")]
6802    pub generated_at: crate::types::DateTime,
6803    /// Sequence number of this message. First message starts at 0.
6804    #[serde(rename = "seqNo")]
6805    #[serde(deserialize_with = "crate::types::integer::one")]
6806    pub seq_no: i32,
6807    /// The `eventData` member.
6808    #[serde(rename = "eventData")]
6809    pub event_data: Vec<EventData>,
6810    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyEventRequest message. Default value when omitted is false.
6811    /// Schema default: `false`.
6812    #[serde(default, skip_serializing_if = "Option::is_none")]
6813    pub tbc: Option<bool>,
6814    /// The `customData` member.
6815    #[serde(rename = "customData")]
6816    #[serde(default, skip_serializing_if = "Option::is_none")]
6817    pub custom_data: Option<crate::types::CustomData>,
6818}
6819
6820impl NotifyEventRequest {
6821    /// Creates a `NotifyEventRequest` from its required fields.
6822    #[must_use]
6823    pub fn new(
6824        generated_at: impl Into<crate::types::DateTime>,
6825        seq_no: i32,
6826        event_data: Vec<EventData>,
6827    ) -> Self {
6828        Self {
6829            generated_at: generated_at.into(),
6830            seq_no,
6831            event_data,
6832            tbc: None,
6833            custom_data: None,
6834        }
6835    }
6836
6837    /// Sets the optional `tbc` field.
6838    #[must_use]
6839    pub fn with_tbc(mut self, value: bool) -> Self {
6840        self.tbc = Some(value);
6841        self
6842    }
6843
6844    /// Sets the optional `customData` field.
6845    #[must_use]
6846    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6847        self.custom_data = Some(value);
6848        self
6849    }
6850}
6851
6852impl Validate for NotifyEventRequest {
6853    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6854        path.push_key("seqNo");
6855        validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
6856        path.pop();
6857        path.push_key("eventData");
6858        validate::list_len(self.event_data.len(), Some(1), None, path, out);
6859        for (index, item) in self.event_data.iter().enumerate() {
6860            path.push_index(index);
6861            Validate::validate_at(item, path, out);
6862            path.pop();
6863        }
6864        path.pop();
6865        path.push_key("customData");
6866        if let Some(value) = &self.custom_data {
6867            Validate::validate_at(value, path, out);
6868        }
6869        path.pop();
6870    }
6871}
6872
6873impl Sealed for NotifyEventRequest {}
6874impl Request for NotifyEventRequest {
6875    type Action = Action;
6876    const ACTION: Action = Action::NotifyEvent;
6877    const KIND: MessageKind = MessageKind::Call;
6878    const ORIGIN: Origin = Origin::ChargingStation;
6879    type Response = NotifyEventResponse;
6880}
6881
6882impl Confirmed for NotifyEventRequest {}
6883
6884/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6885#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6886pub struct NotifyEventResponse {
6887    /// The `customData` member.
6888    #[serde(rename = "customData")]
6889    #[serde(default, skip_serializing_if = "Option::is_none")]
6890    pub custom_data: Option<crate::types::CustomData>,
6891}
6892
6893impl NotifyEventResponse {
6894    /// Creates an empty `NotifyEventResponse`. Every field of this type is optional.
6895    #[must_use]
6896    pub fn new() -> Self {
6897        Self::default()
6898    }
6899
6900    /// Sets the optional `customData` field.
6901    #[must_use]
6902    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6903        self.custom_data = Some(value);
6904        self
6905    }
6906}
6907
6908impl Validate for NotifyEventResponse {
6909    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6910        path.push_key("customData");
6911        if let Some(value) = &self.custom_data {
6912            Validate::validate_at(value, path, out);
6913        }
6914        path.pop();
6915    }
6916}
6917
6918impl Sealed for NotifyEventResponse {}
6919impl Response for NotifyEventResponse {}
6920
6921/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6922#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6923pub struct NotifyMonitoringReportRequest {
6924    /// The id of the GetMonitoringRequest that requested this report.
6925    #[serde(rename = "requestId")]
6926    #[serde(deserialize_with = "crate::types::integer::one")]
6927    pub request_id: i32,
6928    /// Sequence number of this message. First message starts at 0.
6929    #[serde(rename = "seqNo")]
6930    #[serde(deserialize_with = "crate::types::integer::one")]
6931    pub seq_no: i32,
6932    /// Timestamp of the moment this message was generated at the Charging Station.
6933    #[serde(rename = "generatedAt")]
6934    pub generated_at: crate::types::DateTime,
6935    /// The `monitor` member.
6936    #[serde(default, skip_serializing_if = "Option::is_none")]
6937    pub monitor: Option<Vec<MonitoringData>>,
6938    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
6939    /// Schema default: `false`.
6940    #[serde(default, skip_serializing_if = "Option::is_none")]
6941    pub tbc: Option<bool>,
6942    /// The `customData` member.
6943    #[serde(rename = "customData")]
6944    #[serde(default, skip_serializing_if = "Option::is_none")]
6945    pub custom_data: Option<crate::types::CustomData>,
6946}
6947
6948impl NotifyMonitoringReportRequest {
6949    /// Creates a `NotifyMonitoringReportRequest` from its required fields.
6950    #[must_use]
6951    pub fn new(
6952        request_id: i32,
6953        seq_no: i32,
6954        generated_at: impl Into<crate::types::DateTime>,
6955    ) -> Self {
6956        Self {
6957            request_id,
6958            seq_no,
6959            generated_at: generated_at.into(),
6960            monitor: None,
6961            tbc: None,
6962            custom_data: None,
6963        }
6964    }
6965
6966    /// Sets the optional `monitor` field.
6967    #[must_use]
6968    pub fn with_monitor(mut self, value: Vec<MonitoringData>) -> Self {
6969        self.monitor = Some(value);
6970        self
6971    }
6972
6973    /// Sets the optional `tbc` field.
6974    #[must_use]
6975    pub fn with_tbc(mut self, value: bool) -> Self {
6976        self.tbc = Some(value);
6977        self
6978    }
6979
6980    /// Sets the optional `customData` field.
6981    #[must_use]
6982    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6983        self.custom_data = Some(value);
6984        self
6985    }
6986}
6987
6988impl Validate for NotifyMonitoringReportRequest {
6989    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6990        path.push_key("seqNo");
6991        validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
6992        path.pop();
6993        path.push_key("monitor");
6994        if let Some(value) = &self.monitor {
6995            validate::list_len(value.len(), Some(1), None, path, out);
6996            for (index, item) in value.iter().enumerate() {
6997                path.push_index(index);
6998                Validate::validate_at(item, path, out);
6999                path.pop();
7000            }
7001        }
7002        path.pop();
7003        path.push_key("customData");
7004        if let Some(value) = &self.custom_data {
7005            Validate::validate_at(value, path, out);
7006        }
7007        path.pop();
7008    }
7009}
7010
7011impl Sealed for NotifyMonitoringReportRequest {}
7012impl Request for NotifyMonitoringReportRequest {
7013    type Action = Action;
7014    const ACTION: Action = Action::NotifyMonitoringReport;
7015    const KIND: MessageKind = MessageKind::Call;
7016    const ORIGIN: Origin = Origin::ChargingStation;
7017    type Response = NotifyMonitoringReportResponse;
7018}
7019
7020impl Confirmed for NotifyMonitoringReportRequest {}
7021
7022/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
7023#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7024pub struct NotifyMonitoringReportResponse {
7025    /// The `customData` member.
7026    #[serde(rename = "customData")]
7027    #[serde(default, skip_serializing_if = "Option::is_none")]
7028    pub custom_data: Option<crate::types::CustomData>,
7029}
7030
7031impl NotifyMonitoringReportResponse {
7032    /// Creates an empty `NotifyMonitoringReportResponse`. Every field of this type is optional.
7033    #[must_use]
7034    pub fn new() -> Self {
7035        Self::default()
7036    }
7037
7038    /// Sets the optional `customData` field.
7039    #[must_use]
7040    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7041        self.custom_data = Some(value);
7042        self
7043    }
7044}
7045
7046impl Validate for NotifyMonitoringReportResponse {
7047    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7048        path.push_key("customData");
7049        if let Some(value) = &self.custom_data {
7050            Validate::validate_at(value, path, out);
7051        }
7052        path.pop();
7053    }
7054}
7055
7056impl Sealed for NotifyMonitoringReportResponse {}
7057impl Response for NotifyMonitoringReportResponse {}
7058
7059/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · SEND (unconfirmed, never answered — Part 4 §4.2.4).
7060#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7061pub struct NotifyPeriodicEventStreamRequest {
7062    /// The `data` member.
7063    pub data: Vec<StreamDataElement>,
7064    /// Id of stream.
7065    #[serde(deserialize_with = "crate::types::integer::one")]
7066    pub id: i32,
7067    /// Number of data elements still pending to be sent.
7068    #[serde(deserialize_with = "crate::types::integer::one")]
7069    pub pending: i32,
7070    /// Base timestamp to add to time offset of values.
7071    pub basetime: crate::types::DateTime,
7072    /// The `customData` member.
7073    #[serde(rename = "customData")]
7074    #[serde(default, skip_serializing_if = "Option::is_none")]
7075    pub custom_data: Option<crate::types::CustomData>,
7076}
7077
7078impl NotifyPeriodicEventStreamRequest {
7079    /// Creates a `NotifyPeriodicEventStreamRequest` from its required fields.
7080    #[must_use]
7081    pub fn new(
7082        data: Vec<StreamDataElement>,
7083        id: i32,
7084        pending: i32,
7085        basetime: impl Into<crate::types::DateTime>,
7086    ) -> Self {
7087        Self {
7088            data,
7089            id,
7090            pending,
7091            basetime: basetime.into(),
7092            custom_data: None,
7093        }
7094    }
7095
7096    /// Sets the optional `customData` field.
7097    #[must_use]
7098    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7099        self.custom_data = Some(value);
7100        self
7101    }
7102}
7103
7104impl Validate for NotifyPeriodicEventStreamRequest {
7105    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7106        path.push_key("data");
7107        validate::list_len(self.data.len(), Some(1), None, path, out);
7108        for (index, item) in self.data.iter().enumerate() {
7109            path.push_index(index);
7110            Validate::validate_at(item, path, out);
7111            path.pop();
7112        }
7113        path.pop();
7114        path.push_key("id");
7115        validate::int_range(i64::from(self.id), Some(0), None, path, out);
7116        path.pop();
7117        path.push_key("pending");
7118        validate::int_range(i64::from(self.pending), Some(0), None, path, out);
7119        path.pop();
7120        path.push_key("customData");
7121        if let Some(value) = &self.custom_data {
7122            Validate::validate_at(value, path, out);
7123        }
7124        path.pop();
7125    }
7126}
7127
7128impl Sealed for NotifyPeriodicEventStreamRequest {}
7129impl Request for NotifyPeriodicEventStreamRequest {
7130    type Action = Action;
7131    const ACTION: Action = Action::NotifyPeriodicEventStream;
7132    const KIND: MessageKind = MessageKind::Send;
7133    const ORIGIN: Origin = Origin::ChargingStation;
7134    type Response = crate::message::NoResponse;
7135}
7136
7137impl Unconfirmed for NotifyPeriodicEventStreamRequest {}
7138
7139/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
7140#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7141pub struct NotifyPriorityChargingRequest {
7142    /// The transaction for which priority charging is requested.
7143    #[serde(rename = "transactionId")]
7144    pub transaction_id: String,
7145    /// True if priority charging was activated. False if it has stopped using the priority charging profile.
7146    pub activated: bool,
7147    /// The `customData` member.
7148    #[serde(rename = "customData")]
7149    #[serde(default, skip_serializing_if = "Option::is_none")]
7150    pub custom_data: Option<crate::types::CustomData>,
7151}
7152
7153impl NotifyPriorityChargingRequest {
7154    /// Creates a `NotifyPriorityChargingRequest` from its required fields.
7155    #[must_use]
7156    pub fn new(transaction_id: impl Into<String>, activated: bool) -> Self {
7157        Self {
7158            transaction_id: transaction_id.into(),
7159            activated,
7160            custom_data: None,
7161        }
7162    }
7163
7164    /// Sets the optional `customData` field.
7165    #[must_use]
7166    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7167        self.custom_data = Some(value);
7168        self
7169    }
7170}
7171
7172impl Validate for NotifyPriorityChargingRequest {
7173    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7174        path.push_key("transactionId");
7175        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
7176        path.pop();
7177        path.push_key("customData");
7178        if let Some(value) = &self.custom_data {
7179            Validate::validate_at(value, path, out);
7180        }
7181        path.pop();
7182    }
7183}
7184
7185impl Sealed for NotifyPriorityChargingRequest {}
7186impl Request for NotifyPriorityChargingRequest {
7187    type Action = Action;
7188    const ACTION: Action = Action::NotifyPriorityCharging;
7189    const KIND: MessageKind = MessageKind::Call;
7190    const ORIGIN: Origin = Origin::ChargingStation;
7191    type Response = NotifyPriorityChargingResponse;
7192}
7193
7194impl Confirmed for NotifyPriorityChargingRequest {}
7195
7196/// This response message has an empty body.
7197///
7198/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
7199#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7200pub struct NotifyPriorityChargingResponse {
7201    /// The `customData` member.
7202    #[serde(rename = "customData")]
7203    #[serde(default, skip_serializing_if = "Option::is_none")]
7204    pub custom_data: Option<crate::types::CustomData>,
7205}
7206
7207impl NotifyPriorityChargingResponse {
7208    /// Creates an empty `NotifyPriorityChargingResponse`. Every field of this type is optional.
7209    #[must_use]
7210    pub fn new() -> Self {
7211        Self::default()
7212    }
7213
7214    /// Sets the optional `customData` field.
7215    #[must_use]
7216    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7217        self.custom_data = Some(value);
7218        self
7219    }
7220}
7221
7222impl Validate for NotifyPriorityChargingResponse {
7223    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7224        path.push_key("customData");
7225        if let Some(value) = &self.custom_data {
7226            Validate::validate_at(value, path, out);
7227        }
7228        path.pop();
7229    }
7230}
7231
7232impl Sealed for NotifyPriorityChargingResponse {}
7233impl Response for NotifyPriorityChargingResponse {}
7234
7235/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
7236#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7237pub struct NotifyReportRequest {
7238    /// The id of the GetReportRequest  or GetBaseReportRequest that requested this report
7239    #[serde(rename = "requestId")]
7240    #[serde(deserialize_with = "crate::types::integer::one")]
7241    pub request_id: i32,
7242    /// Timestamp of the moment this message was generated at the Charging Station.
7243    #[serde(rename = "generatedAt")]
7244    pub generated_at: crate::types::DateTime,
7245    /// Sequence number of this message. First message starts at 0.
7246    #[serde(rename = "seqNo")]
7247    #[serde(deserialize_with = "crate::types::integer::one")]
7248    pub seq_no: i32,
7249    /// The `reportData` member.
7250    #[serde(rename = "reportData")]
7251    #[serde(default, skip_serializing_if = "Option::is_none")]
7252    pub report_data: Option<Vec<ReportData>>,
7253    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyReportRequest message. Default value when omitted is false.
7254    /// Schema default: `false`.
7255    #[serde(default, skip_serializing_if = "Option::is_none")]
7256    pub tbc: Option<bool>,
7257    /// The `customData` member.
7258    #[serde(rename = "customData")]
7259    #[serde(default, skip_serializing_if = "Option::is_none")]
7260    pub custom_data: Option<crate::types::CustomData>,
7261}
7262
7263impl NotifyReportRequest {
7264    /// Creates a `NotifyReportRequest` from its required fields.
7265    #[must_use]
7266    pub fn new(
7267        request_id: i32,
7268        generated_at: impl Into<crate::types::DateTime>,
7269        seq_no: i32,
7270    ) -> Self {
7271        Self {
7272            request_id,
7273            generated_at: generated_at.into(),
7274            seq_no,
7275            report_data: None,
7276            tbc: None,
7277            custom_data: None,
7278        }
7279    }
7280
7281    /// Sets the optional `reportData` field.
7282    #[must_use]
7283    pub fn with_report_data(mut self, value: Vec<ReportData>) -> Self {
7284        self.report_data = Some(value);
7285        self
7286    }
7287
7288    /// Sets the optional `tbc` field.
7289    #[must_use]
7290    pub fn with_tbc(mut self, value: bool) -> Self {
7291        self.tbc = Some(value);
7292        self
7293    }
7294
7295    /// Sets the optional `customData` field.
7296    #[must_use]
7297    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7298        self.custom_data = Some(value);
7299        self
7300    }
7301}
7302
7303impl Validate for NotifyReportRequest {
7304    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7305        path.push_key("seqNo");
7306        validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
7307        path.pop();
7308        path.push_key("reportData");
7309        if let Some(value) = &self.report_data {
7310            validate::list_len(value.len(), Some(1), None, path, out);
7311            for (index, item) in value.iter().enumerate() {
7312                path.push_index(index);
7313                Validate::validate_at(item, path, out);
7314                path.pop();
7315            }
7316        }
7317        path.pop();
7318        path.push_key("customData");
7319        if let Some(value) = &self.custom_data {
7320            Validate::validate_at(value, path, out);
7321        }
7322        path.pop();
7323    }
7324}
7325
7326impl Sealed for NotifyReportRequest {}
7327impl Request for NotifyReportRequest {
7328    type Action = Action;
7329    const ACTION: Action = Action::NotifyReport;
7330    const KIND: MessageKind = MessageKind::Call;
7331    const ORIGIN: Origin = Origin::ChargingStation;
7332    type Response = NotifyReportResponse;
7333}
7334
7335impl Confirmed for NotifyReportRequest {}
7336
7337/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
7338#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7339pub struct NotifyReportResponse {
7340    /// The `customData` member.
7341    #[serde(rename = "customData")]
7342    #[serde(default, skip_serializing_if = "Option::is_none")]
7343    pub custom_data: Option<crate::types::CustomData>,
7344}
7345
7346impl NotifyReportResponse {
7347    /// Creates an empty `NotifyReportResponse`. Every field of this type is optional.
7348    #[must_use]
7349    pub fn new() -> Self {
7350        Self::default()
7351    }
7352
7353    /// Sets the optional `customData` field.
7354    #[must_use]
7355    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7356        self.custom_data = Some(value);
7357        self
7358    }
7359}
7360
7361impl Validate for NotifyReportResponse {
7362    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7363        path.push_key("customData");
7364        if let Some(value) = &self.custom_data {
7365            Validate::validate_at(value, path, out);
7366        }
7367        path.pop();
7368    }
7369}
7370
7371impl Sealed for NotifyReportResponse {}
7372impl Response for NotifyReportResponse {}
7373
7374/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
7375#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7376pub struct NotifySettlementRequest {
7377    /// The payment reference received from the payment terminal and is used as the value for _idToken_.
7378    #[serde(rename = "pspRef")]
7379    pub psp_ref: String,
7380    /// The `status` member.
7381    pub status: PaymentStatus,
7382    /// The amount that was settled, or attempted to be settled (in case of failure).
7383    #[serde(rename = "settlementAmount")]
7384    pub settlement_amount: crate::types::Decimal,
7385    /// The time when the settlement was done.
7386    #[serde(rename = "settlementTime")]
7387    pub settlement_time: crate::types::DateTime,
7388    /// The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
7389    #[serde(rename = "transactionId")]
7390    #[serde(default, skip_serializing_if = "Option::is_none")]
7391    pub transaction_id: Option<String>,
7392    /// Additional information from payment terminal/payment process.
7393    #[serde(rename = "statusInfo")]
7394    #[serde(default, skip_serializing_if = "Option::is_none")]
7395    pub status_info: Option<String>,
7396    /// The `receiptId` member.
7397    #[serde(rename = "receiptId")]
7398    #[serde(default, skip_serializing_if = "Option::is_none")]
7399    pub receipt_id: Option<String>,
7400    /// The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
7401    #[serde(rename = "receiptUrl")]
7402    #[serde(default, skip_serializing_if = "Option::is_none")]
7403    pub receipt_url: Option<String>,
7404    /// The `vatCompany` member.
7405    #[serde(rename = "vatCompany")]
7406    #[serde(default, skip_serializing_if = "Option::is_none")]
7407    pub vat_company: Option<Address>,
7408    /// VAT number for a company receipt.
7409    #[serde(rename = "vatNumber")]
7410    #[serde(default, skip_serializing_if = "Option::is_none")]
7411    pub vat_number: Option<String>,
7412    /// The `customData` member.
7413    #[serde(rename = "customData")]
7414    #[serde(default, skip_serializing_if = "Option::is_none")]
7415    pub custom_data: Option<crate::types::CustomData>,
7416}
7417
7418impl NotifySettlementRequest {
7419    /// Creates a `NotifySettlementRequest` from its required fields.
7420    #[must_use]
7421    pub fn new(
7422        psp_ref: impl Into<String>,
7423        status: PaymentStatus,
7424        settlement_amount: impl Into<crate::types::Decimal>,
7425        settlement_time: impl Into<crate::types::DateTime>,
7426    ) -> Self {
7427        Self {
7428            psp_ref: psp_ref.into(),
7429            status,
7430            settlement_amount: settlement_amount.into(),
7431            settlement_time: settlement_time.into(),
7432            transaction_id: None,
7433            status_info: None,
7434            receipt_id: None,
7435            receipt_url: None,
7436            vat_company: None,
7437            vat_number: None,
7438            custom_data: None,
7439        }
7440    }
7441
7442    /// Sets the optional `transactionId` field.
7443    #[must_use]
7444    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
7445        self.transaction_id = Some(value.into());
7446        self
7447    }
7448
7449    /// Sets the optional `statusInfo` field.
7450    #[must_use]
7451    pub fn with_status_info(mut self, value: impl Into<String>) -> Self {
7452        self.status_info = Some(value.into());
7453        self
7454    }
7455
7456    /// Sets the optional `receiptId` field.
7457    #[must_use]
7458    pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
7459        self.receipt_id = Some(value.into());
7460        self
7461    }
7462
7463    /// Sets the optional `receiptUrl` field.
7464    #[must_use]
7465    pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
7466        self.receipt_url = Some(value.into());
7467        self
7468    }
7469
7470    /// Sets the optional `vatCompany` field.
7471    #[must_use]
7472    pub fn with_vat_company(mut self, value: Address) -> Self {
7473        self.vat_company = Some(value);
7474        self
7475    }
7476
7477    /// Sets the optional `vatNumber` field.
7478    #[must_use]
7479    pub fn with_vat_number(mut self, value: impl Into<String>) -> Self {
7480        self.vat_number = Some(value.into());
7481        self
7482    }
7483
7484    /// Sets the optional `customData` field.
7485    #[must_use]
7486    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7487        self.custom_data = Some(value);
7488        self
7489    }
7490}
7491
7492impl Validate for NotifySettlementRequest {
7493    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7494        path.push_key("pspRef");
7495        validate::string(self.psp_ref.as_str(), None, Some(255), path, out);
7496        path.pop();
7497        path.push_key("status");
7498        Validate::validate_at(&self.status, path, out);
7499        path.pop();
7500        path.push_key("transactionId");
7501        if let Some(value) = &self.transaction_id {
7502            validate::string(value.as_str(), None, Some(36), path, out);
7503        }
7504        path.pop();
7505        path.push_key("statusInfo");
7506        if let Some(value) = &self.status_info {
7507            validate::string(value.as_str(), None, Some(500), path, out);
7508        }
7509        path.pop();
7510        path.push_key("receiptId");
7511        if let Some(value) = &self.receipt_id {
7512            validate::string(value.as_str(), None, Some(50), path, out);
7513        }
7514        path.pop();
7515        path.push_key("receiptUrl");
7516        if let Some(value) = &self.receipt_url {
7517            validate::string(value.as_str(), None, Some(2000), path, out);
7518        }
7519        path.pop();
7520        path.push_key("vatCompany");
7521        if let Some(value) = &self.vat_company {
7522            Validate::validate_at(value, path, out);
7523        }
7524        path.pop();
7525        path.push_key("vatNumber");
7526        if let Some(value) = &self.vat_number {
7527            validate::string(value.as_str(), None, Some(20), path, out);
7528        }
7529        path.pop();
7530        path.push_key("customData");
7531        if let Some(value) = &self.custom_data {
7532            Validate::validate_at(value, path, out);
7533        }
7534        path.pop();
7535    }
7536}
7537
7538impl Sealed for NotifySettlementRequest {}
7539impl Request for NotifySettlementRequest {
7540    type Action = Action;
7541    const ACTION: Action = Action::NotifySettlement;
7542    const KIND: MessageKind = MessageKind::Call;
7543    const ORIGIN: Origin = Origin::ChargingStation;
7544    type Response = NotifySettlementResponse;
7545}
7546
7547impl Confirmed for NotifySettlementRequest {}
7548
7549/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
7550#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7551pub struct NotifySettlementResponse {
7552    /// The receipt URL if receipt generated by CSMS. The Charging Station can QR encode it and show it to the EV Driver.
7553    #[serde(rename = "receiptUrl")]
7554    #[serde(default, skip_serializing_if = "Option::is_none")]
7555    pub receipt_url: Option<String>,
7556    /// The receipt id if the receipt is generated by CSMS.
7557    #[serde(rename = "receiptId")]
7558    #[serde(default, skip_serializing_if = "Option::is_none")]
7559    pub receipt_id: Option<String>,
7560    /// The `customData` member.
7561    #[serde(rename = "customData")]
7562    #[serde(default, skip_serializing_if = "Option::is_none")]
7563    pub custom_data: Option<crate::types::CustomData>,
7564}
7565
7566impl NotifySettlementResponse {
7567    /// Creates an empty `NotifySettlementResponse`. Every field of this type is optional.
7568    #[must_use]
7569    pub fn new() -> Self {
7570        Self::default()
7571    }
7572
7573    /// Sets the optional `receiptUrl` field.
7574    #[must_use]
7575    pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
7576        self.receipt_url = Some(value.into());
7577        self
7578    }
7579
7580    /// Sets the optional `receiptId` field.
7581    #[must_use]
7582    pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
7583        self.receipt_id = Some(value.into());
7584        self
7585    }
7586
7587    /// Sets the optional `customData` field.
7588    #[must_use]
7589    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7590        self.custom_data = Some(value);
7591        self
7592    }
7593}
7594
7595impl Validate for NotifySettlementResponse {
7596    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7597        path.push_key("receiptUrl");
7598        if let Some(value) = &self.receipt_url {
7599            validate::string(value.as_str(), None, Some(2000), path, out);
7600        }
7601        path.pop();
7602        path.push_key("receiptId");
7603        if let Some(value) = &self.receipt_id {
7604            validate::string(value.as_str(), None, Some(50), path, out);
7605        }
7606        path.pop();
7607        path.push_key("customData");
7608        if let Some(value) = &self.custom_data {
7609            Validate::validate_at(value, path, out);
7610        }
7611        path.pop();
7612    }
7613}
7614
7615impl Sealed for NotifySettlementResponse {}
7616impl Response for NotifySettlementResponse {}
7617
7618/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
7619#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7620pub struct NotifyWebPaymentStartedRequest {
7621    /// EVSE id for which transaction is requested.
7622    #[serde(rename = "evseId")]
7623    #[serde(deserialize_with = "crate::types::integer::one")]
7624    pub evse_id: i32,
7625    /// Timeout value in seconds after which no result of web payment process (e.g. QR code scanning) is to be expected anymore.
7626    #[serde(deserialize_with = "crate::types::integer::one")]
7627    pub timeout: i32,
7628    /// The `customData` member.
7629    #[serde(rename = "customData")]
7630    #[serde(default, skip_serializing_if = "Option::is_none")]
7631    pub custom_data: Option<crate::types::CustomData>,
7632}
7633
7634impl NotifyWebPaymentStartedRequest {
7635    /// Creates a `NotifyWebPaymentStartedRequest` from its required fields.
7636    #[must_use]
7637    pub fn new(evse_id: i32, timeout: i32) -> Self {
7638        Self {
7639            evse_id,
7640            timeout,
7641            custom_data: None,
7642        }
7643    }
7644
7645    /// Sets the optional `customData` field.
7646    #[must_use]
7647    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7648        self.custom_data = Some(value);
7649        self
7650    }
7651}
7652
7653impl Validate for NotifyWebPaymentStartedRequest {
7654    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7655        path.push_key("evseId");
7656        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
7657        path.pop();
7658        path.push_key("customData");
7659        if let Some(value) = &self.custom_data {
7660            Validate::validate_at(value, path, out);
7661        }
7662        path.pop();
7663    }
7664}
7665
7666impl Sealed for NotifyWebPaymentStartedRequest {}
7667impl Request for NotifyWebPaymentStartedRequest {
7668    type Action = Action;
7669    const ACTION: Action = Action::NotifyWebPaymentStarted;
7670    const KIND: MessageKind = MessageKind::Call;
7671    const ORIGIN: Origin = Origin::Csms;
7672    type Response = NotifyWebPaymentStartedResponse;
7673}
7674
7675impl Confirmed for NotifyWebPaymentStartedRequest {}
7676
7677/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
7678#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7679pub struct NotifyWebPaymentStartedResponse {
7680    /// The `customData` member.
7681    #[serde(rename = "customData")]
7682    #[serde(default, skip_serializing_if = "Option::is_none")]
7683    pub custom_data: Option<crate::types::CustomData>,
7684}
7685
7686impl NotifyWebPaymentStartedResponse {
7687    /// Creates an empty `NotifyWebPaymentStartedResponse`. Every field of this type is optional.
7688    #[must_use]
7689    pub fn new() -> Self {
7690        Self::default()
7691    }
7692
7693    /// Sets the optional `customData` field.
7694    #[must_use]
7695    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7696        self.custom_data = Some(value);
7697        self
7698    }
7699}
7700
7701impl Validate for NotifyWebPaymentStartedResponse {
7702    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7703        path.push_key("customData");
7704        if let Some(value) = &self.custom_data {
7705            Validate::validate_at(value, path, out);
7706        }
7707        path.pop();
7708    }
7709}
7710
7711impl Sealed for NotifyWebPaymentStartedResponse {}
7712impl Response for NotifyWebPaymentStartedResponse {}
7713
7714/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
7715#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7716pub struct OpenPeriodicEventStreamRequest {
7717    /// The `constantStreamData` member.
7718    #[serde(rename = "constantStreamData")]
7719    pub constant_stream_data: ConstantStreamData,
7720    /// The `customData` member.
7721    #[serde(rename = "customData")]
7722    #[serde(default, skip_serializing_if = "Option::is_none")]
7723    pub custom_data: Option<crate::types::CustomData>,
7724}
7725
7726impl OpenPeriodicEventStreamRequest {
7727    /// Creates a `OpenPeriodicEventStreamRequest` from its required fields.
7728    #[must_use]
7729    pub fn new(constant_stream_data: ConstantStreamData) -> Self {
7730        Self {
7731            constant_stream_data,
7732            custom_data: None,
7733        }
7734    }
7735
7736    /// Sets the optional `customData` field.
7737    #[must_use]
7738    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7739        self.custom_data = Some(value);
7740        self
7741    }
7742}
7743
7744impl Validate for OpenPeriodicEventStreamRequest {
7745    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7746        path.push_key("constantStreamData");
7747        Validate::validate_at(&self.constant_stream_data, path, out);
7748        path.pop();
7749        path.push_key("customData");
7750        if let Some(value) = &self.custom_data {
7751            Validate::validate_at(value, path, out);
7752        }
7753        path.pop();
7754    }
7755}
7756
7757impl Sealed for OpenPeriodicEventStreamRequest {}
7758impl Request for OpenPeriodicEventStreamRequest {
7759    type Action = Action;
7760    const ACTION: Action = Action::OpenPeriodicEventStream;
7761    const KIND: MessageKind = MessageKind::Call;
7762    const ORIGIN: Origin = Origin::ChargingStation;
7763    type Response = OpenPeriodicEventStreamResponse;
7764}
7765
7766impl Confirmed for OpenPeriodicEventStreamRequest {}
7767
7768/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
7769#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7770pub struct OpenPeriodicEventStreamResponse {
7771    /// The `status` member.
7772    pub status: GenericStatus,
7773    /// The `statusInfo` member.
7774    #[serde(rename = "statusInfo")]
7775    #[serde(default, skip_serializing_if = "Option::is_none")]
7776    pub status_info: Option<StatusInfo>,
7777    /// The `customData` member.
7778    #[serde(rename = "customData")]
7779    #[serde(default, skip_serializing_if = "Option::is_none")]
7780    pub custom_data: Option<crate::types::CustomData>,
7781}
7782
7783impl OpenPeriodicEventStreamResponse {
7784    /// Creates a `OpenPeriodicEventStreamResponse` from its required fields.
7785    #[must_use]
7786    pub fn new(status: GenericStatus) -> Self {
7787        Self {
7788            status,
7789            status_info: None,
7790            custom_data: None,
7791        }
7792    }
7793
7794    /// Sets the optional `statusInfo` field.
7795    #[must_use]
7796    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7797        self.status_info = Some(value);
7798        self
7799    }
7800
7801    /// Sets the optional `customData` field.
7802    #[must_use]
7803    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7804        self.custom_data = Some(value);
7805        self
7806    }
7807}
7808
7809impl Validate for OpenPeriodicEventStreamResponse {
7810    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7811        path.push_key("status");
7812        Validate::validate_at(&self.status, path, out);
7813        path.pop();
7814        path.push_key("statusInfo");
7815        if let Some(value) = &self.status_info {
7816            Validate::validate_at(value, path, out);
7817        }
7818        path.pop();
7819        path.push_key("customData");
7820        if let Some(value) = &self.custom_data {
7821            Validate::validate_at(value, path, out);
7822        }
7823        path.pop();
7824    }
7825}
7826
7827impl Sealed for OpenPeriodicEventStreamResponse {}
7828impl Response for OpenPeriodicEventStreamResponse {}
7829
7830/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
7831#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7832pub struct PublishFirmwareRequest {
7833    /// This contains a string containing a URI pointing to a
7834    /// location from which to retrieve the firmware.
7835    pub location: String,
7836    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
7837    pub checksum: String,
7838    /// The Id of the request.
7839    #[serde(rename = "requestId")]
7840    #[serde(deserialize_with = "crate::types::integer::one")]
7841    pub request_id: i32,
7842    /// This specifies how many times Charging Station must retry
7843    /// to download the firmware before giving up. If this field is not
7844    /// present, it is left to Charging Station to decide how many times it wants to retry.
7845    /// If the value is 0, it means: no retries.
7846    #[serde(default, skip_serializing_if = "Option::is_none")]
7847    #[serde(deserialize_with = "crate::types::integer::option")]
7848    pub retries: Option<i32>,
7849    /// The interval in seconds
7850    /// after which a retry may be
7851    /// attempted. If this field is not
7852    /// present, it is left to Charging
7853    /// Station to decide how long to wait
7854    /// between attempts.
7855    #[serde(rename = "retryInterval")]
7856    #[serde(default, skip_serializing_if = "Option::is_none")]
7857    #[serde(deserialize_with = "crate::types::integer::option")]
7858    pub retry_interval: Option<i32>,
7859    /// The `customData` member.
7860    #[serde(rename = "customData")]
7861    #[serde(default, skip_serializing_if = "Option::is_none")]
7862    pub custom_data: Option<crate::types::CustomData>,
7863}
7864
7865impl PublishFirmwareRequest {
7866    /// Creates a `PublishFirmwareRequest` from its required fields.
7867    #[must_use]
7868    pub fn new(location: impl Into<String>, checksum: impl Into<String>, request_id: i32) -> Self {
7869        Self {
7870            location: location.into(),
7871            checksum: checksum.into(),
7872            request_id,
7873            retries: None,
7874            retry_interval: None,
7875            custom_data: None,
7876        }
7877    }
7878
7879    /// Sets the optional `retries` field.
7880    #[must_use]
7881    pub fn with_retries(mut self, value: i32) -> Self {
7882        self.retries = Some(value);
7883        self
7884    }
7885
7886    /// Sets the optional `retryInterval` field.
7887    #[must_use]
7888    pub fn with_retry_interval(mut self, value: i32) -> Self {
7889        self.retry_interval = Some(value);
7890        self
7891    }
7892
7893    /// Sets the optional `customData` field.
7894    #[must_use]
7895    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7896        self.custom_data = Some(value);
7897        self
7898    }
7899}
7900
7901impl Validate for PublishFirmwareRequest {
7902    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7903        path.push_key("location");
7904        validate::string(self.location.as_str(), None, Some(2000), path, out);
7905        path.pop();
7906        path.push_key("checksum");
7907        validate::string(self.checksum.as_str(), None, Some(32), path, out);
7908        path.pop();
7909        path.push_key("requestId");
7910        validate::int_range(i64::from(self.request_id), Some(0), None, path, out);
7911        path.pop();
7912        path.push_key("retries");
7913        if let Some(value) = &self.retries {
7914            validate::int_range(i64::from(*value), Some(0), None, path, out);
7915        }
7916        path.pop();
7917        path.push_key("retryInterval");
7918        if let Some(value) = &self.retry_interval {
7919            validate::int_range(i64::from(*value), Some(0), None, path, out);
7920        }
7921        path.pop();
7922        path.push_key("customData");
7923        if let Some(value) = &self.custom_data {
7924            Validate::validate_at(value, path, out);
7925        }
7926        path.pop();
7927    }
7928}
7929
7930impl Sealed for PublishFirmwareRequest {}
7931impl Request for PublishFirmwareRequest {
7932    type Action = Action;
7933    const ACTION: Action = Action::PublishFirmware;
7934    const KIND: MessageKind = MessageKind::Call;
7935    const ORIGIN: Origin = Origin::Csms;
7936    type Response = PublishFirmwareResponse;
7937}
7938
7939impl Confirmed for PublishFirmwareRequest {}
7940
7941/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
7942#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7943pub struct PublishFirmwareResponse {
7944    /// The `status` member.
7945    pub status: GenericStatus,
7946    /// The `statusInfo` member.
7947    #[serde(rename = "statusInfo")]
7948    #[serde(default, skip_serializing_if = "Option::is_none")]
7949    pub status_info: Option<StatusInfo>,
7950    /// The `customData` member.
7951    #[serde(rename = "customData")]
7952    #[serde(default, skip_serializing_if = "Option::is_none")]
7953    pub custom_data: Option<crate::types::CustomData>,
7954}
7955
7956impl PublishFirmwareResponse {
7957    /// Creates a `PublishFirmwareResponse` from its required fields.
7958    #[must_use]
7959    pub fn new(status: GenericStatus) -> Self {
7960        Self {
7961            status,
7962            status_info: None,
7963            custom_data: None,
7964        }
7965    }
7966
7967    /// Sets the optional `statusInfo` field.
7968    #[must_use]
7969    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7970        self.status_info = Some(value);
7971        self
7972    }
7973
7974    /// Sets the optional `customData` field.
7975    #[must_use]
7976    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7977        self.custom_data = Some(value);
7978        self
7979    }
7980}
7981
7982impl Validate for PublishFirmwareResponse {
7983    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7984        path.push_key("status");
7985        Validate::validate_at(&self.status, path, out);
7986        path.pop();
7987        path.push_key("statusInfo");
7988        if let Some(value) = &self.status_info {
7989            Validate::validate_at(value, path, out);
7990        }
7991        path.pop();
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
8000impl Sealed for PublishFirmwareResponse {}
8001impl Response for PublishFirmwareResponse {}
8002
8003/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
8004#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8005pub struct PublishFirmwareStatusNotificationRequest {
8006    /// The `status` member.
8007    pub status: PublishFirmwareStatus,
8008    /// Required if status is Published. Can be multiple URI’s, if the Local Controller supports e.g. HTTP, HTTPS, and FTP.
8009    #[serde(default, skip_serializing_if = "Option::is_none")]
8010    pub location: Option<Vec<String>>,
8011    /// The request id that was
8012    /// provided in the
8013    /// PublishFirmwareRequest which
8014    /// triggered this action.
8015    #[serde(rename = "requestId")]
8016    #[serde(default, skip_serializing_if = "Option::is_none")]
8017    #[serde(deserialize_with = "crate::types::integer::option")]
8018    pub request_id: Option<i32>,
8019    /// The `statusInfo` member.
8020    #[serde(rename = "statusInfo")]
8021    #[serde(default, skip_serializing_if = "Option::is_none")]
8022    pub status_info: Option<StatusInfo>,
8023    /// The `customData` member.
8024    #[serde(rename = "customData")]
8025    #[serde(default, skip_serializing_if = "Option::is_none")]
8026    pub custom_data: Option<crate::types::CustomData>,
8027}
8028
8029impl PublishFirmwareStatusNotificationRequest {
8030    /// Creates a `PublishFirmwareStatusNotificationRequest` from its required fields.
8031    #[must_use]
8032    pub fn new(status: PublishFirmwareStatus) -> Self {
8033        Self {
8034            status,
8035            location: None,
8036            request_id: None,
8037            status_info: None,
8038            custom_data: None,
8039        }
8040    }
8041
8042    /// Sets the optional `location` field.
8043    #[must_use]
8044    pub fn with_location(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
8045        self.location = Some(value.into_iter().map(Into::into).collect());
8046        self
8047    }
8048
8049    /// Sets the optional `requestId` field.
8050    #[must_use]
8051    pub fn with_request_id(mut self, value: i32) -> Self {
8052        self.request_id = Some(value);
8053        self
8054    }
8055
8056    /// Sets the optional `statusInfo` field.
8057    #[must_use]
8058    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8059        self.status_info = Some(value);
8060        self
8061    }
8062
8063    /// Sets the optional `customData` field.
8064    #[must_use]
8065    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8066        self.custom_data = Some(value);
8067        self
8068    }
8069}
8070
8071impl Validate for PublishFirmwareStatusNotificationRequest {
8072    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8073        path.push_key("status");
8074        Validate::validate_at(&self.status, path, out);
8075        path.pop();
8076        path.push_key("location");
8077        if let Some(value) = &self.location {
8078            validate::list_len(value.len(), Some(1), None, path, out);
8079            for (index, item) in value.iter().enumerate() {
8080                path.push_index(index);
8081                validate::string(item.as_str(), None, Some(2000), path, out);
8082                path.pop();
8083            }
8084        }
8085        path.pop();
8086        path.push_key("requestId");
8087        if let Some(value) = &self.request_id {
8088            validate::int_range(i64::from(*value), Some(0), None, path, out);
8089        }
8090        path.pop();
8091        path.push_key("statusInfo");
8092        if let Some(value) = &self.status_info {
8093            Validate::validate_at(value, path, out);
8094        }
8095        path.pop();
8096        path.push_key("customData");
8097        if let Some(value) = &self.custom_data {
8098            Validate::validate_at(value, path, out);
8099        }
8100        path.pop();
8101    }
8102}
8103
8104impl Sealed for PublishFirmwareStatusNotificationRequest {}
8105impl Request for PublishFirmwareStatusNotificationRequest {
8106    type Action = Action;
8107    const ACTION: Action = Action::PublishFirmwareStatusNotification;
8108    const KIND: MessageKind = MessageKind::Call;
8109    const ORIGIN: Origin = Origin::ChargingStation;
8110    type Response = PublishFirmwareStatusNotificationResponse;
8111}
8112
8113impl Confirmed for PublishFirmwareStatusNotificationRequest {}
8114
8115/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
8116#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8117pub struct PublishFirmwareStatusNotificationResponse {
8118    /// The `customData` member.
8119    #[serde(rename = "customData")]
8120    #[serde(default, skip_serializing_if = "Option::is_none")]
8121    pub custom_data: Option<crate::types::CustomData>,
8122}
8123
8124impl PublishFirmwareStatusNotificationResponse {
8125    /// Creates an empty `PublishFirmwareStatusNotificationResponse`. Every field of this type is optional.
8126    #[must_use]
8127    pub fn new() -> Self {
8128        Self::default()
8129    }
8130
8131    /// Sets the optional `customData` field.
8132    #[must_use]
8133    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8134        self.custom_data = Some(value);
8135        self
8136    }
8137}
8138
8139impl Validate for PublishFirmwareStatusNotificationResponse {
8140    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8141        path.push_key("customData");
8142        if let Some(value) = &self.custom_data {
8143            Validate::validate_at(value, path, out);
8144        }
8145        path.pop();
8146    }
8147}
8148
8149impl Sealed for PublishFirmwareStatusNotificationResponse {}
8150impl Response for PublishFirmwareStatusNotificationResponse {}
8151
8152/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8153#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8154pub struct PullDynamicScheduleUpdateRequest {
8155    /// Id of charging profile to update.
8156    #[serde(rename = "chargingProfileId")]
8157    #[serde(deserialize_with = "crate::types::integer::one")]
8158    pub charging_profile_id: i32,
8159    /// The `customData` member.
8160    #[serde(rename = "customData")]
8161    #[serde(default, skip_serializing_if = "Option::is_none")]
8162    pub custom_data: Option<crate::types::CustomData>,
8163}
8164
8165impl PullDynamicScheduleUpdateRequest {
8166    /// Creates a `PullDynamicScheduleUpdateRequest` from its required fields.
8167    #[must_use]
8168    pub fn new(charging_profile_id: i32) -> Self {
8169        Self {
8170            charging_profile_id,
8171            custom_data: None,
8172        }
8173    }
8174
8175    /// Sets the optional `customData` field.
8176    #[must_use]
8177    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8178        self.custom_data = Some(value);
8179        self
8180    }
8181}
8182
8183impl Validate for PullDynamicScheduleUpdateRequest {
8184    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8185        path.push_key("customData");
8186        if let Some(value) = &self.custom_data {
8187            Validate::validate_at(value, path, out);
8188        }
8189        path.pop();
8190    }
8191}
8192
8193impl Sealed for PullDynamicScheduleUpdateRequest {}
8194impl Request for PullDynamicScheduleUpdateRequest {
8195    type Action = Action;
8196    const ACTION: Action = Action::PullDynamicScheduleUpdate;
8197    const KIND: MessageKind = MessageKind::Call;
8198    const ORIGIN: Origin = Origin::ChargingStation;
8199    type Response = PullDynamicScheduleUpdateResponse;
8200}
8201
8202impl Confirmed for PullDynamicScheduleUpdateRequest {}
8203
8204/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8205#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8206pub struct PullDynamicScheduleUpdateResponse {
8207    /// The `status` member.
8208    pub status: ChargingProfileStatus,
8209    /// The `scheduleUpdate` member.
8210    #[serde(rename = "scheduleUpdate")]
8211    #[serde(default, skip_serializing_if = "Option::is_none")]
8212    pub schedule_update: Option<ChargingScheduleUpdate>,
8213    /// The `statusInfo` member.
8214    #[serde(rename = "statusInfo")]
8215    #[serde(default, skip_serializing_if = "Option::is_none")]
8216    pub status_info: Option<StatusInfo>,
8217    /// The `customData` member.
8218    #[serde(rename = "customData")]
8219    #[serde(default, skip_serializing_if = "Option::is_none")]
8220    pub custom_data: Option<crate::types::CustomData>,
8221}
8222
8223impl PullDynamicScheduleUpdateResponse {
8224    /// Creates a `PullDynamicScheduleUpdateResponse` from its required fields.
8225    #[must_use]
8226    pub fn new(status: ChargingProfileStatus) -> Self {
8227        Self {
8228            status,
8229            schedule_update: None,
8230            status_info: None,
8231            custom_data: None,
8232        }
8233    }
8234
8235    /// Sets the optional `scheduleUpdate` field.
8236    #[must_use]
8237    pub fn with_schedule_update(mut self, value: ChargingScheduleUpdate) -> Self {
8238        self.schedule_update = Some(value);
8239        self
8240    }
8241
8242    /// Sets the optional `statusInfo` field.
8243    #[must_use]
8244    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8245        self.status_info = Some(value);
8246        self
8247    }
8248
8249    /// Sets the optional `customData` field.
8250    #[must_use]
8251    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8252        self.custom_data = Some(value);
8253        self
8254    }
8255}
8256
8257impl Validate for PullDynamicScheduleUpdateResponse {
8258    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8259        path.push_key("status");
8260        Validate::validate_at(&self.status, path, out);
8261        path.pop();
8262        path.push_key("scheduleUpdate");
8263        if let Some(value) = &self.schedule_update {
8264            Validate::validate_at(value, path, out);
8265        }
8266        path.pop();
8267        path.push_key("statusInfo");
8268        if let Some(value) = &self.status_info {
8269            Validate::validate_at(value, path, out);
8270        }
8271        path.pop();
8272        path.push_key("customData");
8273        if let Some(value) = &self.custom_data {
8274            Validate::validate_at(value, path, out);
8275        }
8276        path.pop();
8277    }
8278}
8279
8280impl Sealed for PullDynamicScheduleUpdateResponse {}
8281impl Response for PullDynamicScheduleUpdateResponse {}
8282
8283/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8284#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8285pub struct ReportChargingProfilesRequest {
8286    /// Id used to match the &lt;&lt;getchargingprofilesrequest, GetChargingProfilesRequest&gt;&gt; message with the resulting ReportChargingProfilesRequest messages. When the CSMS provided a requestId in the &lt;&lt;getchargingprofilesrequest, GetChargingProfilesRequest&gt;&gt;, this field SHALL contain the same value.
8287    #[serde(rename = "requestId")]
8288    #[serde(deserialize_with = "crate::types::integer::one")]
8289    pub request_id: i32,
8290    /// Source that has installed this charging profile. Values defined in Appendix as ChargingLimitSourceEnumStringType.
8291    #[serde(rename = "chargingLimitSource")]
8292    pub charging_limit_source: String,
8293    /// The `chargingProfile` member.
8294    #[serde(rename = "chargingProfile")]
8295    pub charging_profile: Vec<ChargingProfile>,
8296    /// The evse to which the charging profile applies. If evseId = 0, the message contains an overall limit for the Charging Station.
8297    #[serde(rename = "evseId")]
8298    #[serde(deserialize_with = "crate::types::integer::one")]
8299    pub evse_id: i32,
8300    /// To Be Continued. Default value when omitted: false. false indicates that there are no further messages as part of this report.
8301    /// Schema default: `false`.
8302    #[serde(default, skip_serializing_if = "Option::is_none")]
8303    pub tbc: Option<bool>,
8304    /// The `customData` member.
8305    #[serde(rename = "customData")]
8306    #[serde(default, skip_serializing_if = "Option::is_none")]
8307    pub custom_data: Option<crate::types::CustomData>,
8308}
8309
8310impl ReportChargingProfilesRequest {
8311    /// Creates a `ReportChargingProfilesRequest` from its required fields.
8312    #[must_use]
8313    pub fn new(
8314        request_id: i32,
8315        charging_limit_source: impl Into<String>,
8316        charging_profile: Vec<ChargingProfile>,
8317        evse_id: i32,
8318    ) -> Self {
8319        Self {
8320            request_id,
8321            charging_limit_source: charging_limit_source.into(),
8322            charging_profile,
8323            evse_id,
8324            tbc: None,
8325            custom_data: None,
8326        }
8327    }
8328
8329    /// Sets the optional `tbc` field.
8330    #[must_use]
8331    pub fn with_tbc(mut self, value: bool) -> Self {
8332        self.tbc = Some(value);
8333        self
8334    }
8335
8336    /// Sets the optional `customData` field.
8337    #[must_use]
8338    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8339        self.custom_data = Some(value);
8340        self
8341    }
8342}
8343
8344impl Validate for ReportChargingProfilesRequest {
8345    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8346        path.push_key("chargingLimitSource");
8347        validate::string(
8348            self.charging_limit_source.as_str(),
8349            None,
8350            Some(20),
8351            path,
8352            out,
8353        );
8354        path.pop();
8355        path.push_key("chargingProfile");
8356        validate::list_len(self.charging_profile.len(), Some(1), None, path, out);
8357        for (index, item) in self.charging_profile.iter().enumerate() {
8358            path.push_index(index);
8359            Validate::validate_at(item, path, out);
8360            path.pop();
8361        }
8362        path.pop();
8363        path.push_key("evseId");
8364        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
8365        path.pop();
8366        path.push_key("customData");
8367        if let Some(value) = &self.custom_data {
8368            Validate::validate_at(value, path, out);
8369        }
8370        path.pop();
8371    }
8372}
8373
8374impl Sealed for ReportChargingProfilesRequest {}
8375impl Request for ReportChargingProfilesRequest {
8376    type Action = Action;
8377    const ACTION: Action = Action::ReportChargingProfiles;
8378    const KIND: MessageKind = MessageKind::Call;
8379    const ORIGIN: Origin = Origin::ChargingStation;
8380    type Response = ReportChargingProfilesResponse;
8381}
8382
8383impl Confirmed for ReportChargingProfilesRequest {}
8384
8385/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8386#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8387pub struct ReportChargingProfilesResponse {
8388    /// The `customData` member.
8389    #[serde(rename = "customData")]
8390    #[serde(default, skip_serializing_if = "Option::is_none")]
8391    pub custom_data: Option<crate::types::CustomData>,
8392}
8393
8394impl ReportChargingProfilesResponse {
8395    /// Creates an empty `ReportChargingProfilesResponse`. Every field of this type is optional.
8396    #[must_use]
8397    pub fn new() -> Self {
8398        Self::default()
8399    }
8400
8401    /// Sets the optional `customData` field.
8402    #[must_use]
8403    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8404        self.custom_data = Some(value);
8405        self
8406    }
8407}
8408
8409impl Validate for ReportChargingProfilesResponse {
8410    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8411        path.push_key("customData");
8412        if let Some(value) = &self.custom_data {
8413            Validate::validate_at(value, path, out);
8414        }
8415        path.pop();
8416    }
8417}
8418
8419impl Sealed for ReportChargingProfilesResponse {}
8420impl Response for ReportChargingProfilesResponse {}
8421
8422/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
8423#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8424pub struct ReportDERControlRequest {
8425    /// RequestId from GetDERControlRequest.
8426    #[serde(rename = "requestId")]
8427    #[serde(deserialize_with = "crate::types::integer::one")]
8428    pub request_id: i32,
8429    /// The `curve` member.
8430    #[serde(default, skip_serializing_if = "Option::is_none")]
8431    pub curve: Option<Vec<DERCurveGet>>,
8432    /// The `enterService` member.
8433    #[serde(rename = "enterService")]
8434    #[serde(default, skip_serializing_if = "Option::is_none")]
8435    pub enter_service: Option<Vec<EnterServiceGet>>,
8436    /// The `fixedPFAbsorb` member.
8437    #[serde(rename = "fixedPFAbsorb")]
8438    #[serde(default, skip_serializing_if = "Option::is_none")]
8439    pub fixed_pf_absorb: Option<Vec<FixedPFGet>>,
8440    /// The `fixedPFInject` member.
8441    #[serde(rename = "fixedPFInject")]
8442    #[serde(default, skip_serializing_if = "Option::is_none")]
8443    pub fixed_pf_inject: Option<Vec<FixedPFGet>>,
8444    /// The `fixedVar` member.
8445    #[serde(rename = "fixedVar")]
8446    #[serde(default, skip_serializing_if = "Option::is_none")]
8447    pub fixed_var: Option<Vec<FixedVarGet>>,
8448    /// The `freqDroop` member.
8449    #[serde(rename = "freqDroop")]
8450    #[serde(default, skip_serializing_if = "Option::is_none")]
8451    pub freq_droop: Option<Vec<FreqDroopGet>>,
8452    /// The `gradient` member.
8453    #[serde(default, skip_serializing_if = "Option::is_none")]
8454    pub gradient: Option<Vec<GradientGet>>,
8455    /// The `limitMaxDischarge` member.
8456    #[serde(rename = "limitMaxDischarge")]
8457    #[serde(default, skip_serializing_if = "Option::is_none")]
8458    pub limit_max_discharge: Option<Vec<LimitMaxDischargeGet>>,
8459    /// To Be Continued. Default value when omitted: false. +
8460    /// False indicates that there are no further messages as part of this report.
8461    #[serde(default, skip_serializing_if = "Option::is_none")]
8462    pub tbc: Option<bool>,
8463    /// The `customData` member.
8464    #[serde(rename = "customData")]
8465    #[serde(default, skip_serializing_if = "Option::is_none")]
8466    pub custom_data: Option<crate::types::CustomData>,
8467}
8468
8469impl ReportDERControlRequest {
8470    /// Creates a `ReportDERControlRequest` from its required fields.
8471    #[must_use]
8472    pub fn new(request_id: i32) -> Self {
8473        Self {
8474            request_id,
8475            curve: None,
8476            enter_service: None,
8477            fixed_pf_absorb: None,
8478            fixed_pf_inject: None,
8479            fixed_var: None,
8480            freq_droop: None,
8481            gradient: None,
8482            limit_max_discharge: None,
8483            tbc: None,
8484            custom_data: None,
8485        }
8486    }
8487
8488    /// Sets the optional `curve` field.
8489    #[must_use]
8490    pub fn with_curve(mut self, value: Vec<DERCurveGet>) -> Self {
8491        self.curve = Some(value);
8492        self
8493    }
8494
8495    /// Sets the optional `enterService` field.
8496    #[must_use]
8497    pub fn with_enter_service(mut self, value: Vec<EnterServiceGet>) -> Self {
8498        self.enter_service = Some(value);
8499        self
8500    }
8501
8502    /// Sets the optional `fixedPFAbsorb` field.
8503    #[must_use]
8504    pub fn with_fixed_pf_absorb(mut self, value: Vec<FixedPFGet>) -> Self {
8505        self.fixed_pf_absorb = Some(value);
8506        self
8507    }
8508
8509    /// Sets the optional `fixedPFInject` field.
8510    #[must_use]
8511    pub fn with_fixed_pf_inject(mut self, value: Vec<FixedPFGet>) -> Self {
8512        self.fixed_pf_inject = Some(value);
8513        self
8514    }
8515
8516    /// Sets the optional `fixedVar` field.
8517    #[must_use]
8518    pub fn with_fixed_var(mut self, value: Vec<FixedVarGet>) -> Self {
8519        self.fixed_var = Some(value);
8520        self
8521    }
8522
8523    /// Sets the optional `freqDroop` field.
8524    #[must_use]
8525    pub fn with_freq_droop(mut self, value: Vec<FreqDroopGet>) -> Self {
8526        self.freq_droop = Some(value);
8527        self
8528    }
8529
8530    /// Sets the optional `gradient` field.
8531    #[must_use]
8532    pub fn with_gradient(mut self, value: Vec<GradientGet>) -> Self {
8533        self.gradient = Some(value);
8534        self
8535    }
8536
8537    /// Sets the optional `limitMaxDischarge` field.
8538    #[must_use]
8539    pub fn with_limit_max_discharge(mut self, value: Vec<LimitMaxDischargeGet>) -> Self {
8540        self.limit_max_discharge = Some(value);
8541        self
8542    }
8543
8544    /// Sets the optional `tbc` field.
8545    #[must_use]
8546    pub fn with_tbc(mut self, value: bool) -> Self {
8547        self.tbc = Some(value);
8548        self
8549    }
8550
8551    /// Sets the optional `customData` field.
8552    #[must_use]
8553    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8554        self.custom_data = Some(value);
8555        self
8556    }
8557}
8558
8559impl Validate for ReportDERControlRequest {
8560    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8561        path.push_key("curve");
8562        if let Some(value) = &self.curve {
8563            validate::list_len(value.len(), Some(1), Some(24), path, out);
8564            for (index, item) in value.iter().enumerate() {
8565                path.push_index(index);
8566                Validate::validate_at(item, path, out);
8567                path.pop();
8568            }
8569        }
8570        path.pop();
8571        path.push_key("enterService");
8572        if let Some(value) = &self.enter_service {
8573            validate::list_len(value.len(), Some(1), Some(24), path, out);
8574            for (index, item) in value.iter().enumerate() {
8575                path.push_index(index);
8576                Validate::validate_at(item, path, out);
8577                path.pop();
8578            }
8579        }
8580        path.pop();
8581        path.push_key("fixedPFAbsorb");
8582        if let Some(value) = &self.fixed_pf_absorb {
8583            validate::list_len(value.len(), Some(1), Some(24), path, out);
8584            for (index, item) in value.iter().enumerate() {
8585                path.push_index(index);
8586                Validate::validate_at(item, path, out);
8587                path.pop();
8588            }
8589        }
8590        path.pop();
8591        path.push_key("fixedPFInject");
8592        if let Some(value) = &self.fixed_pf_inject {
8593            validate::list_len(value.len(), Some(1), Some(24), path, out);
8594            for (index, item) in value.iter().enumerate() {
8595                path.push_index(index);
8596                Validate::validate_at(item, path, out);
8597                path.pop();
8598            }
8599        }
8600        path.pop();
8601        path.push_key("fixedVar");
8602        if let Some(value) = &self.fixed_var {
8603            validate::list_len(value.len(), Some(1), Some(24), path, out);
8604            for (index, item) in value.iter().enumerate() {
8605                path.push_index(index);
8606                Validate::validate_at(item, path, out);
8607                path.pop();
8608            }
8609        }
8610        path.pop();
8611        path.push_key("freqDroop");
8612        if let Some(value) = &self.freq_droop {
8613            validate::list_len(value.len(), Some(1), Some(24), path, out);
8614            for (index, item) in value.iter().enumerate() {
8615                path.push_index(index);
8616                Validate::validate_at(item, path, out);
8617                path.pop();
8618            }
8619        }
8620        path.pop();
8621        path.push_key("gradient");
8622        if let Some(value) = &self.gradient {
8623            validate::list_len(value.len(), Some(1), Some(24), path, out);
8624            for (index, item) in value.iter().enumerate() {
8625                path.push_index(index);
8626                Validate::validate_at(item, path, out);
8627                path.pop();
8628            }
8629        }
8630        path.pop();
8631        path.push_key("limitMaxDischarge");
8632        if let Some(value) = &self.limit_max_discharge {
8633            validate::list_len(value.len(), Some(1), Some(24), path, out);
8634            for (index, item) in value.iter().enumerate() {
8635                path.push_index(index);
8636                Validate::validate_at(item, path, out);
8637                path.pop();
8638            }
8639        }
8640        path.pop();
8641        path.push_key("customData");
8642        if let Some(value) = &self.custom_data {
8643            Validate::validate_at(value, path, out);
8644        }
8645        path.pop();
8646    }
8647}
8648
8649impl Sealed for ReportDERControlRequest {}
8650impl Request for ReportDERControlRequest {
8651    type Action = Action;
8652    const ACTION: Action = Action::ReportDERControl;
8653    const KIND: MessageKind = MessageKind::Call;
8654    const ORIGIN: Origin = Origin::ChargingStation;
8655    type Response = ReportDERControlResponse;
8656}
8657
8658impl Confirmed for ReportDERControlRequest {}
8659
8660/// This message has no parameters.
8661///
8662/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
8663#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8664pub struct ReportDERControlResponse {
8665    /// The `customData` member.
8666    #[serde(rename = "customData")]
8667    #[serde(default, skip_serializing_if = "Option::is_none")]
8668    pub custom_data: Option<crate::types::CustomData>,
8669}
8670
8671impl ReportDERControlResponse {
8672    /// Creates an empty `ReportDERControlResponse`. Every field of this type is optional.
8673    #[must_use]
8674    pub fn new() -> Self {
8675        Self::default()
8676    }
8677
8678    /// Sets the optional `customData` field.
8679    #[must_use]
8680    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8681        self.custom_data = Some(value);
8682        self
8683    }
8684}
8685
8686impl Validate for ReportDERControlResponse {
8687    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8688        path.push_key("customData");
8689        if let Some(value) = &self.custom_data {
8690            Validate::validate_at(value, path, out);
8691        }
8692        path.pop();
8693    }
8694}
8695
8696impl Sealed for ReportDERControlResponse {}
8697impl Response for ReportDERControlResponse {}
8698
8699/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
8700#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8701pub struct RequestBatterySwapRequest {
8702    /// The `idToken` member.
8703    #[serde(rename = "idToken")]
8704    pub id_token: IdToken,
8705    /// Request id to match with BatterySwapRequest.
8706    #[serde(rename = "requestId")]
8707    #[serde(deserialize_with = "crate::types::integer::one")]
8708    pub request_id: i32,
8709    /// The `customData` member.
8710    #[serde(rename = "customData")]
8711    #[serde(default, skip_serializing_if = "Option::is_none")]
8712    pub custom_data: Option<crate::types::CustomData>,
8713}
8714
8715impl RequestBatterySwapRequest {
8716    /// Creates a `RequestBatterySwapRequest` from its required fields.
8717    #[must_use]
8718    pub fn new(id_token: IdToken, request_id: i32) -> Self {
8719        Self {
8720            id_token,
8721            request_id,
8722            custom_data: None,
8723        }
8724    }
8725
8726    /// Sets the optional `customData` field.
8727    #[must_use]
8728    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8729        self.custom_data = Some(value);
8730        self
8731    }
8732}
8733
8734impl Validate for RequestBatterySwapRequest {
8735    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8736        path.push_key("idToken");
8737        Validate::validate_at(&self.id_token, path, out);
8738        path.pop();
8739        path.push_key("customData");
8740        if let Some(value) = &self.custom_data {
8741            Validate::validate_at(value, path, out);
8742        }
8743        path.pop();
8744    }
8745}
8746
8747impl Sealed for RequestBatterySwapRequest {}
8748impl Request for RequestBatterySwapRequest {
8749    type Action = Action;
8750    const ACTION: Action = Action::RequestBatterySwap;
8751    const KIND: MessageKind = MessageKind::Call;
8752    const ORIGIN: Origin = Origin::Csms;
8753    type Response = RequestBatterySwapResponse;
8754}
8755
8756impl Confirmed for RequestBatterySwapRequest {}
8757
8758/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
8759#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8760pub struct RequestBatterySwapResponse {
8761    /// The `status` member.
8762    pub status: GenericStatus,
8763    /// The `statusInfo` member.
8764    #[serde(rename = "statusInfo")]
8765    #[serde(default, skip_serializing_if = "Option::is_none")]
8766    pub status_info: Option<StatusInfo>,
8767    /// The `customData` member.
8768    #[serde(rename = "customData")]
8769    #[serde(default, skip_serializing_if = "Option::is_none")]
8770    pub custom_data: Option<crate::types::CustomData>,
8771}
8772
8773impl RequestBatterySwapResponse {
8774    /// Creates a `RequestBatterySwapResponse` from its required fields.
8775    #[must_use]
8776    pub fn new(status: GenericStatus) -> Self {
8777        Self {
8778            status,
8779            status_info: None,
8780            custom_data: None,
8781        }
8782    }
8783
8784    /// Sets the optional `statusInfo` field.
8785    #[must_use]
8786    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8787        self.status_info = Some(value);
8788        self
8789    }
8790
8791    /// Sets the optional `customData` field.
8792    #[must_use]
8793    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8794        self.custom_data = Some(value);
8795        self
8796    }
8797}
8798
8799impl Validate for RequestBatterySwapResponse {
8800    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8801        path.push_key("status");
8802        Validate::validate_at(&self.status, path, out);
8803        path.pop();
8804        path.push_key("statusInfo");
8805        if let Some(value) = &self.status_info {
8806            Validate::validate_at(value, path, out);
8807        }
8808        path.pop();
8809        path.push_key("customData");
8810        if let Some(value) = &self.custom_data {
8811            Validate::validate_at(value, path, out);
8812        }
8813        path.pop();
8814    }
8815}
8816
8817impl Sealed for RequestBatterySwapResponse {}
8818impl Response for RequestBatterySwapResponse {}
8819
8820/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
8821#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8822pub struct RequestStartTransactionRequest {
8823    /// The `idToken` member.
8824    #[serde(rename = "idToken")]
8825    pub id_token: IdToken,
8826    /// Id given by the server to this start request. The Charging Station will return this in the &lt;&lt;transactioneventrequest, TransactionEventRequest&gt;&gt;, letting the server know which transaction was started for this request. Use to start a transaction.
8827    #[serde(rename = "remoteStartId")]
8828    #[serde(deserialize_with = "crate::types::integer::one")]
8829    pub remote_start_id: i32,
8830    /// Number of the EVSE on which to start the transaction. EvseId SHALL be &gt; 0
8831    #[serde(rename = "evseId")]
8832    #[serde(default, skip_serializing_if = "Option::is_none")]
8833    #[serde(deserialize_with = "crate::types::integer::option")]
8834    pub evse_id: Option<i32>,
8835    /// The `groupIdToken` member.
8836    #[serde(rename = "groupIdToken")]
8837    #[serde(default, skip_serializing_if = "Option::is_none")]
8838    pub group_id_token: Option<IdToken>,
8839    /// The `chargingProfile` member.
8840    #[serde(rename = "chargingProfile")]
8841    #[serde(default, skip_serializing_if = "Option::is_none")]
8842    pub charging_profile: Option<ChargingProfile>,
8843    /// The `customData` member.
8844    #[serde(rename = "customData")]
8845    #[serde(default, skip_serializing_if = "Option::is_none")]
8846    pub custom_data: Option<crate::types::CustomData>,
8847}
8848
8849impl RequestStartTransactionRequest {
8850    /// Creates a `RequestStartTransactionRequest` from its required fields.
8851    #[must_use]
8852    pub fn new(id_token: IdToken, remote_start_id: i32) -> Self {
8853        Self {
8854            id_token,
8855            remote_start_id,
8856            evse_id: None,
8857            group_id_token: None,
8858            charging_profile: None,
8859            custom_data: None,
8860        }
8861    }
8862
8863    /// Sets the optional `evseId` field.
8864    #[must_use]
8865    pub fn with_evse_id(mut self, value: i32) -> Self {
8866        self.evse_id = Some(value);
8867        self
8868    }
8869
8870    /// Sets the optional `groupIdToken` field.
8871    #[must_use]
8872    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
8873        self.group_id_token = Some(value);
8874        self
8875    }
8876
8877    /// Sets the optional `chargingProfile` field.
8878    #[must_use]
8879    pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
8880        self.charging_profile = Some(value);
8881        self
8882    }
8883
8884    /// Sets the optional `customData` field.
8885    #[must_use]
8886    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8887        self.custom_data = Some(value);
8888        self
8889    }
8890}
8891
8892impl Validate for RequestStartTransactionRequest {
8893    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8894        path.push_key("idToken");
8895        Validate::validate_at(&self.id_token, path, out);
8896        path.pop();
8897        path.push_key("evseId");
8898        if let Some(value) = &self.evse_id {
8899            validate::int_range(i64::from(*value), Some(1), None, path, out);
8900        }
8901        path.pop();
8902        path.push_key("groupIdToken");
8903        if let Some(value) = &self.group_id_token {
8904            Validate::validate_at(value, path, out);
8905        }
8906        path.pop();
8907        path.push_key("chargingProfile");
8908        if let Some(value) = &self.charging_profile {
8909            Validate::validate_at(value, path, out);
8910        }
8911        path.pop();
8912        path.push_key("customData");
8913        if let Some(value) = &self.custom_data {
8914            Validate::validate_at(value, path, out);
8915        }
8916        path.pop();
8917    }
8918}
8919
8920impl Sealed for RequestStartTransactionRequest {}
8921impl Request for RequestStartTransactionRequest {
8922    type Action = Action;
8923    const ACTION: Action = Action::RequestStartTransaction;
8924    const KIND: MessageKind = MessageKind::Call;
8925    const ORIGIN: Origin = Origin::Csms;
8926    type Response = RequestStartTransactionResponse;
8927}
8928
8929impl Confirmed for RequestStartTransactionRequest {}
8930
8931/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
8932#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8933pub struct RequestStartTransactionResponse {
8934    /// The `status` member.
8935    pub status: RequestStartStopStatus,
8936    /// The `statusInfo` member.
8937    #[serde(rename = "statusInfo")]
8938    #[serde(default, skip_serializing_if = "Option::is_none")]
8939    pub status_info: Option<StatusInfo>,
8940    /// When the transaction was already started by the Charging Station before the RequestStartTransactionRequest was received, for example: cable plugged in first. This contains the transactionId of the already started transaction.
8941    #[serde(rename = "transactionId")]
8942    #[serde(default, skip_serializing_if = "Option::is_none")]
8943    pub transaction_id: Option<String>,
8944    /// The `customData` member.
8945    #[serde(rename = "customData")]
8946    #[serde(default, skip_serializing_if = "Option::is_none")]
8947    pub custom_data: Option<crate::types::CustomData>,
8948}
8949
8950impl RequestStartTransactionResponse {
8951    /// Creates a `RequestStartTransactionResponse` from its required fields.
8952    #[must_use]
8953    pub fn new(status: RequestStartStopStatus) -> Self {
8954        Self {
8955            status,
8956            status_info: None,
8957            transaction_id: None,
8958            custom_data: None,
8959        }
8960    }
8961
8962    /// Sets the optional `statusInfo` field.
8963    #[must_use]
8964    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8965        self.status_info = Some(value);
8966        self
8967    }
8968
8969    /// Sets the optional `transactionId` field.
8970    #[must_use]
8971    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
8972        self.transaction_id = Some(value.into());
8973        self
8974    }
8975
8976    /// Sets the optional `customData` field.
8977    #[must_use]
8978    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8979        self.custom_data = Some(value);
8980        self
8981    }
8982}
8983
8984impl Validate for RequestStartTransactionResponse {
8985    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8986        path.push_key("status");
8987        Validate::validate_at(&self.status, path, out);
8988        path.pop();
8989        path.push_key("statusInfo");
8990        if let Some(value) = &self.status_info {
8991            Validate::validate_at(value, path, out);
8992        }
8993        path.pop();
8994        path.push_key("transactionId");
8995        if let Some(value) = &self.transaction_id {
8996            validate::string(value.as_str(), None, Some(36), path, out);
8997        }
8998        path.pop();
8999        path.push_key("customData");
9000        if let Some(value) = &self.custom_data {
9001            Validate::validate_at(value, path, out);
9002        }
9003        path.pop();
9004    }
9005}
9006
9007impl Sealed for RequestStartTransactionResponse {}
9008impl Response for RequestStartTransactionResponse {}
9009
9010/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
9011#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9012pub struct RequestStopTransactionRequest {
9013    /// The identifier of the transaction which the Charging Station is requested to stop.
9014    #[serde(rename = "transactionId")]
9015    pub transaction_id: String,
9016    /// The `customData` member.
9017    #[serde(rename = "customData")]
9018    #[serde(default, skip_serializing_if = "Option::is_none")]
9019    pub custom_data: Option<crate::types::CustomData>,
9020}
9021
9022impl RequestStopTransactionRequest {
9023    /// Creates a `RequestStopTransactionRequest` from its required fields.
9024    #[must_use]
9025    pub fn new(transaction_id: impl Into<String>) -> Self {
9026        Self {
9027            transaction_id: transaction_id.into(),
9028            custom_data: None,
9029        }
9030    }
9031
9032    /// Sets the optional `customData` field.
9033    #[must_use]
9034    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9035        self.custom_data = Some(value);
9036        self
9037    }
9038}
9039
9040impl Validate for RequestStopTransactionRequest {
9041    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9042        path.push_key("transactionId");
9043        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
9044        path.pop();
9045        path.push_key("customData");
9046        if let Some(value) = &self.custom_data {
9047            Validate::validate_at(value, path, out);
9048        }
9049        path.pop();
9050    }
9051}
9052
9053impl Sealed for RequestStopTransactionRequest {}
9054impl Request for RequestStopTransactionRequest {
9055    type Action = Action;
9056    const ACTION: Action = Action::RequestStopTransaction;
9057    const KIND: MessageKind = MessageKind::Call;
9058    const ORIGIN: Origin = Origin::Csms;
9059    type Response = RequestStopTransactionResponse;
9060}
9061
9062impl Confirmed for RequestStopTransactionRequest {}
9063
9064/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
9065#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9066pub struct RequestStopTransactionResponse {
9067    /// The `status` member.
9068    pub status: RequestStartStopStatus,
9069    /// The `statusInfo` member.
9070    #[serde(rename = "statusInfo")]
9071    #[serde(default, skip_serializing_if = "Option::is_none")]
9072    pub status_info: Option<StatusInfo>,
9073    /// The `customData` member.
9074    #[serde(rename = "customData")]
9075    #[serde(default, skip_serializing_if = "Option::is_none")]
9076    pub custom_data: Option<crate::types::CustomData>,
9077}
9078
9079impl RequestStopTransactionResponse {
9080    /// Creates a `RequestStopTransactionResponse` from its required fields.
9081    #[must_use]
9082    pub fn new(status: RequestStartStopStatus) -> Self {
9083        Self {
9084            status,
9085            status_info: None,
9086            custom_data: None,
9087        }
9088    }
9089
9090    /// Sets the optional `statusInfo` field.
9091    #[must_use]
9092    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9093        self.status_info = Some(value);
9094        self
9095    }
9096
9097    /// Sets the optional `customData` field.
9098    #[must_use]
9099    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9100        self.custom_data = Some(value);
9101        self
9102    }
9103}
9104
9105impl Validate for RequestStopTransactionResponse {
9106    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9107        path.push_key("status");
9108        Validate::validate_at(&self.status, path, out);
9109        path.pop();
9110        path.push_key("statusInfo");
9111        if let Some(value) = &self.status_info {
9112            Validate::validate_at(value, path, out);
9113        }
9114        path.pop();
9115        path.push_key("customData");
9116        if let Some(value) = &self.custom_data {
9117            Validate::validate_at(value, path, out);
9118        }
9119        path.pop();
9120    }
9121}
9122
9123impl Sealed for RequestStopTransactionResponse {}
9124impl Response for RequestStopTransactionResponse {}
9125
9126/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
9127#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9128pub struct ReservationStatusUpdateRequest {
9129    /// The ID of the reservation.
9130    #[serde(rename = "reservationId")]
9131    #[serde(deserialize_with = "crate::types::integer::one")]
9132    pub reservation_id: i32,
9133    /// The `reservationUpdateStatus` member.
9134    #[serde(rename = "reservationUpdateStatus")]
9135    pub reservation_update_status: ReservationUpdateStatus,
9136    /// The `customData` member.
9137    #[serde(rename = "customData")]
9138    #[serde(default, skip_serializing_if = "Option::is_none")]
9139    pub custom_data: Option<crate::types::CustomData>,
9140}
9141
9142impl ReservationStatusUpdateRequest {
9143    /// Creates a `ReservationStatusUpdateRequest` from its required fields.
9144    #[must_use]
9145    pub fn new(reservation_id: i32, reservation_update_status: ReservationUpdateStatus) -> Self {
9146        Self {
9147            reservation_id,
9148            reservation_update_status,
9149            custom_data: None,
9150        }
9151    }
9152
9153    /// Sets the optional `customData` field.
9154    #[must_use]
9155    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9156        self.custom_data = Some(value);
9157        self
9158    }
9159}
9160
9161impl Validate for ReservationStatusUpdateRequest {
9162    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9163        path.push_key("reservationId");
9164        validate::int_range(i64::from(self.reservation_id), Some(0), None, path, out);
9165        path.pop();
9166        path.push_key("reservationUpdateStatus");
9167        Validate::validate_at(&self.reservation_update_status, path, out);
9168        path.pop();
9169        path.push_key("customData");
9170        if let Some(value) = &self.custom_data {
9171            Validate::validate_at(value, path, out);
9172        }
9173        path.pop();
9174    }
9175}
9176
9177impl Sealed for ReservationStatusUpdateRequest {}
9178impl Request for ReservationStatusUpdateRequest {
9179    type Action = Action;
9180    const ACTION: Action = Action::ReservationStatusUpdate;
9181    const KIND: MessageKind = MessageKind::Call;
9182    const ORIGIN: Origin = Origin::ChargingStation;
9183    type Response = ReservationStatusUpdateResponse;
9184}
9185
9186impl Confirmed for ReservationStatusUpdateRequest {}
9187
9188/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
9189#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9190pub struct ReservationStatusUpdateResponse {
9191    /// The `customData` member.
9192    #[serde(rename = "customData")]
9193    #[serde(default, skip_serializing_if = "Option::is_none")]
9194    pub custom_data: Option<crate::types::CustomData>,
9195}
9196
9197impl ReservationStatusUpdateResponse {
9198    /// Creates an empty `ReservationStatusUpdateResponse`. Every field of this type is optional.
9199    #[must_use]
9200    pub fn new() -> Self {
9201        Self::default()
9202    }
9203
9204    /// Sets the optional `customData` field.
9205    #[must_use]
9206    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9207        self.custom_data = Some(value);
9208        self
9209    }
9210}
9211
9212impl Validate for ReservationStatusUpdateResponse {
9213    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9214        path.push_key("customData");
9215        if let Some(value) = &self.custom_data {
9216            Validate::validate_at(value, path, out);
9217        }
9218        path.pop();
9219    }
9220}
9221
9222impl Sealed for ReservationStatusUpdateResponse {}
9223impl Response for ReservationStatusUpdateResponse {}
9224
9225/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
9226#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9227pub struct ReserveNowRequest {
9228    /// Id of reservation.
9229    #[serde(deserialize_with = "crate::types::integer::one")]
9230    pub id: i32,
9231    /// Date and time at which the reservation expires.
9232    #[serde(rename = "expiryDateTime")]
9233    pub expiry_date_time: crate::types::DateTime,
9234    /// The `idToken` member.
9235    #[serde(rename = "idToken")]
9236    pub id_token: IdToken,
9237    /// This field specifies the connector type. Values defined in Appendix as ConnectorEnumStringType.
9238    #[serde(rename = "connectorType")]
9239    #[serde(default, skip_serializing_if = "Option::is_none")]
9240    pub connector_type: Option<String>,
9241    /// This contains ID of the evse to be reserved.
9242    #[serde(rename = "evseId")]
9243    #[serde(default, skip_serializing_if = "Option::is_none")]
9244    #[serde(deserialize_with = "crate::types::integer::option")]
9245    pub evse_id: Option<i32>,
9246    /// The `groupIdToken` member.
9247    #[serde(rename = "groupIdToken")]
9248    #[serde(default, skip_serializing_if = "Option::is_none")]
9249    pub group_id_token: Option<IdToken>,
9250    /// The `customData` member.
9251    #[serde(rename = "customData")]
9252    #[serde(default, skip_serializing_if = "Option::is_none")]
9253    pub custom_data: Option<crate::types::CustomData>,
9254}
9255
9256impl ReserveNowRequest {
9257    /// Creates a `ReserveNowRequest` from its required fields.
9258    #[must_use]
9259    pub fn new(
9260        id: i32,
9261        expiry_date_time: impl Into<crate::types::DateTime>,
9262        id_token: IdToken,
9263    ) -> Self {
9264        Self {
9265            id,
9266            expiry_date_time: expiry_date_time.into(),
9267            id_token,
9268            connector_type: None,
9269            evse_id: None,
9270            group_id_token: None,
9271            custom_data: None,
9272        }
9273    }
9274
9275    /// Sets the optional `connectorType` field.
9276    #[must_use]
9277    pub fn with_connector_type(mut self, value: impl Into<String>) -> Self {
9278        self.connector_type = Some(value.into());
9279        self
9280    }
9281
9282    /// Sets the optional `evseId` field.
9283    #[must_use]
9284    pub fn with_evse_id(mut self, value: i32) -> Self {
9285        self.evse_id = Some(value);
9286        self
9287    }
9288
9289    /// Sets the optional `groupIdToken` field.
9290    #[must_use]
9291    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
9292        self.group_id_token = Some(value);
9293        self
9294    }
9295
9296    /// Sets the optional `customData` field.
9297    #[must_use]
9298    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9299        self.custom_data = Some(value);
9300        self
9301    }
9302}
9303
9304impl Validate for ReserveNowRequest {
9305    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9306        path.push_key("id");
9307        validate::int_range(i64::from(self.id), Some(0), None, path, out);
9308        path.pop();
9309        path.push_key("idToken");
9310        Validate::validate_at(&self.id_token, path, out);
9311        path.pop();
9312        path.push_key("connectorType");
9313        if let Some(value) = &self.connector_type {
9314            validate::string(value.as_str(), None, Some(20), path, out);
9315        }
9316        path.pop();
9317        path.push_key("evseId");
9318        if let Some(value) = &self.evse_id {
9319            validate::int_range(i64::from(*value), Some(0), None, path, out);
9320        }
9321        path.pop();
9322        path.push_key("groupIdToken");
9323        if let Some(value) = &self.group_id_token {
9324            Validate::validate_at(value, path, out);
9325        }
9326        path.pop();
9327        path.push_key("customData");
9328        if let Some(value) = &self.custom_data {
9329            Validate::validate_at(value, path, out);
9330        }
9331        path.pop();
9332    }
9333}
9334
9335impl Sealed for ReserveNowRequest {}
9336impl Request for ReserveNowRequest {
9337    type Action = Action;
9338    const ACTION: Action = Action::ReserveNow;
9339    const KIND: MessageKind = MessageKind::Call;
9340    const ORIGIN: Origin = Origin::Csms;
9341    type Response = ReserveNowResponse;
9342}
9343
9344impl Confirmed for ReserveNowRequest {}
9345
9346/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
9347#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9348pub struct ReserveNowResponse {
9349    /// The `status` member.
9350    pub status: ReserveNowStatus,
9351    /// The `statusInfo` member.
9352    #[serde(rename = "statusInfo")]
9353    #[serde(default, skip_serializing_if = "Option::is_none")]
9354    pub status_info: Option<StatusInfo>,
9355    /// The `customData` member.
9356    #[serde(rename = "customData")]
9357    #[serde(default, skip_serializing_if = "Option::is_none")]
9358    pub custom_data: Option<crate::types::CustomData>,
9359}
9360
9361impl ReserveNowResponse {
9362    /// Creates a `ReserveNowResponse` from its required fields.
9363    #[must_use]
9364    pub fn new(status: ReserveNowStatus) -> Self {
9365        Self {
9366            status,
9367            status_info: None,
9368            custom_data: None,
9369        }
9370    }
9371
9372    /// Sets the optional `statusInfo` field.
9373    #[must_use]
9374    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9375        self.status_info = Some(value);
9376        self
9377    }
9378
9379    /// Sets the optional `customData` field.
9380    #[must_use]
9381    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9382        self.custom_data = Some(value);
9383        self
9384    }
9385}
9386
9387impl Validate for ReserveNowResponse {
9388    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9389        path.push_key("status");
9390        Validate::validate_at(&self.status, path, out);
9391        path.pop();
9392        path.push_key("statusInfo");
9393        if let Some(value) = &self.status_info {
9394            Validate::validate_at(value, path, out);
9395        }
9396        path.pop();
9397        path.push_key("customData");
9398        if let Some(value) = &self.custom_data {
9399            Validate::validate_at(value, path, out);
9400        }
9401        path.pop();
9402    }
9403}
9404
9405impl Sealed for ReserveNowResponse {}
9406impl Response for ReserveNowResponse {}
9407
9408/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
9409#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9410pub struct ResetRequest {
9411    /// The `type` member.
9412    pub r#type: ResetEnum,
9413    /// This contains the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
9414    #[serde(rename = "evseId")]
9415    #[serde(default, skip_serializing_if = "Option::is_none")]
9416    #[serde(deserialize_with = "crate::types::integer::option")]
9417    pub evse_id: Option<i32>,
9418    /// The `customData` member.
9419    #[serde(rename = "customData")]
9420    #[serde(default, skip_serializing_if = "Option::is_none")]
9421    pub custom_data: Option<crate::types::CustomData>,
9422}
9423
9424impl ResetRequest {
9425    /// Creates a `ResetRequest` from its required fields.
9426    #[must_use]
9427    pub fn new(r#type: ResetEnum) -> Self {
9428        Self {
9429            r#type,
9430            evse_id: None,
9431            custom_data: None,
9432        }
9433    }
9434
9435    /// Sets the optional `evseId` field.
9436    #[must_use]
9437    pub fn with_evse_id(mut self, value: i32) -> Self {
9438        self.evse_id = Some(value);
9439        self
9440    }
9441
9442    /// Sets the optional `customData` field.
9443    #[must_use]
9444    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9445        self.custom_data = Some(value);
9446        self
9447    }
9448}
9449
9450impl Validate for ResetRequest {
9451    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9452        path.push_key("type");
9453        Validate::validate_at(&self.r#type, path, out);
9454        path.pop();
9455        path.push_key("evseId");
9456        if let Some(value) = &self.evse_id {
9457            validate::int_range(i64::from(*value), Some(0), None, path, out);
9458        }
9459        path.pop();
9460        path.push_key("customData");
9461        if let Some(value) = &self.custom_data {
9462            Validate::validate_at(value, path, out);
9463        }
9464        path.pop();
9465    }
9466}
9467
9468impl Sealed for ResetRequest {}
9469impl Request for ResetRequest {
9470    type Action = Action;
9471    const ACTION: Action = Action::Reset;
9472    const KIND: MessageKind = MessageKind::Call;
9473    const ORIGIN: Origin = Origin::Csms;
9474    type Response = ResetResponse;
9475}
9476
9477impl Confirmed for ResetRequest {}
9478
9479/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
9480#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9481pub struct ResetResponse {
9482    /// The `status` member.
9483    pub status: ResetStatus,
9484    /// The `statusInfo` member.
9485    #[serde(rename = "statusInfo")]
9486    #[serde(default, skip_serializing_if = "Option::is_none")]
9487    pub status_info: Option<StatusInfo>,
9488    /// The `customData` member.
9489    #[serde(rename = "customData")]
9490    #[serde(default, skip_serializing_if = "Option::is_none")]
9491    pub custom_data: Option<crate::types::CustomData>,
9492}
9493
9494impl ResetResponse {
9495    /// Creates a `ResetResponse` from its required fields.
9496    #[must_use]
9497    pub fn new(status: ResetStatus) -> Self {
9498        Self {
9499            status,
9500            status_info: None,
9501            custom_data: None,
9502        }
9503    }
9504
9505    /// Sets the optional `statusInfo` field.
9506    #[must_use]
9507    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9508        self.status_info = Some(value);
9509        self
9510    }
9511
9512    /// Sets the optional `customData` field.
9513    #[must_use]
9514    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9515        self.custom_data = Some(value);
9516        self
9517    }
9518}
9519
9520impl Validate for ResetResponse {
9521    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9522        path.push_key("status");
9523        Validate::validate_at(&self.status, path, out);
9524        path.pop();
9525        path.push_key("statusInfo");
9526        if let Some(value) = &self.status_info {
9527            Validate::validate_at(value, path, out);
9528        }
9529        path.pop();
9530        path.push_key("customData");
9531        if let Some(value) = &self.custom_data {
9532            Validate::validate_at(value, path, out);
9533        }
9534        path.pop();
9535    }
9536}
9537
9538impl Sealed for ResetResponse {}
9539impl Response for ResetResponse {}
9540
9541/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
9542#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9543pub struct SecurityEventNotificationRequest {
9544    /// Type of the security event. This value should be taken from the Security events list.
9545    pub r#type: String,
9546    /// Date and time at which the event occurred.
9547    pub timestamp: crate::types::DateTime,
9548    /// Additional information about the occurred security event.
9549    #[serde(rename = "techInfo")]
9550    #[serde(default, skip_serializing_if = "Option::is_none")]
9551    pub tech_info: Option<String>,
9552    /// The `customData` member.
9553    #[serde(rename = "customData")]
9554    #[serde(default, skip_serializing_if = "Option::is_none")]
9555    pub custom_data: Option<crate::types::CustomData>,
9556}
9557
9558impl SecurityEventNotificationRequest {
9559    /// Creates a `SecurityEventNotificationRequest` from its required fields.
9560    #[must_use]
9561    pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
9562        Self {
9563            r#type: r#type.into(),
9564            timestamp: timestamp.into(),
9565            tech_info: None,
9566            custom_data: None,
9567        }
9568    }
9569
9570    /// Sets the optional `techInfo` field.
9571    #[must_use]
9572    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
9573        self.tech_info = Some(value.into());
9574        self
9575    }
9576
9577    /// Sets the optional `customData` field.
9578    #[must_use]
9579    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9580        self.custom_data = Some(value);
9581        self
9582    }
9583}
9584
9585impl Validate for SecurityEventNotificationRequest {
9586    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9587        path.push_key("type");
9588        validate::string(self.r#type.as_str(), None, Some(50), path, out);
9589        path.pop();
9590        path.push_key("techInfo");
9591        if let Some(value) = &self.tech_info {
9592            validate::string(value.as_str(), None, Some(255), path, out);
9593        }
9594        path.pop();
9595        path.push_key("customData");
9596        if let Some(value) = &self.custom_data {
9597            Validate::validate_at(value, path, out);
9598        }
9599        path.pop();
9600    }
9601}
9602
9603impl Sealed for SecurityEventNotificationRequest {}
9604impl Request for SecurityEventNotificationRequest {
9605    type Action = Action;
9606    const ACTION: Action = Action::SecurityEventNotification;
9607    const KIND: MessageKind = MessageKind::Call;
9608    const ORIGIN: Origin = Origin::ChargingStation;
9609    type Response = SecurityEventNotificationResponse;
9610}
9611
9612impl Confirmed for SecurityEventNotificationRequest {}
9613
9614/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
9615#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9616pub struct SecurityEventNotificationResponse {
9617    /// The `customData` member.
9618    #[serde(rename = "customData")]
9619    #[serde(default, skip_serializing_if = "Option::is_none")]
9620    pub custom_data: Option<crate::types::CustomData>,
9621}
9622
9623impl SecurityEventNotificationResponse {
9624    /// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
9625    #[must_use]
9626    pub fn new() -> Self {
9627        Self::default()
9628    }
9629
9630    /// Sets the optional `customData` field.
9631    #[must_use]
9632    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9633        self.custom_data = Some(value);
9634        self
9635    }
9636}
9637
9638impl Validate for SecurityEventNotificationResponse {
9639    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9640        path.push_key("customData");
9641        if let Some(value) = &self.custom_data {
9642            Validate::validate_at(value, path, out);
9643        }
9644        path.pop();
9645    }
9646}
9647
9648impl Sealed for SecurityEventNotificationResponse {}
9649impl Response for SecurityEventNotificationResponse {}
9650
9651/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
9652#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9653pub struct SendLocalListRequest {
9654    /// In case of a full update this is the version number of the full list. In case of a differential update it is the version number of the list after the update has been applied.
9655    #[serde(rename = "versionNumber")]
9656    #[serde(deserialize_with = "crate::types::integer::one")]
9657    pub version_number: i32,
9658    /// The `updateType` member.
9659    #[serde(rename = "updateType")]
9660    pub update_type: Update,
9661    /// The `localAuthorizationList` member.
9662    #[serde(rename = "localAuthorizationList")]
9663    #[serde(default, skip_serializing_if = "Option::is_none")]
9664    pub local_authorization_list: Option<Vec<AuthorizationData>>,
9665    /// The `customData` member.
9666    #[serde(rename = "customData")]
9667    #[serde(default, skip_serializing_if = "Option::is_none")]
9668    pub custom_data: Option<crate::types::CustomData>,
9669}
9670
9671impl SendLocalListRequest {
9672    /// Creates a `SendLocalListRequest` from its required fields.
9673    #[must_use]
9674    pub fn new(version_number: i32, update_type: Update) -> Self {
9675        Self {
9676            version_number,
9677            update_type,
9678            local_authorization_list: None,
9679            custom_data: None,
9680        }
9681    }
9682
9683    /// Sets the optional `localAuthorizationList` field.
9684    #[must_use]
9685    pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
9686        self.local_authorization_list = Some(value);
9687        self
9688    }
9689
9690    /// Sets the optional `customData` field.
9691    #[must_use]
9692    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9693        self.custom_data = Some(value);
9694        self
9695    }
9696}
9697
9698impl Validate for SendLocalListRequest {
9699    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9700        path.push_key("updateType");
9701        Validate::validate_at(&self.update_type, path, out);
9702        path.pop();
9703        path.push_key("localAuthorizationList");
9704        if let Some(value) = &self.local_authorization_list {
9705            validate::list_len(value.len(), Some(1), None, path, out);
9706            for (index, item) in value.iter().enumerate() {
9707                path.push_index(index);
9708                Validate::validate_at(item, path, out);
9709                path.pop();
9710            }
9711        }
9712        path.pop();
9713        path.push_key("customData");
9714        if let Some(value) = &self.custom_data {
9715            Validate::validate_at(value, path, out);
9716        }
9717        path.pop();
9718    }
9719}
9720
9721impl Sealed for SendLocalListRequest {}
9722impl Request for SendLocalListRequest {
9723    type Action = Action;
9724    const ACTION: Action = Action::SendLocalList;
9725    const KIND: MessageKind = MessageKind::Call;
9726    const ORIGIN: Origin = Origin::Csms;
9727    type Response = SendLocalListResponse;
9728}
9729
9730impl Confirmed for SendLocalListRequest {}
9731
9732/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
9733#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9734pub struct SendLocalListResponse {
9735    /// The `status` member.
9736    pub status: SendLocalListStatus,
9737    /// The `statusInfo` member.
9738    #[serde(rename = "statusInfo")]
9739    #[serde(default, skip_serializing_if = "Option::is_none")]
9740    pub status_info: Option<StatusInfo>,
9741    /// The `customData` member.
9742    #[serde(rename = "customData")]
9743    #[serde(default, skip_serializing_if = "Option::is_none")]
9744    pub custom_data: Option<crate::types::CustomData>,
9745}
9746
9747impl SendLocalListResponse {
9748    /// Creates a `SendLocalListResponse` from its required fields.
9749    #[must_use]
9750    pub fn new(status: SendLocalListStatus) -> Self {
9751        Self {
9752            status,
9753            status_info: None,
9754            custom_data: None,
9755        }
9756    }
9757
9758    /// Sets the optional `statusInfo` field.
9759    #[must_use]
9760    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9761        self.status_info = Some(value);
9762        self
9763    }
9764
9765    /// Sets the optional `customData` field.
9766    #[must_use]
9767    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9768        self.custom_data = Some(value);
9769        self
9770    }
9771}
9772
9773impl Validate for SendLocalListResponse {
9774    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9775        path.push_key("status");
9776        Validate::validate_at(&self.status, path, out);
9777        path.pop();
9778        path.push_key("statusInfo");
9779        if let Some(value) = &self.status_info {
9780            Validate::validate_at(value, path, out);
9781        }
9782        path.pop();
9783        path.push_key("customData");
9784        if let Some(value) = &self.custom_data {
9785            Validate::validate_at(value, path, out);
9786        }
9787        path.pop();
9788    }
9789}
9790
9791impl Sealed for SendLocalListResponse {}
9792impl Response for SendLocalListResponse {}
9793
9794/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
9795#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9796pub struct SetChargingProfileRequest {
9797    /// For TxDefaultProfile an evseId=0 applies the profile to each individual evse. For ChargingStationMaxProfile and ChargingStationExternalConstraints an evseId=0 contains an overal limit for the whole Charging Station.
9798    #[serde(rename = "evseId")]
9799    #[serde(deserialize_with = "crate::types::integer::one")]
9800    pub evse_id: i32,
9801    /// The `chargingProfile` member.
9802    #[serde(rename = "chargingProfile")]
9803    pub charging_profile: ChargingProfile,
9804    /// The `customData` member.
9805    #[serde(rename = "customData")]
9806    #[serde(default, skip_serializing_if = "Option::is_none")]
9807    pub custom_data: Option<crate::types::CustomData>,
9808}
9809
9810impl SetChargingProfileRequest {
9811    /// Creates a `SetChargingProfileRequest` from its required fields.
9812    #[must_use]
9813    pub fn new(evse_id: i32, charging_profile: ChargingProfile) -> Self {
9814        Self {
9815            evse_id,
9816            charging_profile,
9817            custom_data: None,
9818        }
9819    }
9820
9821    /// Sets the optional `customData` field.
9822    #[must_use]
9823    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9824        self.custom_data = Some(value);
9825        self
9826    }
9827}
9828
9829impl Validate for SetChargingProfileRequest {
9830    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9831        path.push_key("evseId");
9832        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
9833        path.pop();
9834        path.push_key("chargingProfile");
9835        Validate::validate_at(&self.charging_profile, path, out);
9836        path.pop();
9837        path.push_key("customData");
9838        if let Some(value) = &self.custom_data {
9839            Validate::validate_at(value, path, out);
9840        }
9841        path.pop();
9842    }
9843}
9844
9845impl Sealed for SetChargingProfileRequest {}
9846impl Request for SetChargingProfileRequest {
9847    type Action = Action;
9848    const ACTION: Action = Action::SetChargingProfile;
9849    const KIND: MessageKind = MessageKind::Call;
9850    const ORIGIN: Origin = Origin::Csms;
9851    type Response = SetChargingProfileResponse;
9852}
9853
9854impl Confirmed for SetChargingProfileRequest {}
9855
9856/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
9857#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9858pub struct SetChargingProfileResponse {
9859    /// The `status` member.
9860    pub status: ChargingProfileStatus,
9861    /// The `statusInfo` member.
9862    #[serde(rename = "statusInfo")]
9863    #[serde(default, skip_serializing_if = "Option::is_none")]
9864    pub status_info: Option<StatusInfo>,
9865    /// The `customData` member.
9866    #[serde(rename = "customData")]
9867    #[serde(default, skip_serializing_if = "Option::is_none")]
9868    pub custom_data: Option<crate::types::CustomData>,
9869}
9870
9871impl SetChargingProfileResponse {
9872    /// Creates a `SetChargingProfileResponse` from its required fields.
9873    #[must_use]
9874    pub fn new(status: ChargingProfileStatus) -> Self {
9875        Self {
9876            status,
9877            status_info: None,
9878            custom_data: None,
9879        }
9880    }
9881
9882    /// Sets the optional `statusInfo` field.
9883    #[must_use]
9884    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9885        self.status_info = Some(value);
9886        self
9887    }
9888
9889    /// Sets the optional `customData` field.
9890    #[must_use]
9891    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9892        self.custom_data = Some(value);
9893        self
9894    }
9895}
9896
9897impl Validate for SetChargingProfileResponse {
9898    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9899        path.push_key("status");
9900        Validate::validate_at(&self.status, path, out);
9901        path.pop();
9902        path.push_key("statusInfo");
9903        if let Some(value) = &self.status_info {
9904            Validate::validate_at(value, path, out);
9905        }
9906        path.pop();
9907        path.push_key("customData");
9908        if let Some(value) = &self.custom_data {
9909            Validate::validate_at(value, path, out);
9910        }
9911        path.pop();
9912    }
9913}
9914
9915impl Sealed for SetChargingProfileResponse {}
9916impl Response for SetChargingProfileResponse {}
9917
9918/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
9919#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9920pub struct SetDERControlRequest {
9921    /// True if this is a default DER control
9922    #[serde(rename = "isDefault")]
9923    pub is_default: bool,
9924    /// Unique id of this control, e.g. UUID
9925    #[serde(rename = "controlId")]
9926    pub control_id: String,
9927    /// The `controlType` member.
9928    #[serde(rename = "controlType")]
9929    pub control_type: DERControl,
9930    /// The `curve` member.
9931    #[serde(default, skip_serializing_if = "Option::is_none")]
9932    pub curve: Option<DERCurve>,
9933    /// The `enterService` member.
9934    #[serde(rename = "enterService")]
9935    #[serde(default, skip_serializing_if = "Option::is_none")]
9936    pub enter_service: Option<EnterService>,
9937    /// The `fixedPFAbsorb` member.
9938    #[serde(rename = "fixedPFAbsorb")]
9939    #[serde(default, skip_serializing_if = "Option::is_none")]
9940    pub fixed_pf_absorb: Option<FixedPF>,
9941    /// The `fixedPFInject` member.
9942    #[serde(rename = "fixedPFInject")]
9943    #[serde(default, skip_serializing_if = "Option::is_none")]
9944    pub fixed_pf_inject: Option<FixedPF>,
9945    /// The `fixedVar` member.
9946    #[serde(rename = "fixedVar")]
9947    #[serde(default, skip_serializing_if = "Option::is_none")]
9948    pub fixed_var: Option<FixedVar>,
9949    /// The `freqDroop` member.
9950    #[serde(rename = "freqDroop")]
9951    #[serde(default, skip_serializing_if = "Option::is_none")]
9952    pub freq_droop: Option<FreqDroop>,
9953    /// The `gradient` member.
9954    #[serde(default, skip_serializing_if = "Option::is_none")]
9955    pub gradient: Option<Gradient>,
9956    /// The `limitMaxDischarge` member.
9957    #[serde(rename = "limitMaxDischarge")]
9958    #[serde(default, skip_serializing_if = "Option::is_none")]
9959    pub limit_max_discharge: Option<LimitMaxDischarge>,
9960    /// The `customData` member.
9961    #[serde(rename = "customData")]
9962    #[serde(default, skip_serializing_if = "Option::is_none")]
9963    pub custom_data: Option<crate::types::CustomData>,
9964}
9965
9966impl SetDERControlRequest {
9967    /// Creates a `SetDERControlRequest` from its required fields.
9968    #[must_use]
9969    pub fn new(is_default: bool, control_id: impl Into<String>, control_type: DERControl) -> Self {
9970        Self {
9971            is_default,
9972            control_id: control_id.into(),
9973            control_type,
9974            curve: None,
9975            enter_service: None,
9976            fixed_pf_absorb: None,
9977            fixed_pf_inject: None,
9978            fixed_var: None,
9979            freq_droop: None,
9980            gradient: None,
9981            limit_max_discharge: None,
9982            custom_data: None,
9983        }
9984    }
9985
9986    /// Sets the optional `curve` field.
9987    #[must_use]
9988    pub fn with_curve(mut self, value: DERCurve) -> Self {
9989        self.curve = Some(value);
9990        self
9991    }
9992
9993    /// Sets the optional `enterService` field.
9994    #[must_use]
9995    pub fn with_enter_service(mut self, value: EnterService) -> Self {
9996        self.enter_service = Some(value);
9997        self
9998    }
9999
10000    /// Sets the optional `fixedPFAbsorb` field.
10001    #[must_use]
10002    pub fn with_fixed_pf_absorb(mut self, value: FixedPF) -> Self {
10003        self.fixed_pf_absorb = Some(value);
10004        self
10005    }
10006
10007    /// Sets the optional `fixedPFInject` field.
10008    #[must_use]
10009    pub fn with_fixed_pf_inject(mut self, value: FixedPF) -> Self {
10010        self.fixed_pf_inject = Some(value);
10011        self
10012    }
10013
10014    /// Sets the optional `fixedVar` field.
10015    #[must_use]
10016    pub fn with_fixed_var(mut self, value: FixedVar) -> Self {
10017        self.fixed_var = Some(value);
10018        self
10019    }
10020
10021    /// Sets the optional `freqDroop` field.
10022    #[must_use]
10023    pub fn with_freq_droop(mut self, value: FreqDroop) -> Self {
10024        self.freq_droop = Some(value);
10025        self
10026    }
10027
10028    /// Sets the optional `gradient` field.
10029    #[must_use]
10030    pub fn with_gradient(mut self, value: Gradient) -> Self {
10031        self.gradient = Some(value);
10032        self
10033    }
10034
10035    /// Sets the optional `limitMaxDischarge` field.
10036    #[must_use]
10037    pub fn with_limit_max_discharge(mut self, value: LimitMaxDischarge) -> Self {
10038        self.limit_max_discharge = Some(value);
10039        self
10040    }
10041
10042    /// Sets the optional `customData` field.
10043    #[must_use]
10044    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10045        self.custom_data = Some(value);
10046        self
10047    }
10048}
10049
10050impl Validate for SetDERControlRequest {
10051    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10052        path.push_key("controlId");
10053        validate::string(self.control_id.as_str(), None, Some(36), path, out);
10054        path.pop();
10055        path.push_key("controlType");
10056        Validate::validate_at(&self.control_type, path, out);
10057        path.pop();
10058        path.push_key("curve");
10059        if let Some(value) = &self.curve {
10060            Validate::validate_at(value, path, out);
10061        }
10062        path.pop();
10063        path.push_key("enterService");
10064        if let Some(value) = &self.enter_service {
10065            Validate::validate_at(value, path, out);
10066        }
10067        path.pop();
10068        path.push_key("fixedPFAbsorb");
10069        if let Some(value) = &self.fixed_pf_absorb {
10070            Validate::validate_at(value, path, out);
10071        }
10072        path.pop();
10073        path.push_key("fixedPFInject");
10074        if let Some(value) = &self.fixed_pf_inject {
10075            Validate::validate_at(value, path, out);
10076        }
10077        path.pop();
10078        path.push_key("fixedVar");
10079        if let Some(value) = &self.fixed_var {
10080            Validate::validate_at(value, path, out);
10081        }
10082        path.pop();
10083        path.push_key("freqDroop");
10084        if let Some(value) = &self.freq_droop {
10085            Validate::validate_at(value, path, out);
10086        }
10087        path.pop();
10088        path.push_key("gradient");
10089        if let Some(value) = &self.gradient {
10090            Validate::validate_at(value, path, out);
10091        }
10092        path.pop();
10093        path.push_key("limitMaxDischarge");
10094        if let Some(value) = &self.limit_max_discharge {
10095            Validate::validate_at(value, path, out);
10096        }
10097        path.pop();
10098        path.push_key("customData");
10099        if let Some(value) = &self.custom_data {
10100            Validate::validate_at(value, path, out);
10101        }
10102        path.pop();
10103    }
10104}
10105
10106impl Sealed for SetDERControlRequest {}
10107impl Request for SetDERControlRequest {
10108    type Action = Action;
10109    const ACTION: Action = Action::SetDERControl;
10110    const KIND: MessageKind = MessageKind::Call;
10111    const ORIGIN: Origin = Origin::Csms;
10112    type Response = SetDERControlResponse;
10113}
10114
10115impl Confirmed for SetDERControlRequest {}
10116
10117/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
10118#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10119pub struct SetDERControlResponse {
10120    /// The `status` member.
10121    pub status: DERControlStatus,
10122    /// The `statusInfo` member.
10123    #[serde(rename = "statusInfo")]
10124    #[serde(default, skip_serializing_if = "Option::is_none")]
10125    pub status_info: Option<StatusInfo>,
10126    /// List of controlIds that are superseded as a result of setting this control.
10127    #[serde(rename = "supersededIds")]
10128    #[serde(default, skip_serializing_if = "Option::is_none")]
10129    pub superseded_ids: Option<Vec<String>>,
10130    /// The `customData` member.
10131    #[serde(rename = "customData")]
10132    #[serde(default, skip_serializing_if = "Option::is_none")]
10133    pub custom_data: Option<crate::types::CustomData>,
10134}
10135
10136impl SetDERControlResponse {
10137    /// Creates a `SetDERControlResponse` from its required fields.
10138    #[must_use]
10139    pub fn new(status: DERControlStatus) -> Self {
10140        Self {
10141            status,
10142            status_info: None,
10143            superseded_ids: None,
10144            custom_data: None,
10145        }
10146    }
10147
10148    /// Sets the optional `statusInfo` field.
10149    #[must_use]
10150    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10151        self.status_info = Some(value);
10152        self
10153    }
10154
10155    /// Sets the optional `supersededIds` field.
10156    #[must_use]
10157    pub fn with_superseded_ids(
10158        mut self,
10159        value: impl IntoIterator<Item = impl Into<String>>,
10160    ) -> Self {
10161        self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
10162        self
10163    }
10164
10165    /// Sets the optional `customData` field.
10166    #[must_use]
10167    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10168        self.custom_data = Some(value);
10169        self
10170    }
10171}
10172
10173impl Validate for SetDERControlResponse {
10174    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10175        path.push_key("status");
10176        Validate::validate_at(&self.status, path, out);
10177        path.pop();
10178        path.push_key("statusInfo");
10179        if let Some(value) = &self.status_info {
10180            Validate::validate_at(value, path, out);
10181        }
10182        path.pop();
10183        path.push_key("supersededIds");
10184        if let Some(value) = &self.superseded_ids {
10185            validate::list_len(value.len(), Some(1), Some(24), path, out);
10186            for (index, item) in value.iter().enumerate() {
10187                path.push_index(index);
10188                validate::string(item.as_str(), None, Some(36), path, out);
10189                path.pop();
10190            }
10191        }
10192        path.pop();
10193        path.push_key("customData");
10194        if let Some(value) = &self.custom_data {
10195            Validate::validate_at(value, path, out);
10196        }
10197        path.pop();
10198    }
10199}
10200
10201impl Sealed for SetDERControlResponse {}
10202impl Response for SetDERControlResponse {}
10203
10204/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
10205#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10206pub struct SetDefaultTariffRequest {
10207    /// EVSE that tariff applies to. When _evseId_ = 0, then tarriff applies to all EVSEs.
10208    #[serde(rename = "evseId")]
10209    #[serde(deserialize_with = "crate::types::integer::one")]
10210    pub evse_id: i32,
10211    /// The `tariff` member.
10212    pub tariff: Tariff,
10213    /// The `customData` member.
10214    #[serde(rename = "customData")]
10215    #[serde(default, skip_serializing_if = "Option::is_none")]
10216    pub custom_data: Option<crate::types::CustomData>,
10217}
10218
10219impl SetDefaultTariffRequest {
10220    /// Creates a `SetDefaultTariffRequest` from its required fields.
10221    #[must_use]
10222    pub fn new(evse_id: i32, tariff: Tariff) -> Self {
10223        Self {
10224            evse_id,
10225            tariff,
10226            custom_data: None,
10227        }
10228    }
10229
10230    /// Sets the optional `customData` field.
10231    #[must_use]
10232    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10233        self.custom_data = Some(value);
10234        self
10235    }
10236}
10237
10238impl Validate for SetDefaultTariffRequest {
10239    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10240        path.push_key("evseId");
10241        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
10242        path.pop();
10243        path.push_key("tariff");
10244        Validate::validate_at(&self.tariff, path, out);
10245        path.pop();
10246        path.push_key("customData");
10247        if let Some(value) = &self.custom_data {
10248            Validate::validate_at(value, path, out);
10249        }
10250        path.pop();
10251    }
10252}
10253
10254impl Sealed for SetDefaultTariffRequest {}
10255impl Request for SetDefaultTariffRequest {
10256    type Action = Action;
10257    const ACTION: Action = Action::SetDefaultTariff;
10258    const KIND: MessageKind = MessageKind::Call;
10259    const ORIGIN: Origin = Origin::Csms;
10260    type Response = SetDefaultTariffResponse;
10261}
10262
10263impl Confirmed for SetDefaultTariffRequest {}
10264
10265/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
10266#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10267pub struct SetDefaultTariffResponse {
10268    /// The `status` member.
10269    pub status: TariffSetStatus,
10270    /// The `statusInfo` member.
10271    #[serde(rename = "statusInfo")]
10272    #[serde(default, skip_serializing_if = "Option::is_none")]
10273    pub status_info: Option<StatusInfo>,
10274    /// The `customData` member.
10275    #[serde(rename = "customData")]
10276    #[serde(default, skip_serializing_if = "Option::is_none")]
10277    pub custom_data: Option<crate::types::CustomData>,
10278}
10279
10280impl SetDefaultTariffResponse {
10281    /// Creates a `SetDefaultTariffResponse` from its required fields.
10282    #[must_use]
10283    pub fn new(status: TariffSetStatus) -> Self {
10284        Self {
10285            status,
10286            status_info: None,
10287            custom_data: None,
10288        }
10289    }
10290
10291    /// Sets the optional `statusInfo` field.
10292    #[must_use]
10293    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10294        self.status_info = Some(value);
10295        self
10296    }
10297
10298    /// Sets the optional `customData` field.
10299    #[must_use]
10300    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10301        self.custom_data = Some(value);
10302        self
10303    }
10304}
10305
10306impl Validate for SetDefaultTariffResponse {
10307    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10308        path.push_key("status");
10309        Validate::validate_at(&self.status, path, out);
10310        path.pop();
10311        path.push_key("statusInfo");
10312        if let Some(value) = &self.status_info {
10313            Validate::validate_at(value, path, out);
10314        }
10315        path.pop();
10316        path.push_key("customData");
10317        if let Some(value) = &self.custom_data {
10318            Validate::validate_at(value, path, out);
10319        }
10320        path.pop();
10321    }
10322}
10323
10324impl Sealed for SetDefaultTariffResponse {}
10325impl Response for SetDefaultTariffResponse {}
10326
10327/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
10328#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10329pub struct SetDisplayMessageRequest {
10330    /// The `message` member.
10331    pub message: MessageInfo,
10332    /// The `customData` member.
10333    #[serde(rename = "customData")]
10334    #[serde(default, skip_serializing_if = "Option::is_none")]
10335    pub custom_data: Option<crate::types::CustomData>,
10336}
10337
10338impl SetDisplayMessageRequest {
10339    /// Creates a `SetDisplayMessageRequest` from its required fields.
10340    #[must_use]
10341    pub fn new(message: MessageInfo) -> Self {
10342        Self {
10343            message,
10344            custom_data: None,
10345        }
10346    }
10347
10348    /// Sets the optional `customData` field.
10349    #[must_use]
10350    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10351        self.custom_data = Some(value);
10352        self
10353    }
10354}
10355
10356impl Validate for SetDisplayMessageRequest {
10357    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10358        path.push_key("message");
10359        Validate::validate_at(&self.message, path, out);
10360        path.pop();
10361        path.push_key("customData");
10362        if let Some(value) = &self.custom_data {
10363            Validate::validate_at(value, path, out);
10364        }
10365        path.pop();
10366    }
10367}
10368
10369impl Sealed for SetDisplayMessageRequest {}
10370impl Request for SetDisplayMessageRequest {
10371    type Action = Action;
10372    const ACTION: Action = Action::SetDisplayMessage;
10373    const KIND: MessageKind = MessageKind::Call;
10374    const ORIGIN: Origin = Origin::Csms;
10375    type Response = SetDisplayMessageResponse;
10376}
10377
10378impl Confirmed for SetDisplayMessageRequest {}
10379
10380/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
10381#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10382pub struct SetDisplayMessageResponse {
10383    /// The `status` member.
10384    pub status: DisplayMessageStatus,
10385    /// The `statusInfo` member.
10386    #[serde(rename = "statusInfo")]
10387    #[serde(default, skip_serializing_if = "Option::is_none")]
10388    pub status_info: Option<StatusInfo>,
10389    /// The `customData` member.
10390    #[serde(rename = "customData")]
10391    #[serde(default, skip_serializing_if = "Option::is_none")]
10392    pub custom_data: Option<crate::types::CustomData>,
10393}
10394
10395impl SetDisplayMessageResponse {
10396    /// Creates a `SetDisplayMessageResponse` from its required fields.
10397    #[must_use]
10398    pub fn new(status: DisplayMessageStatus) -> Self {
10399        Self {
10400            status,
10401            status_info: None,
10402            custom_data: None,
10403        }
10404    }
10405
10406    /// Sets the optional `statusInfo` field.
10407    #[must_use]
10408    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10409        self.status_info = Some(value);
10410        self
10411    }
10412
10413    /// Sets the optional `customData` field.
10414    #[must_use]
10415    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10416        self.custom_data = Some(value);
10417        self
10418    }
10419}
10420
10421impl Validate for SetDisplayMessageResponse {
10422    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10423        path.push_key("status");
10424        Validate::validate_at(&self.status, path, out);
10425        path.pop();
10426        path.push_key("statusInfo");
10427        if let Some(value) = &self.status_info {
10428            Validate::validate_at(value, path, out);
10429        }
10430        path.pop();
10431        path.push_key("customData");
10432        if let Some(value) = &self.custom_data {
10433            Validate::validate_at(value, path, out);
10434        }
10435        path.pop();
10436    }
10437}
10438
10439impl Sealed for SetDisplayMessageResponse {}
10440impl Response for SetDisplayMessageResponse {}
10441
10442/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10443#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10444pub struct SetMonitoringBaseRequest {
10445    /// The `monitoringBase` member.
10446    #[serde(rename = "monitoringBase")]
10447    pub monitoring_base: MonitoringBase,
10448    /// The `customData` member.
10449    #[serde(rename = "customData")]
10450    #[serde(default, skip_serializing_if = "Option::is_none")]
10451    pub custom_data: Option<crate::types::CustomData>,
10452}
10453
10454impl SetMonitoringBaseRequest {
10455    /// Creates a `SetMonitoringBaseRequest` from its required fields.
10456    #[must_use]
10457    pub fn new(monitoring_base: MonitoringBase) -> Self {
10458        Self {
10459            monitoring_base,
10460            custom_data: None,
10461        }
10462    }
10463
10464    /// Sets the optional `customData` field.
10465    #[must_use]
10466    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10467        self.custom_data = Some(value);
10468        self
10469    }
10470}
10471
10472impl Validate for SetMonitoringBaseRequest {
10473    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10474        path.push_key("monitoringBase");
10475        Validate::validate_at(&self.monitoring_base, path, out);
10476        path.pop();
10477        path.push_key("customData");
10478        if let Some(value) = &self.custom_data {
10479            Validate::validate_at(value, path, out);
10480        }
10481        path.pop();
10482    }
10483}
10484
10485impl Sealed for SetMonitoringBaseRequest {}
10486impl Request for SetMonitoringBaseRequest {
10487    type Action = Action;
10488    const ACTION: Action = Action::SetMonitoringBase;
10489    const KIND: MessageKind = MessageKind::Call;
10490    const ORIGIN: Origin = Origin::Csms;
10491    type Response = SetMonitoringBaseResponse;
10492}
10493
10494impl Confirmed for SetMonitoringBaseRequest {}
10495
10496/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10497#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10498pub struct SetMonitoringBaseResponse {
10499    /// The `status` member.
10500    pub status: GenericDeviceModelStatus,
10501    /// The `statusInfo` member.
10502    #[serde(rename = "statusInfo")]
10503    #[serde(default, skip_serializing_if = "Option::is_none")]
10504    pub status_info: Option<StatusInfo>,
10505    /// The `customData` member.
10506    #[serde(rename = "customData")]
10507    #[serde(default, skip_serializing_if = "Option::is_none")]
10508    pub custom_data: Option<crate::types::CustomData>,
10509}
10510
10511impl SetMonitoringBaseResponse {
10512    /// Creates a `SetMonitoringBaseResponse` from its required fields.
10513    #[must_use]
10514    pub fn new(status: GenericDeviceModelStatus) -> Self {
10515        Self {
10516            status,
10517            status_info: None,
10518            custom_data: None,
10519        }
10520    }
10521
10522    /// Sets the optional `statusInfo` field.
10523    #[must_use]
10524    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10525        self.status_info = Some(value);
10526        self
10527    }
10528
10529    /// Sets the optional `customData` field.
10530    #[must_use]
10531    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10532        self.custom_data = Some(value);
10533        self
10534    }
10535}
10536
10537impl Validate for SetMonitoringBaseResponse {
10538    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10539        path.push_key("status");
10540        Validate::validate_at(&self.status, path, out);
10541        path.pop();
10542        path.push_key("statusInfo");
10543        if let Some(value) = &self.status_info {
10544            Validate::validate_at(value, path, out);
10545        }
10546        path.pop();
10547        path.push_key("customData");
10548        if let Some(value) = &self.custom_data {
10549            Validate::validate_at(value, path, out);
10550        }
10551        path.pop();
10552    }
10553}
10554
10555impl Sealed for SetMonitoringBaseResponse {}
10556impl Response for SetMonitoringBaseResponse {}
10557
10558/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10559#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10560pub struct SetMonitoringLevelRequest {
10561    /// The Charging Station SHALL only report events with a severity number lower than or equal to this severity.
10562    /// The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
10563    ///
10564    /// The severity levels have the following meaning: +
10565    /// *0-Danger* +
10566    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
10567    /// *1-Hardware Failure* +
10568    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
10569    /// *2-System Failure* +
10570    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
10571    /// *3-Critical* +
10572    /// Indicates a critical error. Action is required. +
10573    /// *4-Error* +
10574    /// Indicates a non-urgent error. Action is required. +
10575    /// *5-Alert* +
10576    /// Indicates an alert event. Default severity for any type of monitoring event.  +
10577    /// *6-Warning* +
10578    /// Indicates a warning event. Action may be required. +
10579    /// *7-Notice* +
10580    /// Indicates an unusual event. No immediate action is required. +
10581    /// *8-Informational* +
10582    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
10583    /// *9-Debug* +
10584    /// Indicates information useful to developers for debugging, not useful during operations.
10585    #[serde(deserialize_with = "crate::types::integer::one")]
10586    pub severity: i32,
10587    /// The `customData` member.
10588    #[serde(rename = "customData")]
10589    #[serde(default, skip_serializing_if = "Option::is_none")]
10590    pub custom_data: Option<crate::types::CustomData>,
10591}
10592
10593impl SetMonitoringLevelRequest {
10594    /// Creates a `SetMonitoringLevelRequest` from its required fields.
10595    #[must_use]
10596    pub fn new(severity: i32) -> Self {
10597        Self {
10598            severity,
10599            custom_data: None,
10600        }
10601    }
10602
10603    /// Sets the optional `customData` field.
10604    #[must_use]
10605    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10606        self.custom_data = Some(value);
10607        self
10608    }
10609}
10610
10611impl Validate for SetMonitoringLevelRequest {
10612    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10613        path.push_key("severity");
10614        validate::int_range(i64::from(self.severity), Some(0), None, path, out);
10615        path.pop();
10616        path.push_key("customData");
10617        if let Some(value) = &self.custom_data {
10618            Validate::validate_at(value, path, out);
10619        }
10620        path.pop();
10621    }
10622}
10623
10624impl Sealed for SetMonitoringLevelRequest {}
10625impl Request for SetMonitoringLevelRequest {
10626    type Action = Action;
10627    const ACTION: Action = Action::SetMonitoringLevel;
10628    const KIND: MessageKind = MessageKind::Call;
10629    const ORIGIN: Origin = Origin::Csms;
10630    type Response = SetMonitoringLevelResponse;
10631}
10632
10633impl Confirmed for SetMonitoringLevelRequest {}
10634
10635/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10636#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10637pub struct SetMonitoringLevelResponse {
10638    /// The `status` member.
10639    pub status: GenericStatus,
10640    /// The `statusInfo` member.
10641    #[serde(rename = "statusInfo")]
10642    #[serde(default, skip_serializing_if = "Option::is_none")]
10643    pub status_info: Option<StatusInfo>,
10644    /// The `customData` member.
10645    #[serde(rename = "customData")]
10646    #[serde(default, skip_serializing_if = "Option::is_none")]
10647    pub custom_data: Option<crate::types::CustomData>,
10648}
10649
10650impl SetMonitoringLevelResponse {
10651    /// Creates a `SetMonitoringLevelResponse` from its required fields.
10652    #[must_use]
10653    pub fn new(status: GenericStatus) -> Self {
10654        Self {
10655            status,
10656            status_info: None,
10657            custom_data: None,
10658        }
10659    }
10660
10661    /// Sets the optional `statusInfo` field.
10662    #[must_use]
10663    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10664        self.status_info = Some(value);
10665        self
10666    }
10667
10668    /// Sets the optional `customData` field.
10669    #[must_use]
10670    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10671        self.custom_data = Some(value);
10672        self
10673    }
10674}
10675
10676impl Validate for SetMonitoringLevelResponse {
10677    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10678        path.push_key("status");
10679        Validate::validate_at(&self.status, path, out);
10680        path.pop();
10681        path.push_key("statusInfo");
10682        if let Some(value) = &self.status_info {
10683            Validate::validate_at(value, path, out);
10684        }
10685        path.pop();
10686        path.push_key("customData");
10687        if let Some(value) = &self.custom_data {
10688            Validate::validate_at(value, path, out);
10689        }
10690        path.pop();
10691    }
10692}
10693
10694impl Sealed for SetMonitoringLevelResponse {}
10695impl Response for SetMonitoringLevelResponse {}
10696
10697/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10698#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10699pub struct SetNetworkProfileRequest {
10700    /// Slot in which the configuration should be stored.
10701    #[serde(rename = "configurationSlot")]
10702    #[serde(deserialize_with = "crate::types::integer::one")]
10703    pub configuration_slot: i32,
10704    /// The `connectionData` member.
10705    #[serde(rename = "connectionData")]
10706    pub connection_data: NetworkConnectionProfile,
10707    /// The `customData` member.
10708    #[serde(rename = "customData")]
10709    #[serde(default, skip_serializing_if = "Option::is_none")]
10710    pub custom_data: Option<crate::types::CustomData>,
10711}
10712
10713impl SetNetworkProfileRequest {
10714    /// Creates a `SetNetworkProfileRequest` from its required fields.
10715    #[must_use]
10716    pub fn new(configuration_slot: i32, connection_data: NetworkConnectionProfile) -> Self {
10717        Self {
10718            configuration_slot,
10719            connection_data,
10720            custom_data: None,
10721        }
10722    }
10723
10724    /// Sets the optional `customData` field.
10725    #[must_use]
10726    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10727        self.custom_data = Some(value);
10728        self
10729    }
10730}
10731
10732impl Validate for SetNetworkProfileRequest {
10733    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10734        path.push_key("connectionData");
10735        Validate::validate_at(&self.connection_data, path, out);
10736        path.pop();
10737        path.push_key("customData");
10738        if let Some(value) = &self.custom_data {
10739            Validate::validate_at(value, path, out);
10740        }
10741        path.pop();
10742    }
10743}
10744
10745impl Sealed for SetNetworkProfileRequest {}
10746impl Request for SetNetworkProfileRequest {
10747    type Action = Action;
10748    const ACTION: Action = Action::SetNetworkProfile;
10749    const KIND: MessageKind = MessageKind::Call;
10750    const ORIGIN: Origin = Origin::Csms;
10751    type Response = SetNetworkProfileResponse;
10752}
10753
10754impl Confirmed for SetNetworkProfileRequest {}
10755
10756/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10757#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10758pub struct SetNetworkProfileResponse {
10759    /// The `status` member.
10760    pub status: SetNetworkProfileStatus,
10761    /// The `statusInfo` member.
10762    #[serde(rename = "statusInfo")]
10763    #[serde(default, skip_serializing_if = "Option::is_none")]
10764    pub status_info: Option<StatusInfo>,
10765    /// The `customData` member.
10766    #[serde(rename = "customData")]
10767    #[serde(default, skip_serializing_if = "Option::is_none")]
10768    pub custom_data: Option<crate::types::CustomData>,
10769}
10770
10771impl SetNetworkProfileResponse {
10772    /// Creates a `SetNetworkProfileResponse` from its required fields.
10773    #[must_use]
10774    pub fn new(status: SetNetworkProfileStatus) -> Self {
10775        Self {
10776            status,
10777            status_info: None,
10778            custom_data: None,
10779        }
10780    }
10781
10782    /// Sets the optional `statusInfo` field.
10783    #[must_use]
10784    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10785        self.status_info = Some(value);
10786        self
10787    }
10788
10789    /// Sets the optional `customData` field.
10790    #[must_use]
10791    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10792        self.custom_data = Some(value);
10793        self
10794    }
10795}
10796
10797impl Validate for SetNetworkProfileResponse {
10798    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10799        path.push_key("status");
10800        Validate::validate_at(&self.status, path, out);
10801        path.pop();
10802        path.push_key("statusInfo");
10803        if let Some(value) = &self.status_info {
10804            Validate::validate_at(value, path, out);
10805        }
10806        path.pop();
10807        path.push_key("customData");
10808        if let Some(value) = &self.custom_data {
10809            Validate::validate_at(value, path, out);
10810        }
10811        path.pop();
10812    }
10813}
10814
10815impl Sealed for SetNetworkProfileResponse {}
10816impl Response for SetNetworkProfileResponse {}
10817
10818/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10819#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10820pub struct SetVariableMonitoringRequest {
10821    /// The `setMonitoringData` member.
10822    #[serde(rename = "setMonitoringData")]
10823    pub set_monitoring_data: Vec<SetMonitoringData>,
10824    /// The `customData` member.
10825    #[serde(rename = "customData")]
10826    #[serde(default, skip_serializing_if = "Option::is_none")]
10827    pub custom_data: Option<crate::types::CustomData>,
10828}
10829
10830impl SetVariableMonitoringRequest {
10831    /// Creates a `SetVariableMonitoringRequest` from its required fields.
10832    #[must_use]
10833    pub fn new(set_monitoring_data: Vec<SetMonitoringData>) -> Self {
10834        Self {
10835            set_monitoring_data,
10836            custom_data: None,
10837        }
10838    }
10839
10840    /// Sets the optional `customData` field.
10841    #[must_use]
10842    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10843        self.custom_data = Some(value);
10844        self
10845    }
10846}
10847
10848impl Validate for SetVariableMonitoringRequest {
10849    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10850        path.push_key("setMonitoringData");
10851        validate::list_len(self.set_monitoring_data.len(), Some(1), None, path, out);
10852        for (index, item) in self.set_monitoring_data.iter().enumerate() {
10853            path.push_index(index);
10854            Validate::validate_at(item, path, out);
10855            path.pop();
10856        }
10857        path.pop();
10858        path.push_key("customData");
10859        if let Some(value) = &self.custom_data {
10860            Validate::validate_at(value, path, out);
10861        }
10862        path.pop();
10863    }
10864}
10865
10866impl Sealed for SetVariableMonitoringRequest {}
10867impl Request for SetVariableMonitoringRequest {
10868    type Action = Action;
10869    const ACTION: Action = Action::SetVariableMonitoring;
10870    const KIND: MessageKind = MessageKind::Call;
10871    const ORIGIN: Origin = Origin::Csms;
10872    type Response = SetVariableMonitoringResponse;
10873}
10874
10875impl Confirmed for SetVariableMonitoringRequest {}
10876
10877/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10878#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10879pub struct SetVariableMonitoringResponse {
10880    /// The `setMonitoringResult` member.
10881    #[serde(rename = "setMonitoringResult")]
10882    pub set_monitoring_result: Vec<SetMonitoringResult>,
10883    /// The `customData` member.
10884    #[serde(rename = "customData")]
10885    #[serde(default, skip_serializing_if = "Option::is_none")]
10886    pub custom_data: Option<crate::types::CustomData>,
10887}
10888
10889impl SetVariableMonitoringResponse {
10890    /// Creates a `SetVariableMonitoringResponse` from its required fields.
10891    #[must_use]
10892    pub fn new(set_monitoring_result: Vec<SetMonitoringResult>) -> Self {
10893        Self {
10894            set_monitoring_result,
10895            custom_data: None,
10896        }
10897    }
10898
10899    /// Sets the optional `customData` field.
10900    #[must_use]
10901    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10902        self.custom_data = Some(value);
10903        self
10904    }
10905}
10906
10907impl Validate for SetVariableMonitoringResponse {
10908    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10909        path.push_key("setMonitoringResult");
10910        validate::list_len(self.set_monitoring_result.len(), Some(1), None, path, out);
10911        for (index, item) in self.set_monitoring_result.iter().enumerate() {
10912            path.push_index(index);
10913            Validate::validate_at(item, path, out);
10914            path.pop();
10915        }
10916        path.pop();
10917        path.push_key("customData");
10918        if let Some(value) = &self.custom_data {
10919            Validate::validate_at(value, path, out);
10920        }
10921        path.pop();
10922    }
10923}
10924
10925impl Sealed for SetVariableMonitoringResponse {}
10926impl Response for SetVariableMonitoringResponse {}
10927
10928/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10929#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10930pub struct SetVariablesRequest {
10931    /// The `setVariableData` member.
10932    #[serde(rename = "setVariableData")]
10933    pub set_variable_data: Vec<SetVariableData>,
10934    /// The `customData` member.
10935    #[serde(rename = "customData")]
10936    #[serde(default, skip_serializing_if = "Option::is_none")]
10937    pub custom_data: Option<crate::types::CustomData>,
10938}
10939
10940impl SetVariablesRequest {
10941    /// Creates a `SetVariablesRequest` from its required fields.
10942    #[must_use]
10943    pub fn new(set_variable_data: Vec<SetVariableData>) -> Self {
10944        Self {
10945            set_variable_data,
10946            custom_data: None,
10947        }
10948    }
10949
10950    /// Sets the optional `customData` field.
10951    #[must_use]
10952    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10953        self.custom_data = Some(value);
10954        self
10955    }
10956}
10957
10958impl Validate for SetVariablesRequest {
10959    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10960        path.push_key("setVariableData");
10961        validate::list_len(self.set_variable_data.len(), Some(1), None, path, out);
10962        for (index, item) in self.set_variable_data.iter().enumerate() {
10963            path.push_index(index);
10964            Validate::validate_at(item, path, out);
10965            path.pop();
10966        }
10967        path.pop();
10968        path.push_key("customData");
10969        if let Some(value) = &self.custom_data {
10970            Validate::validate_at(value, path, out);
10971        }
10972        path.pop();
10973    }
10974}
10975
10976impl Sealed for SetVariablesRequest {}
10977impl Request for SetVariablesRequest {
10978    type Action = Action;
10979    const ACTION: Action = Action::SetVariables;
10980    const KIND: MessageKind = MessageKind::Call;
10981    const ORIGIN: Origin = Origin::Csms;
10982    type Response = SetVariablesResponse;
10983}
10984
10985impl Confirmed for SetVariablesRequest {}
10986
10987/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10988#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10989pub struct SetVariablesResponse {
10990    /// The `setVariableResult` member.
10991    #[serde(rename = "setVariableResult")]
10992    pub set_variable_result: Vec<SetVariableResult>,
10993    /// The `customData` member.
10994    #[serde(rename = "customData")]
10995    #[serde(default, skip_serializing_if = "Option::is_none")]
10996    pub custom_data: Option<crate::types::CustomData>,
10997}
10998
10999impl SetVariablesResponse {
11000    /// Creates a `SetVariablesResponse` from its required fields.
11001    #[must_use]
11002    pub fn new(set_variable_result: Vec<SetVariableResult>) -> Self {
11003        Self {
11004            set_variable_result,
11005            custom_data: None,
11006        }
11007    }
11008
11009    /// Sets the optional `customData` field.
11010    #[must_use]
11011    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11012        self.custom_data = Some(value);
11013        self
11014    }
11015}
11016
11017impl Validate for SetVariablesResponse {
11018    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11019        path.push_key("setVariableResult");
11020        validate::list_len(self.set_variable_result.len(), Some(1), None, path, out);
11021        for (index, item) in self.set_variable_result.iter().enumerate() {
11022            path.push_index(index);
11023            Validate::validate_at(item, path, out);
11024            path.pop();
11025        }
11026        path.pop();
11027        path.push_key("customData");
11028        if let Some(value) = &self.custom_data {
11029            Validate::validate_at(value, path, out);
11030        }
11031        path.pop();
11032    }
11033}
11034
11035impl Sealed for SetVariablesResponse {}
11036impl Response for SetVariablesResponse {}
11037
11038/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
11039#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11040pub struct SignCertificateRequest {
11041    /// The Charging Station SHALL send the public key in form of a Certificate Signing Request (CSR) as described in RFC 2986 \[22\] and then PEM encoded, using the &lt;&lt;signcertificaterequest,SignCertificateRequest&gt;&gt; message.
11042    pub csr: String,
11043    /// The `certificateType` member.
11044    #[serde(rename = "certificateType")]
11045    #[serde(default, skip_serializing_if = "Option::is_none")]
11046    pub certificate_type: Option<CertificateSigningUse>,
11047    /// The `hashRootCertificate` member.
11048    #[serde(rename = "hashRootCertificate")]
11049    #[serde(default, skip_serializing_if = "Option::is_none")]
11050    pub hash_root_certificate: Option<CertificateHashData>,
11051    /// *(2.1)* RequestId to match this message with the CertificateSignedRequest.
11052    #[serde(rename = "requestId")]
11053    #[serde(default, skip_serializing_if = "Option::is_none")]
11054    #[serde(deserialize_with = "crate::types::integer::option")]
11055    pub request_id: Option<i32>,
11056    /// The `customData` member.
11057    #[serde(rename = "customData")]
11058    #[serde(default, skip_serializing_if = "Option::is_none")]
11059    pub custom_data: Option<crate::types::CustomData>,
11060}
11061
11062impl SignCertificateRequest {
11063    /// Creates a `SignCertificateRequest` from its required fields.
11064    #[must_use]
11065    pub fn new(csr: impl Into<String>) -> Self {
11066        Self {
11067            csr: csr.into(),
11068            certificate_type: None,
11069            hash_root_certificate: None,
11070            request_id: None,
11071            custom_data: None,
11072        }
11073    }
11074
11075    /// Sets the optional `certificateType` field.
11076    #[must_use]
11077    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
11078        self.certificate_type = Some(value);
11079        self
11080    }
11081
11082    /// Sets the optional `hashRootCertificate` field.
11083    #[must_use]
11084    pub fn with_hash_root_certificate(mut self, value: CertificateHashData) -> Self {
11085        self.hash_root_certificate = Some(value);
11086        self
11087    }
11088
11089    /// Sets the optional `requestId` field.
11090    #[must_use]
11091    pub fn with_request_id(mut self, value: i32) -> Self {
11092        self.request_id = Some(value);
11093        self
11094    }
11095
11096    /// Sets the optional `customData` field.
11097    #[must_use]
11098    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11099        self.custom_data = Some(value);
11100        self
11101    }
11102}
11103
11104impl Validate for SignCertificateRequest {
11105    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11106        path.push_key("csr");
11107        validate::string(self.csr.as_str(), None, Some(5500), path, out);
11108        path.pop();
11109        path.push_key("certificateType");
11110        if let Some(value) = &self.certificate_type {
11111            Validate::validate_at(value, path, out);
11112        }
11113        path.pop();
11114        path.push_key("hashRootCertificate");
11115        if let Some(value) = &self.hash_root_certificate {
11116            Validate::validate_at(value, path, out);
11117        }
11118        path.pop();
11119        path.push_key("customData");
11120        if let Some(value) = &self.custom_data {
11121            Validate::validate_at(value, path, out);
11122        }
11123        path.pop();
11124    }
11125}
11126
11127impl Sealed for SignCertificateRequest {}
11128impl Request for SignCertificateRequest {
11129    type Action = Action;
11130    const ACTION: Action = Action::SignCertificate;
11131    const KIND: MessageKind = MessageKind::Call;
11132    const ORIGIN: Origin = Origin::ChargingStation;
11133    type Response = SignCertificateResponse;
11134}
11135
11136impl Confirmed for SignCertificateRequest {}
11137
11138/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
11139#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11140pub struct SignCertificateResponse {
11141    /// The `status` member.
11142    pub status: GenericStatus,
11143    /// The `statusInfo` member.
11144    #[serde(rename = "statusInfo")]
11145    #[serde(default, skip_serializing_if = "Option::is_none")]
11146    pub status_info: Option<StatusInfo>,
11147    /// The `customData` member.
11148    #[serde(rename = "customData")]
11149    #[serde(default, skip_serializing_if = "Option::is_none")]
11150    pub custom_data: Option<crate::types::CustomData>,
11151}
11152
11153impl SignCertificateResponse {
11154    /// Creates a `SignCertificateResponse` from its required fields.
11155    #[must_use]
11156    pub fn new(status: GenericStatus) -> Self {
11157        Self {
11158            status,
11159            status_info: None,
11160            custom_data: None,
11161        }
11162    }
11163
11164    /// Sets the optional `statusInfo` field.
11165    #[must_use]
11166    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11167        self.status_info = Some(value);
11168        self
11169    }
11170
11171    /// Sets the optional `customData` field.
11172    #[must_use]
11173    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11174        self.custom_data = Some(value);
11175        self
11176    }
11177}
11178
11179impl Validate for SignCertificateResponse {
11180    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11181        path.push_key("status");
11182        Validate::validate_at(&self.status, path, out);
11183        path.pop();
11184        path.push_key("statusInfo");
11185        if let Some(value) = &self.status_info {
11186            Validate::validate_at(value, path, out);
11187        }
11188        path.pop();
11189        path.push_key("customData");
11190        if let Some(value) = &self.custom_data {
11191            Validate::validate_at(value, path, out);
11192        }
11193        path.pop();
11194    }
11195}
11196
11197impl Sealed for SignCertificateResponse {}
11198impl Response for SignCertificateResponse {}
11199
11200/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
11201#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11202pub struct StatusNotificationRequest {
11203    /// The time for which the status is reported.
11204    pub timestamp: crate::types::DateTime,
11205    /// The `connectorStatus` member.
11206    #[serde(rename = "connectorStatus")]
11207    pub connector_status: ConnectorStatus,
11208    /// The id of the EVSE to which the connector belongs for which the the status is reported.
11209    #[serde(rename = "evseId")]
11210    #[serde(deserialize_with = "crate::types::integer::one")]
11211    pub evse_id: i32,
11212    /// The id of the connector within the EVSE for which the status is reported.
11213    #[serde(rename = "connectorId")]
11214    #[serde(deserialize_with = "crate::types::integer::one")]
11215    pub connector_id: i32,
11216    /// The `customData` member.
11217    #[serde(rename = "customData")]
11218    #[serde(default, skip_serializing_if = "Option::is_none")]
11219    pub custom_data: Option<crate::types::CustomData>,
11220}
11221
11222impl StatusNotificationRequest {
11223    /// Creates a `StatusNotificationRequest` from its required fields.
11224    #[must_use]
11225    pub fn new(
11226        timestamp: impl Into<crate::types::DateTime>,
11227        connector_status: ConnectorStatus,
11228        evse_id: i32,
11229        connector_id: i32,
11230    ) -> Self {
11231        Self {
11232            timestamp: timestamp.into(),
11233            connector_status,
11234            evse_id,
11235            connector_id,
11236            custom_data: None,
11237        }
11238    }
11239
11240    /// Sets the optional `customData` field.
11241    #[must_use]
11242    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11243        self.custom_data = Some(value);
11244        self
11245    }
11246}
11247
11248impl Validate for StatusNotificationRequest {
11249    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11250        path.push_key("connectorStatus");
11251        Validate::validate_at(&self.connector_status, path, out);
11252        path.pop();
11253        path.push_key("evseId");
11254        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
11255        path.pop();
11256        path.push_key("connectorId");
11257        validate::int_range(i64::from(self.connector_id), Some(0), None, path, out);
11258        path.pop();
11259        path.push_key("customData");
11260        if let Some(value) = &self.custom_data {
11261            Validate::validate_at(value, path, out);
11262        }
11263        path.pop();
11264    }
11265}
11266
11267impl Sealed for StatusNotificationRequest {}
11268impl Request for StatusNotificationRequest {
11269    type Action = Action;
11270    const ACTION: Action = Action::StatusNotification;
11271    const KIND: MessageKind = MessageKind::Call;
11272    const ORIGIN: Origin = Origin::ChargingStation;
11273    type Response = StatusNotificationResponse;
11274}
11275
11276impl Confirmed for StatusNotificationRequest {}
11277
11278/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
11279#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11280pub struct StatusNotificationResponse {
11281    /// The `customData` member.
11282    #[serde(rename = "customData")]
11283    #[serde(default, skip_serializing_if = "Option::is_none")]
11284    pub custom_data: Option<crate::types::CustomData>,
11285}
11286
11287impl StatusNotificationResponse {
11288    /// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
11289    #[must_use]
11290    pub fn new() -> Self {
11291        Self::default()
11292    }
11293
11294    /// Sets the optional `customData` field.
11295    #[must_use]
11296    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11297        self.custom_data = Some(value);
11298        self
11299    }
11300}
11301
11302impl Validate for StatusNotificationResponse {
11303    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11304        path.push_key("customData");
11305        if let Some(value) = &self.custom_data {
11306            Validate::validate_at(value, path, out);
11307        }
11308        path.pop();
11309    }
11310}
11311
11312impl Sealed for StatusNotificationResponse {}
11313impl Response for StatusNotificationResponse {}
11314
11315/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
11316#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11317pub struct TransactionEventRequest {
11318    /// The `eventType` member.
11319    #[serde(rename = "eventType")]
11320    pub event_type: TransactionEventEnum,
11321    /// The date and time at which this transaction event occurred.
11322    pub timestamp: crate::types::DateTime,
11323    /// The `triggerReason` member.
11324    #[serde(rename = "triggerReason")]
11325    pub trigger_reason: TriggerReason,
11326    /// Incremental sequence number, helps with determining if all messages of a transaction have been received.
11327    #[serde(rename = "seqNo")]
11328    #[serde(deserialize_with = "crate::types::integer::one")]
11329    pub seq_no: i32,
11330    /// The `transactionInfo` member.
11331    #[serde(rename = "transactionInfo")]
11332    pub transaction_info: Transaction,
11333    /// The `costDetails` member.
11334    #[serde(rename = "costDetails")]
11335    #[serde(default, skip_serializing_if = "Option::is_none")]
11336    pub cost_details: Option<CostDetails>,
11337    /// The `meterValue` member.
11338    #[serde(rename = "meterValue")]
11339    #[serde(default, skip_serializing_if = "Option::is_none")]
11340    pub meter_value: Option<Vec<MeterValue>>,
11341    /// Indication that this transaction event happened when the Charging Station was offline. Default = false, meaning: the event occurred when the Charging Station was online.
11342    /// Schema default: `false`.
11343    #[serde(default, skip_serializing_if = "Option::is_none")]
11344    pub offline: Option<bool>,
11345    /// If the Charging Station is able to report the number of phases used, then it SHALL provide it.
11346    /// When omitted the CSMS may be able to determine the number of phases used as follows: +
11347    /// 1: The numberPhases in the currently used ChargingSchedule. +
11348    /// 2: The number of phases provided via device management.
11349    #[serde(rename = "numberOfPhasesUsed")]
11350    #[serde(default, skip_serializing_if = "Option::is_none")]
11351    #[serde(deserialize_with = "crate::types::integer::option")]
11352    pub number_of_phases_used: Option<i32>,
11353    /// The maximum current of the connected cable in Ampere (A).
11354    #[serde(rename = "cableMaxCurrent")]
11355    #[serde(default, skip_serializing_if = "Option::is_none")]
11356    #[serde(deserialize_with = "crate::types::integer::option")]
11357    pub cable_max_current: Option<i32>,
11358    /// This contains the Id of the reservation that terminates as a result of this transaction.
11359    #[serde(rename = "reservationId")]
11360    #[serde(default, skip_serializing_if = "Option::is_none")]
11361    #[serde(deserialize_with = "crate::types::integer::option")]
11362    pub reservation_id: Option<i32>,
11363    /// The `preconditioningStatus` member.
11364    #[serde(rename = "preconditioningStatus")]
11365    #[serde(default, skip_serializing_if = "Option::is_none")]
11366    pub preconditioning_status: Option<PreconditioningStatus>,
11367    /// *(2.1)* True when EVSE electronics are in sleep mode for this transaction. Default value (when absent) is false.
11368    #[serde(rename = "evseSleep")]
11369    #[serde(default, skip_serializing_if = "Option::is_none")]
11370    pub evse_sleep: Option<bool>,
11371    /// The `evse` member.
11372    #[serde(default, skip_serializing_if = "Option::is_none")]
11373    pub evse: Option<EVSE>,
11374    /// The `idToken` member.
11375    #[serde(rename = "idToken")]
11376    #[serde(default, skip_serializing_if = "Option::is_none")]
11377    pub id_token: Option<IdToken>,
11378    /// The `customData` member.
11379    #[serde(rename = "customData")]
11380    #[serde(default, skip_serializing_if = "Option::is_none")]
11381    pub custom_data: Option<crate::types::CustomData>,
11382}
11383
11384impl TransactionEventRequest {
11385    /// Creates a `TransactionEventRequest` from its required fields.
11386    #[must_use]
11387    pub fn new(
11388        event_type: TransactionEventEnum,
11389        timestamp: impl Into<crate::types::DateTime>,
11390        trigger_reason: TriggerReason,
11391        seq_no: i32,
11392        transaction_info: Transaction,
11393    ) -> Self {
11394        Self {
11395            event_type,
11396            timestamp: timestamp.into(),
11397            trigger_reason,
11398            seq_no,
11399            transaction_info,
11400            cost_details: None,
11401            meter_value: None,
11402            offline: None,
11403            number_of_phases_used: None,
11404            cable_max_current: None,
11405            reservation_id: None,
11406            preconditioning_status: None,
11407            evse_sleep: None,
11408            evse: None,
11409            id_token: None,
11410            custom_data: None,
11411        }
11412    }
11413
11414    /// Sets the optional `costDetails` field.
11415    #[must_use]
11416    pub fn with_cost_details(mut self, value: CostDetails) -> Self {
11417        self.cost_details = Some(value);
11418        self
11419    }
11420
11421    /// Sets the optional `meterValue` field.
11422    #[must_use]
11423    pub fn with_meter_value(mut self, value: Vec<MeterValue>) -> Self {
11424        self.meter_value = Some(value);
11425        self
11426    }
11427
11428    /// Sets the optional `offline` field.
11429    #[must_use]
11430    pub fn with_offline(mut self, value: bool) -> Self {
11431        self.offline = Some(value);
11432        self
11433    }
11434
11435    /// Sets the optional `numberOfPhasesUsed` field.
11436    #[must_use]
11437    pub fn with_number_of_phases_used(mut self, value: i32) -> Self {
11438        self.number_of_phases_used = Some(value);
11439        self
11440    }
11441
11442    /// Sets the optional `cableMaxCurrent` field.
11443    #[must_use]
11444    pub fn with_cable_max_current(mut self, value: i32) -> Self {
11445        self.cable_max_current = Some(value);
11446        self
11447    }
11448
11449    /// Sets the optional `reservationId` field.
11450    #[must_use]
11451    pub fn with_reservation_id(mut self, value: i32) -> Self {
11452        self.reservation_id = Some(value);
11453        self
11454    }
11455
11456    /// Sets the optional `preconditioningStatus` field.
11457    #[must_use]
11458    pub fn with_preconditioning_status(mut self, value: PreconditioningStatus) -> Self {
11459        self.preconditioning_status = Some(value);
11460        self
11461    }
11462
11463    /// Sets the optional `evseSleep` field.
11464    #[must_use]
11465    pub fn with_evse_sleep(mut self, value: bool) -> Self {
11466        self.evse_sleep = Some(value);
11467        self
11468    }
11469
11470    /// Sets the optional `evse` field.
11471    #[must_use]
11472    pub fn with_evse(mut self, value: EVSE) -> Self {
11473        self.evse = Some(value);
11474        self
11475    }
11476
11477    /// Sets the optional `idToken` field.
11478    #[must_use]
11479    pub fn with_id_token(mut self, value: IdToken) -> Self {
11480        self.id_token = Some(value);
11481        self
11482    }
11483
11484    /// Sets the optional `customData` field.
11485    #[must_use]
11486    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11487        self.custom_data = Some(value);
11488        self
11489    }
11490}
11491
11492impl Validate for TransactionEventRequest {
11493    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11494        path.push_key("eventType");
11495        Validate::validate_at(&self.event_type, path, out);
11496        path.pop();
11497        path.push_key("triggerReason");
11498        Validate::validate_at(&self.trigger_reason, path, out);
11499        path.pop();
11500        path.push_key("seqNo");
11501        validate::int_range(i64::from(self.seq_no), Some(0), None, path, out);
11502        path.pop();
11503        path.push_key("transactionInfo");
11504        Validate::validate_at(&self.transaction_info, path, out);
11505        path.pop();
11506        path.push_key("costDetails");
11507        if let Some(value) = &self.cost_details {
11508            Validate::validate_at(value, path, out);
11509        }
11510        path.pop();
11511        path.push_key("meterValue");
11512        if let Some(value) = &self.meter_value {
11513            validate::list_len(value.len(), Some(1), None, path, out);
11514            for (index, item) in value.iter().enumerate() {
11515                path.push_index(index);
11516                Validate::validate_at(item, path, out);
11517                path.pop();
11518            }
11519        }
11520        path.pop();
11521        path.push_key("numberOfPhasesUsed");
11522        if let Some(value) = &self.number_of_phases_used {
11523            validate::int_range(i64::from(*value), Some(0), Some(3), path, out);
11524        }
11525        path.pop();
11526        path.push_key("reservationId");
11527        if let Some(value) = &self.reservation_id {
11528            validate::int_range(i64::from(*value), Some(0), None, path, out);
11529        }
11530        path.pop();
11531        path.push_key("preconditioningStatus");
11532        if let Some(value) = &self.preconditioning_status {
11533            Validate::validate_at(value, path, out);
11534        }
11535        path.pop();
11536        path.push_key("evse");
11537        if let Some(value) = &self.evse {
11538            Validate::validate_at(value, path, out);
11539        }
11540        path.pop();
11541        path.push_key("idToken");
11542        if let Some(value) = &self.id_token {
11543            Validate::validate_at(value, path, out);
11544        }
11545        path.pop();
11546        path.push_key("customData");
11547        if let Some(value) = &self.custom_data {
11548            Validate::validate_at(value, path, out);
11549        }
11550        path.pop();
11551    }
11552}
11553
11554impl Sealed for TransactionEventRequest {}
11555impl Request for TransactionEventRequest {
11556    type Action = Action;
11557    const ACTION: Action = Action::TransactionEvent;
11558    const KIND: MessageKind = MessageKind::Call;
11559    const ORIGIN: Origin = Origin::ChargingStation;
11560    type Response = TransactionEventResponse;
11561}
11562
11563impl Confirmed for TransactionEventRequest {}
11564
11565/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
11566#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11567pub struct TransactionEventResponse {
11568    /// When _eventType_ of TransactionEventRequest is Updated, then this value contains the running cost. When _eventType_ of TransactionEventRequest is Ended, then this contains the final total cost of this transaction, including taxes, in the currency configured with the Configuration Variable: Currency. Absence of this value does not imply that the transaction was free. To indicate a free transaction, the CSMS SHALL send a value of 0.00.
11569    #[serde(rename = "totalCost")]
11570    #[serde(default, skip_serializing_if = "Option::is_none")]
11571    pub total_cost: Option<crate::types::Decimal>,
11572    /// 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; is temporarily, so it may not be set in the &lt;&lt;cmn_idtokeninfotype,IdTokenInfoType&gt;&gt; afterwards. Also the chargingPriority in &lt;&lt;transactioneventresponse,TransactionEventResponse&gt;&gt; has a higher priority than the one in &lt;&lt;cmn_idtokeninfotype,IdTokenInfoType&gt;&gt;.
11573    #[serde(rename = "chargingPriority")]
11574    #[serde(default, skip_serializing_if = "Option::is_none")]
11575    #[serde(deserialize_with = "crate::types::integer::option")]
11576    pub charging_priority: Option<i32>,
11577    /// The `idTokenInfo` member.
11578    #[serde(rename = "idTokenInfo")]
11579    #[serde(default, skip_serializing_if = "Option::is_none")]
11580    pub id_token_info: Option<IdTokenInfo>,
11581    /// The `transactionLimit` member.
11582    #[serde(rename = "transactionLimit")]
11583    #[serde(default, skip_serializing_if = "Option::is_none")]
11584    pub transaction_limit: Option<TransactionLimit>,
11585    /// The `updatedPersonalMessage` member.
11586    #[serde(rename = "updatedPersonalMessage")]
11587    #[serde(default, skip_serializing_if = "Option::is_none")]
11588    pub updated_personal_message: Option<MessageContent>,
11589    /// The `updatedPersonalMessageExtra` member.
11590    #[serde(rename = "updatedPersonalMessageExtra")]
11591    #[serde(default, skip_serializing_if = "Option::is_none")]
11592    pub updated_personal_message_extra: Option<Vec<MessageContent>>,
11593    /// The `customData` member.
11594    #[serde(rename = "customData")]
11595    #[serde(default, skip_serializing_if = "Option::is_none")]
11596    pub custom_data: Option<crate::types::CustomData>,
11597}
11598
11599impl TransactionEventResponse {
11600    /// Creates an empty `TransactionEventResponse`. Every field of this type is optional.
11601    #[must_use]
11602    pub fn new() -> Self {
11603        Self::default()
11604    }
11605
11606    /// Sets the optional `totalCost` field.
11607    #[must_use]
11608    pub fn with_total_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11609        self.total_cost = Some(value.into());
11610        self
11611    }
11612
11613    /// Sets the optional `chargingPriority` field.
11614    #[must_use]
11615    pub fn with_charging_priority(mut self, value: i32) -> Self {
11616        self.charging_priority = Some(value);
11617        self
11618    }
11619
11620    /// Sets the optional `idTokenInfo` field.
11621    #[must_use]
11622    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
11623        self.id_token_info = Some(value);
11624        self
11625    }
11626
11627    /// Sets the optional `transactionLimit` field.
11628    #[must_use]
11629    pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
11630        self.transaction_limit = Some(value);
11631        self
11632    }
11633
11634    /// Sets the optional `updatedPersonalMessage` field.
11635    #[must_use]
11636    pub fn with_updated_personal_message(mut self, value: MessageContent) -> Self {
11637        self.updated_personal_message = Some(value);
11638        self
11639    }
11640
11641    /// Sets the optional `updatedPersonalMessageExtra` field.
11642    #[must_use]
11643    pub fn with_updated_personal_message_extra(mut self, value: Vec<MessageContent>) -> Self {
11644        self.updated_personal_message_extra = Some(value);
11645        self
11646    }
11647
11648    /// Sets the optional `customData` field.
11649    #[must_use]
11650    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11651        self.custom_data = Some(value);
11652        self
11653    }
11654}
11655
11656impl Validate for TransactionEventResponse {
11657    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11658        path.push_key("idTokenInfo");
11659        if let Some(value) = &self.id_token_info {
11660            Validate::validate_at(value, path, out);
11661        }
11662        path.pop();
11663        path.push_key("transactionLimit");
11664        if let Some(value) = &self.transaction_limit {
11665            Validate::validate_at(value, path, out);
11666        }
11667        path.pop();
11668        path.push_key("updatedPersonalMessage");
11669        if let Some(value) = &self.updated_personal_message {
11670            Validate::validate_at(value, path, out);
11671        }
11672        path.pop();
11673        path.push_key("updatedPersonalMessageExtra");
11674        if let Some(value) = &self.updated_personal_message_extra {
11675            validate::list_len(value.len(), Some(1), Some(4), path, out);
11676            for (index, item) in value.iter().enumerate() {
11677                path.push_index(index);
11678                Validate::validate_at(item, path, out);
11679                path.pop();
11680            }
11681        }
11682        path.pop();
11683        path.push_key("customData");
11684        if let Some(value) = &self.custom_data {
11685            Validate::validate_at(value, path, out);
11686        }
11687        path.pop();
11688    }
11689}
11690
11691impl Sealed for TransactionEventResponse {}
11692impl Response for TransactionEventResponse {}
11693
11694/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11695#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11696pub struct TriggerMessageRequest {
11697    /// The `requestedMessage` member.
11698    #[serde(rename = "requestedMessage")]
11699    pub requested_message: MessageTrigger,
11700    /// The `evse` member.
11701    #[serde(default, skip_serializing_if = "Option::is_none")]
11702    pub evse: Option<EVSE>,
11703    /// *(2.1)* When _requestedMessage_ = `CustomTrigger` this will trigger sending the corresponding message in field _customTrigger_, if supported by Charging Station.
11704    #[serde(rename = "customTrigger")]
11705    #[serde(default, skip_serializing_if = "Option::is_none")]
11706    pub custom_trigger: Option<String>,
11707    /// The `customData` member.
11708    #[serde(rename = "customData")]
11709    #[serde(default, skip_serializing_if = "Option::is_none")]
11710    pub custom_data: Option<crate::types::CustomData>,
11711}
11712
11713impl TriggerMessageRequest {
11714    /// Creates a `TriggerMessageRequest` from its required fields.
11715    #[must_use]
11716    pub fn new(requested_message: MessageTrigger) -> Self {
11717        Self {
11718            requested_message,
11719            evse: None,
11720            custom_trigger: None,
11721            custom_data: None,
11722        }
11723    }
11724
11725    /// Sets the optional `evse` field.
11726    #[must_use]
11727    pub fn with_evse(mut self, value: EVSE) -> Self {
11728        self.evse = Some(value);
11729        self
11730    }
11731
11732    /// Sets the optional `customTrigger` field.
11733    #[must_use]
11734    pub fn with_custom_trigger(mut self, value: impl Into<String>) -> Self {
11735        self.custom_trigger = Some(value.into());
11736        self
11737    }
11738
11739    /// Sets the optional `customData` field.
11740    #[must_use]
11741    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11742        self.custom_data = Some(value);
11743        self
11744    }
11745}
11746
11747impl Validate for TriggerMessageRequest {
11748    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11749        path.push_key("requestedMessage");
11750        Validate::validate_at(&self.requested_message, path, out);
11751        path.pop();
11752        path.push_key("evse");
11753        if let Some(value) = &self.evse {
11754            Validate::validate_at(value, path, out);
11755        }
11756        path.pop();
11757        path.push_key("customTrigger");
11758        if let Some(value) = &self.custom_trigger {
11759            validate::string(value.as_str(), None, Some(50), path, out);
11760        }
11761        path.pop();
11762        path.push_key("customData");
11763        if let Some(value) = &self.custom_data {
11764            Validate::validate_at(value, path, out);
11765        }
11766        path.pop();
11767    }
11768}
11769
11770impl Sealed for TriggerMessageRequest {}
11771impl Request for TriggerMessageRequest {
11772    type Action = Action;
11773    const ACTION: Action = Action::TriggerMessage;
11774    const KIND: MessageKind = MessageKind::Call;
11775    const ORIGIN: Origin = Origin::Csms;
11776    type Response = TriggerMessageResponse;
11777}
11778
11779impl Confirmed for TriggerMessageRequest {}
11780
11781/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11782#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11783pub struct TriggerMessageResponse {
11784    /// The `status` member.
11785    pub status: TriggerMessageStatus,
11786    /// The `statusInfo` member.
11787    #[serde(rename = "statusInfo")]
11788    #[serde(default, skip_serializing_if = "Option::is_none")]
11789    pub status_info: Option<StatusInfo>,
11790    /// The `customData` member.
11791    #[serde(rename = "customData")]
11792    #[serde(default, skip_serializing_if = "Option::is_none")]
11793    pub custom_data: Option<crate::types::CustomData>,
11794}
11795
11796impl TriggerMessageResponse {
11797    /// Creates a `TriggerMessageResponse` from its required fields.
11798    #[must_use]
11799    pub fn new(status: TriggerMessageStatus) -> Self {
11800        Self {
11801            status,
11802            status_info: None,
11803            custom_data: None,
11804        }
11805    }
11806
11807    /// Sets the optional `statusInfo` field.
11808    #[must_use]
11809    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11810        self.status_info = Some(value);
11811        self
11812    }
11813
11814    /// Sets the optional `customData` field.
11815    #[must_use]
11816    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11817        self.custom_data = Some(value);
11818        self
11819    }
11820}
11821
11822impl Validate for TriggerMessageResponse {
11823    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11824        path.push_key("status");
11825        Validate::validate_at(&self.status, path, out);
11826        path.pop();
11827        path.push_key("statusInfo");
11828        if let Some(value) = &self.status_info {
11829            Validate::validate_at(value, path, out);
11830        }
11831        path.pop();
11832        path.push_key("customData");
11833        if let Some(value) = &self.custom_data {
11834            Validate::validate_at(value, path, out);
11835        }
11836        path.pop();
11837    }
11838}
11839
11840impl Sealed for TriggerMessageResponse {}
11841impl Response for TriggerMessageResponse {}
11842
11843/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11845pub struct UnlockConnectorRequest {
11846    /// This contains the identifier of the EVSE for which a connector needs to be unlocked.
11847    #[serde(rename = "evseId")]
11848    #[serde(deserialize_with = "crate::types::integer::one")]
11849    pub evse_id: i32,
11850    /// This contains the identifier of the connector that needs to be unlocked.
11851    #[serde(rename = "connectorId")]
11852    #[serde(deserialize_with = "crate::types::integer::one")]
11853    pub connector_id: i32,
11854    /// The `customData` member.
11855    #[serde(rename = "customData")]
11856    #[serde(default, skip_serializing_if = "Option::is_none")]
11857    pub custom_data: Option<crate::types::CustomData>,
11858}
11859
11860impl UnlockConnectorRequest {
11861    /// Creates a `UnlockConnectorRequest` from its required fields.
11862    #[must_use]
11863    pub fn new(evse_id: i32, connector_id: i32) -> Self {
11864        Self {
11865            evse_id,
11866            connector_id,
11867            custom_data: None,
11868        }
11869    }
11870
11871    /// Sets the optional `customData` field.
11872    #[must_use]
11873    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11874        self.custom_data = Some(value);
11875        self
11876    }
11877}
11878
11879impl Validate for UnlockConnectorRequest {
11880    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11881        path.push_key("evseId");
11882        validate::int_range(i64::from(self.evse_id), Some(0), None, path, out);
11883        path.pop();
11884        path.push_key("connectorId");
11885        validate::int_range(i64::from(self.connector_id), Some(0), None, path, out);
11886        path.pop();
11887        path.push_key("customData");
11888        if let Some(value) = &self.custom_data {
11889            Validate::validate_at(value, path, out);
11890        }
11891        path.pop();
11892    }
11893}
11894
11895impl Sealed for UnlockConnectorRequest {}
11896impl Request for UnlockConnectorRequest {
11897    type Action = Action;
11898    const ACTION: Action = Action::UnlockConnector;
11899    const KIND: MessageKind = MessageKind::Call;
11900    const ORIGIN: Origin = Origin::Csms;
11901    type Response = UnlockConnectorResponse;
11902}
11903
11904impl Confirmed for UnlockConnectorRequest {}
11905
11906/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11907#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11908pub struct UnlockConnectorResponse {
11909    /// The `status` member.
11910    pub status: UnlockStatus,
11911    /// The `statusInfo` member.
11912    #[serde(rename = "statusInfo")]
11913    #[serde(default, skip_serializing_if = "Option::is_none")]
11914    pub status_info: Option<StatusInfo>,
11915    /// The `customData` member.
11916    #[serde(rename = "customData")]
11917    #[serde(default, skip_serializing_if = "Option::is_none")]
11918    pub custom_data: Option<crate::types::CustomData>,
11919}
11920
11921impl UnlockConnectorResponse {
11922    /// Creates a `UnlockConnectorResponse` from its required fields.
11923    #[must_use]
11924    pub fn new(status: UnlockStatus) -> Self {
11925        Self {
11926            status,
11927            status_info: None,
11928            custom_data: None,
11929        }
11930    }
11931
11932    /// Sets the optional `statusInfo` field.
11933    #[must_use]
11934    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11935        self.status_info = Some(value);
11936        self
11937    }
11938
11939    /// Sets the optional `customData` field.
11940    #[must_use]
11941    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11942        self.custom_data = Some(value);
11943        self
11944    }
11945}
11946
11947impl Validate for UnlockConnectorResponse {
11948    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11949        path.push_key("status");
11950        Validate::validate_at(&self.status, path, out);
11951        path.pop();
11952        path.push_key("statusInfo");
11953        if let Some(value) = &self.status_info {
11954            Validate::validate_at(value, path, out);
11955        }
11956        path.pop();
11957        path.push_key("customData");
11958        if let Some(value) = &self.custom_data {
11959            Validate::validate_at(value, path, out);
11960        }
11961        path.pop();
11962    }
11963}
11964
11965impl Sealed for UnlockConnectorResponse {}
11966impl Response for UnlockConnectorResponse {}
11967
11968/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
11969#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11970pub struct UnpublishFirmwareRequest {
11971    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
11972    pub checksum: String,
11973    /// The `customData` member.
11974    #[serde(rename = "customData")]
11975    #[serde(default, skip_serializing_if = "Option::is_none")]
11976    pub custom_data: Option<crate::types::CustomData>,
11977}
11978
11979impl UnpublishFirmwareRequest {
11980    /// Creates a `UnpublishFirmwareRequest` from its required fields.
11981    #[must_use]
11982    pub fn new(checksum: impl Into<String>) -> Self {
11983        Self {
11984            checksum: checksum.into(),
11985            custom_data: None,
11986        }
11987    }
11988
11989    /// Sets the optional `customData` field.
11990    #[must_use]
11991    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11992        self.custom_data = Some(value);
11993        self
11994    }
11995}
11996
11997impl Validate for UnpublishFirmwareRequest {
11998    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11999        path.push_key("checksum");
12000        validate::string(self.checksum.as_str(), None, Some(32), path, out);
12001        path.pop();
12002        path.push_key("customData");
12003        if let Some(value) = &self.custom_data {
12004            Validate::validate_at(value, path, out);
12005        }
12006        path.pop();
12007    }
12008}
12009
12010impl Sealed for UnpublishFirmwareRequest {}
12011impl Request for UnpublishFirmwareRequest {
12012    type Action = Action;
12013    const ACTION: Action = Action::UnpublishFirmware;
12014    const KIND: MessageKind = MessageKind::Call;
12015    const ORIGIN: Origin = Origin::Csms;
12016    type Response = UnpublishFirmwareResponse;
12017}
12018
12019impl Confirmed for UnpublishFirmwareRequest {}
12020
12021/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
12022#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12023pub struct UnpublishFirmwareResponse {
12024    /// The `status` member.
12025    pub status: UnpublishFirmwareStatus,
12026    /// The `customData` member.
12027    #[serde(rename = "customData")]
12028    #[serde(default, skip_serializing_if = "Option::is_none")]
12029    pub custom_data: Option<crate::types::CustomData>,
12030}
12031
12032impl UnpublishFirmwareResponse {
12033    /// Creates a `UnpublishFirmwareResponse` from its required fields.
12034    #[must_use]
12035    pub fn new(status: UnpublishFirmwareStatus) -> Self {
12036        Self {
12037            status,
12038            custom_data: None,
12039        }
12040    }
12041
12042    /// Sets the optional `customData` field.
12043    #[must_use]
12044    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12045        self.custom_data = Some(value);
12046        self
12047    }
12048}
12049
12050impl Validate for UnpublishFirmwareResponse {
12051    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12052        path.push_key("status");
12053        Validate::validate_at(&self.status, path, out);
12054        path.pop();
12055        path.push_key("customData");
12056        if let Some(value) = &self.custom_data {
12057            Validate::validate_at(value, path, out);
12058        }
12059        path.pop();
12060    }
12061}
12062
12063impl Sealed for UnpublishFirmwareResponse {}
12064impl Response for UnpublishFirmwareResponse {}
12065
12066/// Id of dynamic charging profile to update.
12067///
12068/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12069#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12070pub struct UpdateDynamicScheduleRequest {
12071    /// Id of charging profile to update.
12072    #[serde(rename = "chargingProfileId")]
12073    #[serde(deserialize_with = "crate::types::integer::one")]
12074    pub charging_profile_id: i32,
12075    /// The `scheduleUpdate` member.
12076    #[serde(rename = "scheduleUpdate")]
12077    pub schedule_update: ChargingScheduleUpdate,
12078    /// The `customData` member.
12079    #[serde(rename = "customData")]
12080    #[serde(default, skip_serializing_if = "Option::is_none")]
12081    pub custom_data: Option<crate::types::CustomData>,
12082}
12083
12084impl UpdateDynamicScheduleRequest {
12085    /// Creates a `UpdateDynamicScheduleRequest` from its required fields.
12086    #[must_use]
12087    pub fn new(charging_profile_id: i32, schedule_update: ChargingScheduleUpdate) -> Self {
12088        Self {
12089            charging_profile_id,
12090            schedule_update,
12091            custom_data: None,
12092        }
12093    }
12094
12095    /// Sets the optional `customData` field.
12096    #[must_use]
12097    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12098        self.custom_data = Some(value);
12099        self
12100    }
12101}
12102
12103impl Validate for UpdateDynamicScheduleRequest {
12104    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12105        path.push_key("scheduleUpdate");
12106        Validate::validate_at(&self.schedule_update, path, out);
12107        path.pop();
12108        path.push_key("customData");
12109        if let Some(value) = &self.custom_data {
12110            Validate::validate_at(value, path, out);
12111        }
12112        path.pop();
12113    }
12114}
12115
12116impl Sealed for UpdateDynamicScheduleRequest {}
12117impl Request for UpdateDynamicScheduleRequest {
12118    type Action = Action;
12119    const ACTION: Action = Action::UpdateDynamicSchedule;
12120    const KIND: MessageKind = MessageKind::Call;
12121    const ORIGIN: Origin = Origin::Csms;
12122    type Response = UpdateDynamicScheduleResponse;
12123}
12124
12125impl Confirmed for UpdateDynamicScheduleRequest {}
12126
12127/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12128#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12129pub struct UpdateDynamicScheduleResponse {
12130    /// The `status` member.
12131    pub status: ChargingProfileStatus,
12132    /// The `statusInfo` member.
12133    #[serde(rename = "statusInfo")]
12134    #[serde(default, skip_serializing_if = "Option::is_none")]
12135    pub status_info: Option<StatusInfo>,
12136    /// The `customData` member.
12137    #[serde(rename = "customData")]
12138    #[serde(default, skip_serializing_if = "Option::is_none")]
12139    pub custom_data: Option<crate::types::CustomData>,
12140}
12141
12142impl UpdateDynamicScheduleResponse {
12143    /// Creates a `UpdateDynamicScheduleResponse` from its required fields.
12144    #[must_use]
12145    pub fn new(status: ChargingProfileStatus) -> Self {
12146        Self {
12147            status,
12148            status_info: None,
12149            custom_data: None,
12150        }
12151    }
12152
12153    /// Sets the optional `statusInfo` field.
12154    #[must_use]
12155    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12156        self.status_info = Some(value);
12157        self
12158    }
12159
12160    /// Sets the optional `customData` field.
12161    #[must_use]
12162    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12163        self.custom_data = Some(value);
12164        self
12165    }
12166}
12167
12168impl Validate for UpdateDynamicScheduleResponse {
12169    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12170        path.push_key("status");
12171        Validate::validate_at(&self.status, path, out);
12172        path.pop();
12173        path.push_key("statusInfo");
12174        if let Some(value) = &self.status_info {
12175            Validate::validate_at(value, path, out);
12176        }
12177        path.pop();
12178        path.push_key("customData");
12179        if let Some(value) = &self.custom_data {
12180            Validate::validate_at(value, path, out);
12181        }
12182        path.pop();
12183    }
12184}
12185
12186impl Sealed for UpdateDynamicScheduleResponse {}
12187impl Response for UpdateDynamicScheduleResponse {}
12188
12189/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
12190#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12191pub struct UpdateFirmwareRequest {
12192    /// The Id of this request
12193    #[serde(rename = "requestId")]
12194    #[serde(deserialize_with = "crate::types::integer::one")]
12195    pub request_id: i32,
12196    /// The `firmware` member.
12197    pub firmware: Firmware,
12198    /// This specifies how many times Charging Station must retry to download the firmware before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry.
12199    /// If the value is 0, it means: no retries.
12200    #[serde(default, skip_serializing_if = "Option::is_none")]
12201    #[serde(deserialize_with = "crate::types::integer::option")]
12202    pub retries: Option<i32>,
12203    /// The interval in seconds after which a retry may be attempted. If this field is not present, it is left to Charging Station to decide how long to wait between attempts.
12204    #[serde(rename = "retryInterval")]
12205    #[serde(default, skip_serializing_if = "Option::is_none")]
12206    #[serde(deserialize_with = "crate::types::integer::option")]
12207    pub retry_interval: Option<i32>,
12208    /// The `customData` member.
12209    #[serde(rename = "customData")]
12210    #[serde(default, skip_serializing_if = "Option::is_none")]
12211    pub custom_data: Option<crate::types::CustomData>,
12212}
12213
12214impl UpdateFirmwareRequest {
12215    /// Creates a `UpdateFirmwareRequest` from its required fields.
12216    #[must_use]
12217    pub fn new(request_id: i32, firmware: Firmware) -> Self {
12218        Self {
12219            request_id,
12220            firmware,
12221            retries: None,
12222            retry_interval: None,
12223            custom_data: None,
12224        }
12225    }
12226
12227    /// Sets the optional `retries` field.
12228    #[must_use]
12229    pub fn with_retries(mut self, value: i32) -> Self {
12230        self.retries = Some(value);
12231        self
12232    }
12233
12234    /// Sets the optional `retryInterval` field.
12235    #[must_use]
12236    pub fn with_retry_interval(mut self, value: i32) -> Self {
12237        self.retry_interval = Some(value);
12238        self
12239    }
12240
12241    /// Sets the optional `customData` field.
12242    #[must_use]
12243    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12244        self.custom_data = Some(value);
12245        self
12246    }
12247}
12248
12249impl Validate for UpdateFirmwareRequest {
12250    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12251        path.push_key("firmware");
12252        Validate::validate_at(&self.firmware, path, out);
12253        path.pop();
12254        path.push_key("retries");
12255        if let Some(value) = &self.retries {
12256            validate::int_range(i64::from(*value), Some(0), None, path, out);
12257        }
12258        path.pop();
12259        path.push_key("customData");
12260        if let Some(value) = &self.custom_data {
12261            Validate::validate_at(value, path, out);
12262        }
12263        path.pop();
12264    }
12265}
12266
12267impl Sealed for UpdateFirmwareRequest {}
12268impl Request for UpdateFirmwareRequest {
12269    type Action = Action;
12270    const ACTION: Action = Action::UpdateFirmware;
12271    const KIND: MessageKind = MessageKind::Call;
12272    const ORIGIN: Origin = Origin::Csms;
12273    type Response = UpdateFirmwareResponse;
12274}
12275
12276impl Confirmed for UpdateFirmwareRequest {}
12277
12278/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
12279#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12280pub struct UpdateFirmwareResponse {
12281    /// The `status` member.
12282    pub status: UpdateFirmwareStatus,
12283    /// The `statusInfo` member.
12284    #[serde(rename = "statusInfo")]
12285    #[serde(default, skip_serializing_if = "Option::is_none")]
12286    pub status_info: Option<StatusInfo>,
12287    /// The `customData` member.
12288    #[serde(rename = "customData")]
12289    #[serde(default, skip_serializing_if = "Option::is_none")]
12290    pub custom_data: Option<crate::types::CustomData>,
12291}
12292
12293impl UpdateFirmwareResponse {
12294    /// Creates a `UpdateFirmwareResponse` from its required fields.
12295    #[must_use]
12296    pub fn new(status: UpdateFirmwareStatus) -> Self {
12297        Self {
12298            status,
12299            status_info: None,
12300            custom_data: None,
12301        }
12302    }
12303
12304    /// Sets the optional `statusInfo` field.
12305    #[must_use]
12306    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12307        self.status_info = Some(value);
12308        self
12309    }
12310
12311    /// Sets the optional `customData` field.
12312    #[must_use]
12313    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12314        self.custom_data = Some(value);
12315        self
12316    }
12317}
12318
12319impl Validate for UpdateFirmwareResponse {
12320    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12321        path.push_key("status");
12322        Validate::validate_at(&self.status, path, out);
12323        path.pop();
12324        path.push_key("statusInfo");
12325        if let Some(value) = &self.status_info {
12326            Validate::validate_at(value, path, out);
12327        }
12328        path.pop();
12329        path.push_key("customData");
12330        if let Some(value) = &self.custom_data {
12331            Validate::validate_at(value, path, out);
12332        }
12333        path.pop();
12334    }
12335}
12336
12337impl Sealed for UpdateFirmwareResponse {}
12338impl Response for UpdateFirmwareResponse {}
12339
12340/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12341#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12342pub struct UsePriorityChargingRequest {
12343    /// The transaction for which priority charging is requested.
12344    #[serde(rename = "transactionId")]
12345    pub transaction_id: String,
12346    /// True to request priority charging.
12347    /// False to request stopping priority charging.
12348    pub activate: bool,
12349    /// The `customData` member.
12350    #[serde(rename = "customData")]
12351    #[serde(default, skip_serializing_if = "Option::is_none")]
12352    pub custom_data: Option<crate::types::CustomData>,
12353}
12354
12355impl UsePriorityChargingRequest {
12356    /// Creates a `UsePriorityChargingRequest` from its required fields.
12357    #[must_use]
12358    pub fn new(transaction_id: impl Into<String>, activate: bool) -> Self {
12359        Self {
12360            transaction_id: transaction_id.into(),
12361            activate,
12362            custom_data: None,
12363        }
12364    }
12365
12366    /// Sets the optional `customData` field.
12367    #[must_use]
12368    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12369        self.custom_data = Some(value);
12370        self
12371    }
12372}
12373
12374impl Validate for UsePriorityChargingRequest {
12375    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12376        path.push_key("transactionId");
12377        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
12378        path.pop();
12379        path.push_key("customData");
12380        if let Some(value) = &self.custom_data {
12381            Validate::validate_at(value, path, out);
12382        }
12383        path.pop();
12384    }
12385}
12386
12387impl Sealed for UsePriorityChargingRequest {}
12388impl Request for UsePriorityChargingRequest {
12389    type Action = Action;
12390    const ACTION: Action = Action::UsePriorityCharging;
12391    const KIND: MessageKind = MessageKind::Call;
12392    const ORIGIN: Origin = Origin::Csms;
12393    type Response = UsePriorityChargingResponse;
12394}
12395
12396impl Confirmed for UsePriorityChargingRequest {}
12397
12398/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12399#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12400pub struct UsePriorityChargingResponse {
12401    /// The `status` member.
12402    pub status: PriorityChargingStatus,
12403    /// The `statusInfo` member.
12404    #[serde(rename = "statusInfo")]
12405    #[serde(default, skip_serializing_if = "Option::is_none")]
12406    pub status_info: Option<StatusInfo>,
12407    /// The `customData` member.
12408    #[serde(rename = "customData")]
12409    #[serde(default, skip_serializing_if = "Option::is_none")]
12410    pub custom_data: Option<crate::types::CustomData>,
12411}
12412
12413impl UsePriorityChargingResponse {
12414    /// Creates a `UsePriorityChargingResponse` from its required fields.
12415    #[must_use]
12416    pub fn new(status: PriorityChargingStatus) -> Self {
12417        Self {
12418            status,
12419            status_info: None,
12420            custom_data: None,
12421        }
12422    }
12423
12424    /// Sets the optional `statusInfo` field.
12425    #[must_use]
12426    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12427        self.status_info = Some(value);
12428        self
12429    }
12430
12431    /// Sets the optional `customData` field.
12432    #[must_use]
12433    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12434        self.custom_data = Some(value);
12435        self
12436    }
12437}
12438
12439impl Validate for UsePriorityChargingResponse {
12440    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12441        path.push_key("status");
12442        Validate::validate_at(&self.status, path, out);
12443        path.pop();
12444        path.push_key("statusInfo");
12445        if let Some(value) = &self.status_info {
12446            Validate::validate_at(value, path, out);
12447        }
12448        path.pop();
12449        path.push_key("customData");
12450        if let Some(value) = &self.custom_data {
12451            Validate::validate_at(value, path, out);
12452        }
12453        path.pop();
12454    }
12455}
12456
12457impl Sealed for UsePriorityChargingResponse {}
12458impl Response for UsePriorityChargingResponse {}
12459
12460/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
12461#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12462pub struct VatNumberValidationRequest {
12463    /// VAT number to check.
12464    #[serde(rename = "vatNumber")]
12465    pub vat_number: String,
12466    /// EVSE id for which check is done
12467    #[serde(rename = "evseId")]
12468    #[serde(default, skip_serializing_if = "Option::is_none")]
12469    #[serde(deserialize_with = "crate::types::integer::option")]
12470    pub evse_id: Option<i32>,
12471    /// The `customData` member.
12472    #[serde(rename = "customData")]
12473    #[serde(default, skip_serializing_if = "Option::is_none")]
12474    pub custom_data: Option<crate::types::CustomData>,
12475}
12476
12477impl VatNumberValidationRequest {
12478    /// Creates a `VatNumberValidationRequest` from its required fields.
12479    #[must_use]
12480    pub fn new(vat_number: impl Into<String>) -> Self {
12481        Self {
12482            vat_number: vat_number.into(),
12483            evse_id: None,
12484            custom_data: None,
12485        }
12486    }
12487
12488    /// Sets the optional `evseId` field.
12489    #[must_use]
12490    pub fn with_evse_id(mut self, value: i32) -> Self {
12491        self.evse_id = Some(value);
12492        self
12493    }
12494
12495    /// Sets the optional `customData` field.
12496    #[must_use]
12497    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12498        self.custom_data = Some(value);
12499        self
12500    }
12501}
12502
12503impl Validate for VatNumberValidationRequest {
12504    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12505        path.push_key("vatNumber");
12506        validate::string(self.vat_number.as_str(), None, Some(20), path, out);
12507        path.pop();
12508        path.push_key("evseId");
12509        if let Some(value) = &self.evse_id {
12510            validate::int_range(i64::from(*value), Some(0), None, path, out);
12511        }
12512        path.pop();
12513        path.push_key("customData");
12514        if let Some(value) = &self.custom_data {
12515            Validate::validate_at(value, path, out);
12516        }
12517        path.pop();
12518    }
12519}
12520
12521impl Sealed for VatNumberValidationRequest {}
12522impl Request for VatNumberValidationRequest {
12523    type Action = Action;
12524    const ACTION: Action = Action::VatNumberValidation;
12525    const KIND: MessageKind = MessageKind::Call;
12526    const ORIGIN: Origin = Origin::ChargingStation;
12527    type Response = VatNumberValidationResponse;
12528}
12529
12530impl Confirmed for VatNumberValidationRequest {}
12531
12532/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
12533#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12534pub struct VatNumberValidationResponse {
12535    /// VAT number that was requested.
12536    #[serde(rename = "vatNumber")]
12537    pub vat_number: String,
12538    /// The `status` member.
12539    pub status: GenericStatus,
12540    /// The `company` member.
12541    #[serde(default, skip_serializing_if = "Option::is_none")]
12542    pub company: Option<Address>,
12543    /// The `statusInfo` member.
12544    #[serde(rename = "statusInfo")]
12545    #[serde(default, skip_serializing_if = "Option::is_none")]
12546    pub status_info: Option<StatusInfo>,
12547    /// EVSE id for which check was requested.
12548    #[serde(rename = "evseId")]
12549    #[serde(default, skip_serializing_if = "Option::is_none")]
12550    #[serde(deserialize_with = "crate::types::integer::option")]
12551    pub evse_id: Option<i32>,
12552    /// The `customData` member.
12553    #[serde(rename = "customData")]
12554    #[serde(default, skip_serializing_if = "Option::is_none")]
12555    pub custom_data: Option<crate::types::CustomData>,
12556}
12557
12558impl VatNumberValidationResponse {
12559    /// Creates a `VatNumberValidationResponse` from its required fields.
12560    #[must_use]
12561    pub fn new(vat_number: impl Into<String>, status: GenericStatus) -> Self {
12562        Self {
12563            vat_number: vat_number.into(),
12564            status,
12565            company: None,
12566            status_info: None,
12567            evse_id: None,
12568            custom_data: None,
12569        }
12570    }
12571
12572    /// Sets the optional `company` field.
12573    #[must_use]
12574    pub fn with_company(mut self, value: Address) -> Self {
12575        self.company = Some(value);
12576        self
12577    }
12578
12579    /// Sets the optional `statusInfo` field.
12580    #[must_use]
12581    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12582        self.status_info = Some(value);
12583        self
12584    }
12585
12586    /// Sets the optional `evseId` field.
12587    #[must_use]
12588    pub fn with_evse_id(mut self, value: i32) -> Self {
12589        self.evse_id = Some(value);
12590        self
12591    }
12592
12593    /// Sets the optional `customData` field.
12594    #[must_use]
12595    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12596        self.custom_data = Some(value);
12597        self
12598    }
12599}
12600
12601impl Validate for VatNumberValidationResponse {
12602    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12603        path.push_key("vatNumber");
12604        validate::string(self.vat_number.as_str(), None, Some(20), path, out);
12605        path.pop();
12606        path.push_key("status");
12607        Validate::validate_at(&self.status, path, out);
12608        path.pop();
12609        path.push_key("company");
12610        if let Some(value) = &self.company {
12611            Validate::validate_at(value, path, out);
12612        }
12613        path.pop();
12614        path.push_key("statusInfo");
12615        if let Some(value) = &self.status_info {
12616            Validate::validate_at(value, path, out);
12617        }
12618        path.pop();
12619        path.push_key("evseId");
12620        if let Some(value) = &self.evse_id {
12621            validate::int_range(i64::from(*value), Some(0), None, path, out);
12622        }
12623        path.pop();
12624        path.push_key("customData");
12625        if let Some(value) = &self.custom_data {
12626            Validate::validate_at(value, path, out);
12627        }
12628        path.pop();
12629    }
12630}
12631
12632impl Sealed for VatNumberValidationResponse {}
12633impl Response for VatNumberValidationResponse {}