Skip to main content

ocpp_kit/v2_0_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.0.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.0.1 · C — Authorization · Charging Station → CSMS · CALL.
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct AuthorizeRequest {
28    /// The `idToken` member.
29    #[serde(rename = "idToken")]
30    pub id_token: IdToken,
31    /// The X.509 certificated presented by EV and encoded in PEM format.
32    #[serde(default, skip_serializing_if = "Option::is_none")]
33    pub certificate: Option<String>,
34    /// The `iso15118CertificateHashData` member.
35    #[serde(rename = "iso15118CertificateHashData")]
36    #[serde(default, skip_serializing_if = "Option::is_none")]
37    pub iso15118_certificate_hash_data: Option<Vec<OCSPRequestData>>,
38    /// The `customData` member.
39    #[serde(rename = "customData")]
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    pub custom_data: Option<crate::types::CustomData>,
42}
43
44impl AuthorizeRequest {
45    /// Creates a `AuthorizeRequest` from its required fields.
46    #[must_use]
47    pub fn new(id_token: IdToken) -> Self {
48        Self {
49            id_token,
50            certificate: None,
51            iso15118_certificate_hash_data: None,
52            custom_data: None,
53        }
54    }
55
56    /// Sets the optional `certificate` field.
57    #[must_use]
58    pub fn with_certificate(mut self, value: impl Into<String>) -> Self {
59        self.certificate = Some(value.into());
60        self
61    }
62
63    /// Sets the optional `iso15118CertificateHashData` field.
64    #[must_use]
65    pub fn with_iso15118_certificate_hash_data(mut self, value: Vec<OCSPRequestData>) -> Self {
66        self.iso15118_certificate_hash_data = Some(value);
67        self
68    }
69
70    /// Sets the optional `customData` field.
71    #[must_use]
72    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
73        self.custom_data = Some(value);
74        self
75    }
76}
77
78impl Validate for AuthorizeRequest {
79    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
80        path.push_key("idToken");
81        Validate::validate_at(&self.id_token, path, out);
82        path.pop();
83        path.push_key("certificate");
84        if let Some(value) = &self.certificate {
85            validate::string(value.as_str(), None, Some(5500), path, out);
86        }
87        path.pop();
88        path.push_key("iso15118CertificateHashData");
89        if let Some(value) = &self.iso15118_certificate_hash_data {
90            validate::list_len(value.len(), Some(1), Some(4), path, out);
91            for (index, item) in value.iter().enumerate() {
92                path.push_index(index);
93                Validate::validate_at(item, path, out);
94                path.pop();
95            }
96        }
97        path.pop();
98        path.push_key("customData");
99        if let Some(value) = &self.custom_data {
100            Validate::validate_at(value, path, out);
101        }
102        path.pop();
103    }
104}
105
106impl Sealed for AuthorizeRequest {}
107impl Request for AuthorizeRequest {
108    type Action = Action;
109    const ACTION: Action = Action::Authorize;
110    const KIND: MessageKind = MessageKind::Call;
111    const ORIGIN: Origin = Origin::ChargingStation;
112    type Response = AuthorizeResponse;
113}
114
115impl Confirmed for AuthorizeRequest {}
116
117/// Spec: OCPP 2.0.1 · C — Authorization · Charging Station → CSMS · CALL.
118#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
119pub struct AuthorizeResponse {
120    /// The `idTokenInfo` member.
121    #[serde(rename = "idTokenInfo")]
122    pub id_token_info: IdTokenInfo,
123    /// The `certificateStatus` member.
124    #[serde(rename = "certificateStatus")]
125    #[serde(default, skip_serializing_if = "Option::is_none")]
126    pub certificate_status: Option<AuthorizeCertificateStatus>,
127    /// The `customData` member.
128    #[serde(rename = "customData")]
129    #[serde(default, skip_serializing_if = "Option::is_none")]
130    pub custom_data: Option<crate::types::CustomData>,
131}
132
133impl AuthorizeResponse {
134    /// Creates a `AuthorizeResponse` from its required fields.
135    #[must_use]
136    pub fn new(id_token_info: IdTokenInfo) -> Self {
137        Self {
138            id_token_info,
139            certificate_status: None,
140            custom_data: None,
141        }
142    }
143
144    /// Sets the optional `certificateStatus` field.
145    #[must_use]
146    pub fn with_certificate_status(mut self, value: AuthorizeCertificateStatus) -> Self {
147        self.certificate_status = Some(value);
148        self
149    }
150
151    /// Sets the optional `customData` field.
152    #[must_use]
153    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
154        self.custom_data = Some(value);
155        self
156    }
157}
158
159impl Validate for AuthorizeResponse {
160    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
161        path.push_key("idTokenInfo");
162        Validate::validate_at(&self.id_token_info, path, out);
163        path.pop();
164        path.push_key("certificateStatus");
165        if let Some(value) = &self.certificate_status {
166            Validate::validate_at(value, path, out);
167        }
168        path.pop();
169        path.push_key("customData");
170        if let Some(value) = &self.custom_data {
171            Validate::validate_at(value, path, out);
172        }
173        path.pop();
174    }
175}
176
177impl Sealed for AuthorizeResponse {}
178impl Response for AuthorizeResponse {}
179
180/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
181#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
182pub struct BootNotificationRequest {
183    /// The `chargingStation` member.
184    #[serde(rename = "chargingStation")]
185    pub charging_station: ChargingStation,
186    /// The `reason` member.
187    pub reason: BootReason,
188    /// The `customData` member.
189    #[serde(rename = "customData")]
190    #[serde(default, skip_serializing_if = "Option::is_none")]
191    pub custom_data: Option<crate::types::CustomData>,
192}
193
194impl BootNotificationRequest {
195    /// Creates a `BootNotificationRequest` from its required fields.
196    #[must_use]
197    pub fn new(charging_station: ChargingStation, reason: BootReason) -> Self {
198        Self {
199            charging_station,
200            reason,
201            custom_data: None,
202        }
203    }
204
205    /// Sets the optional `customData` field.
206    #[must_use]
207    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
208        self.custom_data = Some(value);
209        self
210    }
211}
212
213impl Validate for BootNotificationRequest {
214    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
215        path.push_key("chargingStation");
216        Validate::validate_at(&self.charging_station, path, out);
217        path.pop();
218        path.push_key("reason");
219        Validate::validate_at(&self.reason, path, out);
220        path.pop();
221        path.push_key("customData");
222        if let Some(value) = &self.custom_data {
223            Validate::validate_at(value, path, out);
224        }
225        path.pop();
226    }
227}
228
229impl Sealed for BootNotificationRequest {}
230impl Request for BootNotificationRequest {
231    type Action = Action;
232    const ACTION: Action = Action::BootNotification;
233    const KIND: MessageKind = MessageKind::Call;
234    const ORIGIN: Origin = Origin::ChargingStation;
235    type Response = BootNotificationResponse;
236}
237
238impl Confirmed for BootNotificationRequest {}
239
240/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
241#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
242pub struct BootNotificationResponse {
243    /// This contains the CSMS’s current time.
244    #[serde(rename = "currentTime")]
245    pub current_time: crate::types::DateTime,
246    /// 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.
247    pub interval: i32,
248    /// The `status` member.
249    pub status: RegistrationStatus,
250    /// The `statusInfo` member.
251    #[serde(rename = "statusInfo")]
252    #[serde(default, skip_serializing_if = "Option::is_none")]
253    pub status_info: Option<StatusInfo>,
254    /// The `customData` member.
255    #[serde(rename = "customData")]
256    #[serde(default, skip_serializing_if = "Option::is_none")]
257    pub custom_data: Option<crate::types::CustomData>,
258}
259
260impl BootNotificationResponse {
261    /// Creates a `BootNotificationResponse` from its required fields.
262    #[must_use]
263    pub fn new(
264        current_time: impl Into<crate::types::DateTime>,
265        interval: i32,
266        status: RegistrationStatus,
267    ) -> Self {
268        Self {
269            current_time: current_time.into(),
270            interval,
271            status,
272            status_info: None,
273            custom_data: None,
274        }
275    }
276
277    /// Sets the optional `statusInfo` field.
278    #[must_use]
279    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
280        self.status_info = Some(value);
281        self
282    }
283
284    /// Sets the optional `customData` field.
285    #[must_use]
286    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
287        self.custom_data = Some(value);
288        self
289    }
290}
291
292impl Validate for BootNotificationResponse {
293    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
294        path.push_key("status");
295        Validate::validate_at(&self.status, path, out);
296        path.pop();
297        path.push_key("statusInfo");
298        if let Some(value) = &self.status_info {
299            Validate::validate_at(value, path, out);
300        }
301        path.pop();
302        path.push_key("customData");
303        if let Some(value) = &self.custom_data {
304            Validate::validate_at(value, path, out);
305        }
306        path.pop();
307    }
308}
309
310impl Sealed for BootNotificationResponse {}
311impl Response for BootNotificationResponse {}
312
313/// Spec: OCPP 2.0.1 · H — Reservation · CSMS → Charging Station · CALL.
314#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
315pub struct CancelReservationRequest {
316    /// Id of the reservation to cancel.
317    #[serde(rename = "reservationId")]
318    pub reservation_id: i32,
319    /// The `customData` member.
320    #[serde(rename = "customData")]
321    #[serde(default, skip_serializing_if = "Option::is_none")]
322    pub custom_data: Option<crate::types::CustomData>,
323}
324
325impl CancelReservationRequest {
326    /// Creates a `CancelReservationRequest` from its required fields.
327    #[must_use]
328    pub fn new(reservation_id: i32) -> Self {
329        Self {
330            reservation_id,
331            custom_data: None,
332        }
333    }
334
335    /// Sets the optional `customData` field.
336    #[must_use]
337    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
338        self.custom_data = Some(value);
339        self
340    }
341}
342
343impl Validate for CancelReservationRequest {
344    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
345        path.push_key("customData");
346        if let Some(value) = &self.custom_data {
347            Validate::validate_at(value, path, out);
348        }
349        path.pop();
350    }
351}
352
353impl Sealed for CancelReservationRequest {}
354impl Request for CancelReservationRequest {
355    type Action = Action;
356    const ACTION: Action = Action::CancelReservation;
357    const KIND: MessageKind = MessageKind::Call;
358    const ORIGIN: Origin = Origin::Csms;
359    type Response = CancelReservationResponse;
360}
361
362impl Confirmed for CancelReservationRequest {}
363
364/// Spec: OCPP 2.0.1 · H — Reservation · CSMS → Charging Station · CALL.
365#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
366pub struct CancelReservationResponse {
367    /// The `status` member.
368    pub status: CancelReservationStatus,
369    /// The `statusInfo` member.
370    #[serde(rename = "statusInfo")]
371    #[serde(default, skip_serializing_if = "Option::is_none")]
372    pub status_info: Option<StatusInfo>,
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 CancelReservationResponse {
380    /// Creates a `CancelReservationResponse` from its required fields.
381    #[must_use]
382    pub fn new(status: CancelReservationStatus) -> Self {
383        Self {
384            status,
385            status_info: None,
386            custom_data: None,
387        }
388    }
389
390    /// Sets the optional `statusInfo` field.
391    #[must_use]
392    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
393        self.status_info = Some(value);
394        self
395    }
396
397    /// Sets the optional `customData` field.
398    #[must_use]
399    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
400        self.custom_data = Some(value);
401        self
402    }
403}
404
405impl Validate for CancelReservationResponse {
406    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
407        path.push_key("status");
408        Validate::validate_at(&self.status, path, out);
409        path.pop();
410        path.push_key("statusInfo");
411        if let Some(value) = &self.status_info {
412            Validate::validate_at(value, path, out);
413        }
414        path.pop();
415        path.push_key("customData");
416        if let Some(value) = &self.custom_data {
417            Validate::validate_at(value, path, out);
418        }
419        path.pop();
420    }
421}
422
423impl Sealed for CancelReservationResponse {}
424impl Response for CancelReservationResponse {}
425
426/// Spec: OCPP 2.0.1 · A — Security · CSMS → Charging Station · CALL.
427#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
428pub struct CertificateSignedRequest {
429    /// The signed PEM encoded X.509 certificate. This can also contain the necessary sub CA certificates. In that case, the order of the bundle should follow the certificate chain, starting from the leaf certificate.
430    ///
431    /// The Configuration Variable &lt;&lt;configkey-max-certificate-chain-size,MaxCertificateChainSize&gt;&gt; can be used to limit the maximum size of this field.
432    #[serde(rename = "certificateChain")]
433    pub certificate_chain: String,
434    /// The `certificateType` member.
435    #[serde(rename = "certificateType")]
436    #[serde(default, skip_serializing_if = "Option::is_none")]
437    pub certificate_type: Option<CertificateSigningUse>,
438    /// The `customData` member.
439    #[serde(rename = "customData")]
440    #[serde(default, skip_serializing_if = "Option::is_none")]
441    pub custom_data: Option<crate::types::CustomData>,
442}
443
444impl CertificateSignedRequest {
445    /// Creates a `CertificateSignedRequest` from its required fields.
446    #[must_use]
447    pub fn new(certificate_chain: impl Into<String>) -> Self {
448        Self {
449            certificate_chain: certificate_chain.into(),
450            certificate_type: None,
451            custom_data: None,
452        }
453    }
454
455    /// Sets the optional `certificateType` field.
456    #[must_use]
457    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
458        self.certificate_type = Some(value);
459        self
460    }
461
462    /// Sets the optional `customData` field.
463    #[must_use]
464    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
465        self.custom_data = Some(value);
466        self
467    }
468}
469
470impl Validate for CertificateSignedRequest {
471    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
472        path.push_key("certificateChain");
473        validate::string(
474            self.certificate_chain.as_str(),
475            None,
476            Some(10000),
477            path,
478            out,
479        );
480        path.pop();
481        path.push_key("certificateType");
482        if let Some(value) = &self.certificate_type {
483            Validate::validate_at(value, path, out);
484        }
485        path.pop();
486        path.push_key("customData");
487        if let Some(value) = &self.custom_data {
488            Validate::validate_at(value, path, out);
489        }
490        path.pop();
491    }
492}
493
494impl Sealed for CertificateSignedRequest {}
495impl Request for CertificateSignedRequest {
496    type Action = Action;
497    const ACTION: Action = Action::CertificateSigned;
498    const KIND: MessageKind = MessageKind::Call;
499    const ORIGIN: Origin = Origin::Csms;
500    type Response = CertificateSignedResponse;
501}
502
503impl Confirmed for CertificateSignedRequest {}
504
505/// Spec: OCPP 2.0.1 · A — Security · CSMS → Charging Station · CALL.
506#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
507pub struct CertificateSignedResponse {
508    /// The `status` member.
509    pub status: CertificateSignedStatus,
510    /// The `statusInfo` member.
511    #[serde(rename = "statusInfo")]
512    #[serde(default, skip_serializing_if = "Option::is_none")]
513    pub status_info: Option<StatusInfo>,
514    /// The `customData` member.
515    #[serde(rename = "customData")]
516    #[serde(default, skip_serializing_if = "Option::is_none")]
517    pub custom_data: Option<crate::types::CustomData>,
518}
519
520impl CertificateSignedResponse {
521    /// Creates a `CertificateSignedResponse` from its required fields.
522    #[must_use]
523    pub fn new(status: CertificateSignedStatus) -> Self {
524        Self {
525            status,
526            status_info: None,
527            custom_data: None,
528        }
529    }
530
531    /// Sets the optional `statusInfo` field.
532    #[must_use]
533    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
534        self.status_info = Some(value);
535        self
536    }
537
538    /// Sets the optional `customData` field.
539    #[must_use]
540    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
541        self.custom_data = Some(value);
542        self
543    }
544}
545
546impl Validate for CertificateSignedResponse {
547    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
548        path.push_key("status");
549        Validate::validate_at(&self.status, path, out);
550        path.pop();
551        path.push_key("statusInfo");
552        if let Some(value) = &self.status_info {
553            Validate::validate_at(value, path, out);
554        }
555        path.pop();
556        path.push_key("customData");
557        if let Some(value) = &self.custom_data {
558            Validate::validate_at(value, path, out);
559        }
560        path.pop();
561    }
562}
563
564impl Sealed for CertificateSignedResponse {}
565impl Response for CertificateSignedResponse {}
566
567/// Spec: OCPP 2.0.1 · G — Availability · CSMS → Charging Station · CALL.
568#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
569pub struct ChangeAvailabilityRequest {
570    /// The `operationalStatus` member.
571    #[serde(rename = "operationalStatus")]
572    pub operational_status: OperationalStatus,
573    /// The `evse` member.
574    #[serde(default, skip_serializing_if = "Option::is_none")]
575    pub evse: Option<EVSE>,
576    /// The `customData` member.
577    #[serde(rename = "customData")]
578    #[serde(default, skip_serializing_if = "Option::is_none")]
579    pub custom_data: Option<crate::types::CustomData>,
580}
581
582impl ChangeAvailabilityRequest {
583    /// Creates a `ChangeAvailabilityRequest` from its required fields.
584    #[must_use]
585    pub fn new(operational_status: OperationalStatus) -> Self {
586        Self {
587            operational_status,
588            evse: None,
589            custom_data: None,
590        }
591    }
592
593    /// Sets the optional `evse` field.
594    #[must_use]
595    pub fn with_evse(mut self, value: EVSE) -> Self {
596        self.evse = Some(value);
597        self
598    }
599
600    /// Sets the optional `customData` field.
601    #[must_use]
602    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
603        self.custom_data = Some(value);
604        self
605    }
606}
607
608impl Validate for ChangeAvailabilityRequest {
609    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
610        path.push_key("operationalStatus");
611        Validate::validate_at(&self.operational_status, path, out);
612        path.pop();
613        path.push_key("evse");
614        if let Some(value) = &self.evse {
615            Validate::validate_at(value, path, out);
616        }
617        path.pop();
618        path.push_key("customData");
619        if let Some(value) = &self.custom_data {
620            Validate::validate_at(value, path, out);
621        }
622        path.pop();
623    }
624}
625
626impl Sealed for ChangeAvailabilityRequest {}
627impl Request for ChangeAvailabilityRequest {
628    type Action = Action;
629    const ACTION: Action = Action::ChangeAvailability;
630    const KIND: MessageKind = MessageKind::Call;
631    const ORIGIN: Origin = Origin::Csms;
632    type Response = ChangeAvailabilityResponse;
633}
634
635impl Confirmed for ChangeAvailabilityRequest {}
636
637/// Spec: OCPP 2.0.1 · G — Availability · CSMS → Charging Station · CALL.
638#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
639pub struct ChangeAvailabilityResponse {
640    /// The `status` member.
641    pub status: ChangeAvailabilityStatus,
642    /// The `statusInfo` member.
643    #[serde(rename = "statusInfo")]
644    #[serde(default, skip_serializing_if = "Option::is_none")]
645    pub status_info: Option<StatusInfo>,
646    /// The `customData` member.
647    #[serde(rename = "customData")]
648    #[serde(default, skip_serializing_if = "Option::is_none")]
649    pub custom_data: Option<crate::types::CustomData>,
650}
651
652impl ChangeAvailabilityResponse {
653    /// Creates a `ChangeAvailabilityResponse` from its required fields.
654    #[must_use]
655    pub fn new(status: ChangeAvailabilityStatus) -> Self {
656        Self {
657            status,
658            status_info: None,
659            custom_data: None,
660        }
661    }
662
663    /// Sets the optional `statusInfo` field.
664    #[must_use]
665    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
666        self.status_info = Some(value);
667        self
668    }
669
670    /// Sets the optional `customData` field.
671    #[must_use]
672    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
673        self.custom_data = Some(value);
674        self
675    }
676}
677
678impl Validate for ChangeAvailabilityResponse {
679    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
680        path.push_key("status");
681        Validate::validate_at(&self.status, path, out);
682        path.pop();
683        path.push_key("statusInfo");
684        if let Some(value) = &self.status_info {
685            Validate::validate_at(value, path, out);
686        }
687        path.pop();
688        path.push_key("customData");
689        if let Some(value) = &self.custom_data {
690            Validate::validate_at(value, path, out);
691        }
692        path.pop();
693    }
694}
695
696impl Sealed for ChangeAvailabilityResponse {}
697impl Response for ChangeAvailabilityResponse {}
698
699/// Spec: OCPP 2.0.1 · C — Authorization · CSMS → Charging Station · CALL.
700#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
701pub struct ClearCacheRequest {
702    /// The `customData` member.
703    #[serde(rename = "customData")]
704    #[serde(default, skip_serializing_if = "Option::is_none")]
705    pub custom_data: Option<crate::types::CustomData>,
706}
707
708impl ClearCacheRequest {
709    /// Creates an empty `ClearCacheRequest`. Every field of this type is optional.
710    #[must_use]
711    pub fn new() -> Self {
712        Self::default()
713    }
714
715    /// Sets the optional `customData` field.
716    #[must_use]
717    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
718        self.custom_data = Some(value);
719        self
720    }
721}
722
723impl Validate for ClearCacheRequest {
724    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
725        path.push_key("customData");
726        if let Some(value) = &self.custom_data {
727            Validate::validate_at(value, path, out);
728        }
729        path.pop();
730    }
731}
732
733impl Sealed for ClearCacheRequest {}
734impl Request for ClearCacheRequest {
735    type Action = Action;
736    const ACTION: Action = Action::ClearCache;
737    const KIND: MessageKind = MessageKind::Call;
738    const ORIGIN: Origin = Origin::Csms;
739    type Response = ClearCacheResponse;
740}
741
742impl Confirmed for ClearCacheRequest {}
743
744/// Spec: OCPP 2.0.1 · C — Authorization · CSMS → Charging Station · CALL.
745#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
746pub struct ClearCacheResponse {
747    /// The `status` member.
748    pub status: ClearCacheStatus,
749    /// The `statusInfo` member.
750    #[serde(rename = "statusInfo")]
751    #[serde(default, skip_serializing_if = "Option::is_none")]
752    pub status_info: Option<StatusInfo>,
753    /// The `customData` member.
754    #[serde(rename = "customData")]
755    #[serde(default, skip_serializing_if = "Option::is_none")]
756    pub custom_data: Option<crate::types::CustomData>,
757}
758
759impl ClearCacheResponse {
760    /// Creates a `ClearCacheResponse` from its required fields.
761    #[must_use]
762    pub fn new(status: ClearCacheStatus) -> Self {
763        Self {
764            status,
765            status_info: None,
766            custom_data: None,
767        }
768    }
769
770    /// Sets the optional `statusInfo` field.
771    #[must_use]
772    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
773        self.status_info = Some(value);
774        self
775    }
776
777    /// Sets the optional `customData` field.
778    #[must_use]
779    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
780        self.custom_data = Some(value);
781        self
782    }
783}
784
785impl Validate for ClearCacheResponse {
786    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
787        path.push_key("status");
788        Validate::validate_at(&self.status, path, out);
789        path.pop();
790        path.push_key("statusInfo");
791        if let Some(value) = &self.status_info {
792            Validate::validate_at(value, path, out);
793        }
794        path.pop();
795        path.push_key("customData");
796        if let Some(value) = &self.custom_data {
797            Validate::validate_at(value, path, out);
798        }
799        path.pop();
800    }
801}
802
803impl Sealed for ClearCacheResponse {}
804impl Response for ClearCacheResponse {}
805
806/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
807#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
808pub struct ClearChargingProfileRequest {
809    /// The Id of the charging profile to clear.
810    #[serde(rename = "chargingProfileId")]
811    #[serde(default, skip_serializing_if = "Option::is_none")]
812    pub charging_profile_id: Option<i32>,
813    /// The `chargingProfileCriteria` member.
814    #[serde(rename = "chargingProfileCriteria")]
815    #[serde(default, skip_serializing_if = "Option::is_none")]
816    pub charging_profile_criteria: Option<ClearChargingProfile>,
817    /// The `customData` member.
818    #[serde(rename = "customData")]
819    #[serde(default, skip_serializing_if = "Option::is_none")]
820    pub custom_data: Option<crate::types::CustomData>,
821}
822
823impl ClearChargingProfileRequest {
824    /// Creates an empty `ClearChargingProfileRequest`. Every field of this type is optional.
825    #[must_use]
826    pub fn new() -> Self {
827        Self::default()
828    }
829
830    /// Sets the optional `chargingProfileId` field.
831    #[must_use]
832    pub fn with_charging_profile_id(mut self, value: i32) -> Self {
833        self.charging_profile_id = Some(value);
834        self
835    }
836
837    /// Sets the optional `chargingProfileCriteria` field.
838    #[must_use]
839    pub fn with_charging_profile_criteria(mut self, value: ClearChargingProfile) -> Self {
840        self.charging_profile_criteria = Some(value);
841        self
842    }
843
844    /// Sets the optional `customData` field.
845    #[must_use]
846    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
847        self.custom_data = Some(value);
848        self
849    }
850}
851
852impl Validate for ClearChargingProfileRequest {
853    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
854        path.push_key("chargingProfileCriteria");
855        if let Some(value) = &self.charging_profile_criteria {
856            Validate::validate_at(value, path, out);
857        }
858        path.pop();
859        path.push_key("customData");
860        if let Some(value) = &self.custom_data {
861            Validate::validate_at(value, path, out);
862        }
863        path.pop();
864    }
865}
866
867impl Sealed for ClearChargingProfileRequest {}
868impl Request for ClearChargingProfileRequest {
869    type Action = Action;
870    const ACTION: Action = Action::ClearChargingProfile;
871    const KIND: MessageKind = MessageKind::Call;
872    const ORIGIN: Origin = Origin::Csms;
873    type Response = ClearChargingProfileResponse;
874}
875
876impl Confirmed for ClearChargingProfileRequest {}
877
878/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
879#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
880pub struct ClearChargingProfileResponse {
881    /// The `status` member.
882    pub status: ClearChargingProfileStatus,
883    /// The `statusInfo` member.
884    #[serde(rename = "statusInfo")]
885    #[serde(default, skip_serializing_if = "Option::is_none")]
886    pub status_info: Option<StatusInfo>,
887    /// The `customData` member.
888    #[serde(rename = "customData")]
889    #[serde(default, skip_serializing_if = "Option::is_none")]
890    pub custom_data: Option<crate::types::CustomData>,
891}
892
893impl ClearChargingProfileResponse {
894    /// Creates a `ClearChargingProfileResponse` from its required fields.
895    #[must_use]
896    pub fn new(status: ClearChargingProfileStatus) -> Self {
897        Self {
898            status,
899            status_info: None,
900            custom_data: None,
901        }
902    }
903
904    /// Sets the optional `statusInfo` field.
905    #[must_use]
906    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
907        self.status_info = Some(value);
908        self
909    }
910
911    /// Sets the optional `customData` field.
912    #[must_use]
913    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
914        self.custom_data = Some(value);
915        self
916    }
917}
918
919impl Validate for ClearChargingProfileResponse {
920    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
921        path.push_key("status");
922        Validate::validate_at(&self.status, path, out);
923        path.pop();
924        path.push_key("statusInfo");
925        if let Some(value) = &self.status_info {
926            Validate::validate_at(value, path, out);
927        }
928        path.pop();
929        path.push_key("customData");
930        if let Some(value) = &self.custom_data {
931            Validate::validate_at(value, path, out);
932        }
933        path.pop();
934    }
935}
936
937impl Sealed for ClearChargingProfileResponse {}
938impl Response for ClearChargingProfileResponse {}
939
940/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
941#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
942pub struct ClearDisplayMessageRequest {
943    /// Id of the message that SHALL be removed from the Charging Station.
944    pub id: i32,
945    /// The `customData` member.
946    #[serde(rename = "customData")]
947    #[serde(default, skip_serializing_if = "Option::is_none")]
948    pub custom_data: Option<crate::types::CustomData>,
949}
950
951impl ClearDisplayMessageRequest {
952    /// Creates a `ClearDisplayMessageRequest` from its required fields.
953    #[must_use]
954    pub fn new(id: i32) -> Self {
955        Self {
956            id,
957            custom_data: None,
958        }
959    }
960
961    /// Sets the optional `customData` field.
962    #[must_use]
963    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
964        self.custom_data = Some(value);
965        self
966    }
967}
968
969impl Validate for ClearDisplayMessageRequest {
970    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
971        path.push_key("customData");
972        if let Some(value) = &self.custom_data {
973            Validate::validate_at(value, path, out);
974        }
975        path.pop();
976    }
977}
978
979impl Sealed for ClearDisplayMessageRequest {}
980impl Request for ClearDisplayMessageRequest {
981    type Action = Action;
982    const ACTION: Action = Action::ClearDisplayMessage;
983    const KIND: MessageKind = MessageKind::Call;
984    const ORIGIN: Origin = Origin::Csms;
985    type Response = ClearDisplayMessageResponse;
986}
987
988impl Confirmed for ClearDisplayMessageRequest {}
989
990/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
991#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
992pub struct ClearDisplayMessageResponse {
993    /// The `status` member.
994    pub status: ClearMessageStatus,
995    /// The `statusInfo` member.
996    #[serde(rename = "statusInfo")]
997    #[serde(default, skip_serializing_if = "Option::is_none")]
998    pub status_info: Option<StatusInfo>,
999    /// The `customData` member.
1000    #[serde(rename = "customData")]
1001    #[serde(default, skip_serializing_if = "Option::is_none")]
1002    pub custom_data: Option<crate::types::CustomData>,
1003}
1004
1005impl ClearDisplayMessageResponse {
1006    /// Creates a `ClearDisplayMessageResponse` from its required fields.
1007    #[must_use]
1008    pub fn new(status: ClearMessageStatus) -> Self {
1009        Self {
1010            status,
1011            status_info: None,
1012            custom_data: None,
1013        }
1014    }
1015
1016    /// Sets the optional `statusInfo` field.
1017    #[must_use]
1018    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1019        self.status_info = Some(value);
1020        self
1021    }
1022
1023    /// Sets the optional `customData` field.
1024    #[must_use]
1025    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1026        self.custom_data = Some(value);
1027        self
1028    }
1029}
1030
1031impl Validate for ClearDisplayMessageResponse {
1032    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1033        path.push_key("status");
1034        Validate::validate_at(&self.status, path, out);
1035        path.pop();
1036        path.push_key("statusInfo");
1037        if let Some(value) = &self.status_info {
1038            Validate::validate_at(value, path, out);
1039        }
1040        path.pop();
1041        path.push_key("customData");
1042        if let Some(value) = &self.custom_data {
1043            Validate::validate_at(value, path, out);
1044        }
1045        path.pop();
1046    }
1047}
1048
1049impl Sealed for ClearDisplayMessageResponse {}
1050impl Response for ClearDisplayMessageResponse {}
1051
1052/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1053#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1054pub struct ClearVariableMonitoringRequest {
1055    /// List of the monitors to be cleared, identified by there Id.
1056    pub id: Vec<i32>,
1057    /// The `customData` member.
1058    #[serde(rename = "customData")]
1059    #[serde(default, skip_serializing_if = "Option::is_none")]
1060    pub custom_data: Option<crate::types::CustomData>,
1061}
1062
1063impl ClearVariableMonitoringRequest {
1064    /// Creates a `ClearVariableMonitoringRequest` from its required fields.
1065    #[must_use]
1066    pub fn new(id: Vec<i32>) -> Self {
1067        Self {
1068            id,
1069            custom_data: None,
1070        }
1071    }
1072
1073    /// Sets the optional `customData` field.
1074    #[must_use]
1075    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1076        self.custom_data = Some(value);
1077        self
1078    }
1079}
1080
1081impl Validate for ClearVariableMonitoringRequest {
1082    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1083        path.push_key("id");
1084        validate::list_len(self.id.len(), Some(1), None, path, out);
1085        path.pop();
1086        path.push_key("customData");
1087        if let Some(value) = &self.custom_data {
1088            Validate::validate_at(value, path, out);
1089        }
1090        path.pop();
1091    }
1092}
1093
1094impl Sealed for ClearVariableMonitoringRequest {}
1095impl Request for ClearVariableMonitoringRequest {
1096    type Action = Action;
1097    const ACTION: Action = Action::ClearVariableMonitoring;
1098    const KIND: MessageKind = MessageKind::Call;
1099    const ORIGIN: Origin = Origin::Csms;
1100    type Response = ClearVariableMonitoringResponse;
1101}
1102
1103impl Confirmed for ClearVariableMonitoringRequest {}
1104
1105/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1106#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1107pub struct ClearVariableMonitoringResponse {
1108    /// The `clearMonitoringResult` member.
1109    #[serde(rename = "clearMonitoringResult")]
1110    pub clear_monitoring_result: Vec<ClearMonitoringResult>,
1111    /// The `customData` member.
1112    #[serde(rename = "customData")]
1113    #[serde(default, skip_serializing_if = "Option::is_none")]
1114    pub custom_data: Option<crate::types::CustomData>,
1115}
1116
1117impl ClearVariableMonitoringResponse {
1118    /// Creates a `ClearVariableMonitoringResponse` from its required fields.
1119    #[must_use]
1120    pub fn new(clear_monitoring_result: Vec<ClearMonitoringResult>) -> Self {
1121        Self {
1122            clear_monitoring_result,
1123            custom_data: None,
1124        }
1125    }
1126
1127    /// Sets the optional `customData` field.
1128    #[must_use]
1129    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1130        self.custom_data = Some(value);
1131        self
1132    }
1133}
1134
1135impl Validate for ClearVariableMonitoringResponse {
1136    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1137        path.push_key("clearMonitoringResult");
1138        validate::list_len(self.clear_monitoring_result.len(), Some(1), None, path, out);
1139        for (index, item) in self.clear_monitoring_result.iter().enumerate() {
1140            path.push_index(index);
1141            Validate::validate_at(item, path, out);
1142            path.pop();
1143        }
1144        path.pop();
1145        path.push_key("customData");
1146        if let Some(value) = &self.custom_data {
1147            Validate::validate_at(value, path, out);
1148        }
1149        path.pop();
1150    }
1151}
1152
1153impl Sealed for ClearVariableMonitoringResponse {}
1154impl Response for ClearVariableMonitoringResponse {}
1155
1156/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
1157#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1158pub struct ClearedChargingLimitRequest {
1159    /// The `chargingLimitSource` member.
1160    #[serde(rename = "chargingLimitSource")]
1161    pub charging_limit_source: ChargingLimitSource,
1162    /// EVSE Identifier.
1163    #[serde(rename = "evseId")]
1164    #[serde(default, skip_serializing_if = "Option::is_none")]
1165    pub evse_id: Option<i32>,
1166    /// The `customData` member.
1167    #[serde(rename = "customData")]
1168    #[serde(default, skip_serializing_if = "Option::is_none")]
1169    pub custom_data: Option<crate::types::CustomData>,
1170}
1171
1172impl ClearedChargingLimitRequest {
1173    /// Creates a `ClearedChargingLimitRequest` from its required fields.
1174    #[must_use]
1175    pub fn new(charging_limit_source: ChargingLimitSource) -> Self {
1176        Self {
1177            charging_limit_source,
1178            evse_id: None,
1179            custom_data: None,
1180        }
1181    }
1182
1183    /// Sets the optional `evseId` field.
1184    #[must_use]
1185    pub fn with_evse_id(mut self, value: i32) -> Self {
1186        self.evse_id = Some(value);
1187        self
1188    }
1189
1190    /// Sets the optional `customData` field.
1191    #[must_use]
1192    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1193        self.custom_data = Some(value);
1194        self
1195    }
1196}
1197
1198impl Validate for ClearedChargingLimitRequest {
1199    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1200        path.push_key("chargingLimitSource");
1201        Validate::validate_at(&self.charging_limit_source, path, out);
1202        path.pop();
1203        path.push_key("customData");
1204        if let Some(value) = &self.custom_data {
1205            Validate::validate_at(value, path, out);
1206        }
1207        path.pop();
1208    }
1209}
1210
1211impl Sealed for ClearedChargingLimitRequest {}
1212impl Request for ClearedChargingLimitRequest {
1213    type Action = Action;
1214    const ACTION: Action = Action::ClearedChargingLimit;
1215    const KIND: MessageKind = MessageKind::Call;
1216    const ORIGIN: Origin = Origin::ChargingStation;
1217    type Response = ClearedChargingLimitResponse;
1218}
1219
1220impl Confirmed for ClearedChargingLimitRequest {}
1221
1222/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
1223#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1224pub struct ClearedChargingLimitResponse {
1225    /// The `customData` member.
1226    #[serde(rename = "customData")]
1227    #[serde(default, skip_serializing_if = "Option::is_none")]
1228    pub custom_data: Option<crate::types::CustomData>,
1229}
1230
1231impl ClearedChargingLimitResponse {
1232    /// Creates an empty `ClearedChargingLimitResponse`. Every field of this type is optional.
1233    #[must_use]
1234    pub fn new() -> Self {
1235        Self::default()
1236    }
1237
1238    /// Sets the optional `customData` field.
1239    #[must_use]
1240    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1241        self.custom_data = Some(value);
1242        self
1243    }
1244}
1245
1246impl Validate for ClearedChargingLimitResponse {
1247    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1248        path.push_key("customData");
1249        if let Some(value) = &self.custom_data {
1250            Validate::validate_at(value, path, out);
1251        }
1252        path.pop();
1253    }
1254}
1255
1256impl Sealed for ClearedChargingLimitResponse {}
1257impl Response for ClearedChargingLimitResponse {}
1258
1259/// Spec: OCPP 2.0.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1260#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1261pub struct CostUpdatedRequest {
1262    /// 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;\]
1263    #[serde(rename = "totalCost")]
1264    pub total_cost: crate::types::Decimal,
1265    /// Transaction Id of the transaction the current cost are asked for.
1266    #[serde(rename = "transactionId")]
1267    pub transaction_id: String,
1268    /// The `customData` member.
1269    #[serde(rename = "customData")]
1270    #[serde(default, skip_serializing_if = "Option::is_none")]
1271    pub custom_data: Option<crate::types::CustomData>,
1272}
1273
1274impl CostUpdatedRequest {
1275    /// Creates a `CostUpdatedRequest` from its required fields.
1276    #[must_use]
1277    pub fn new(
1278        total_cost: impl Into<crate::types::Decimal>,
1279        transaction_id: impl Into<String>,
1280    ) -> Self {
1281        Self {
1282            total_cost: total_cost.into(),
1283            transaction_id: transaction_id.into(),
1284            custom_data: None,
1285        }
1286    }
1287
1288    /// Sets the optional `customData` field.
1289    #[must_use]
1290    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1291        self.custom_data = Some(value);
1292        self
1293    }
1294}
1295
1296impl Validate for CostUpdatedRequest {
1297    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1298        path.push_key("transactionId");
1299        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
1300        path.pop();
1301        path.push_key("customData");
1302        if let Some(value) = &self.custom_data {
1303            Validate::validate_at(value, path, out);
1304        }
1305        path.pop();
1306    }
1307}
1308
1309impl Sealed for CostUpdatedRequest {}
1310impl Request for CostUpdatedRequest {
1311    type Action = Action;
1312    const ACTION: Action = Action::CostUpdated;
1313    const KIND: MessageKind = MessageKind::Call;
1314    const ORIGIN: Origin = Origin::Csms;
1315    type Response = CostUpdatedResponse;
1316}
1317
1318impl Confirmed for CostUpdatedRequest {}
1319
1320/// Spec: OCPP 2.0.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1321#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1322pub struct CostUpdatedResponse {
1323    /// The `customData` member.
1324    #[serde(rename = "customData")]
1325    #[serde(default, skip_serializing_if = "Option::is_none")]
1326    pub custom_data: Option<crate::types::CustomData>,
1327}
1328
1329impl CostUpdatedResponse {
1330    /// Creates an empty `CostUpdatedResponse`. Every field of this type is optional.
1331    #[must_use]
1332    pub fn new() -> Self {
1333        Self::default()
1334    }
1335
1336    /// Sets the optional `customData` field.
1337    #[must_use]
1338    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1339        self.custom_data = Some(value);
1340        self
1341    }
1342}
1343
1344impl Validate for CostUpdatedResponse {
1345    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1346        path.push_key("customData");
1347        if let Some(value) = &self.custom_data {
1348            Validate::validate_at(value, path, out);
1349        }
1350        path.pop();
1351    }
1352}
1353
1354impl Sealed for CostUpdatedResponse {}
1355impl Response for CostUpdatedResponse {}
1356
1357/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1358#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1359pub struct CustomerInformationRequest {
1360    /// The Id of the request.
1361    #[serde(rename = "requestId")]
1362    pub request_id: i32,
1363    /// Flag indicating whether the Charging Station should return NotifyCustomerInformationRequest messages containing information about the customer referred to.
1364    pub report: bool,
1365    /// Flag indicating whether the Charging Station should clear all information about the customer referred to.
1366    pub clear: bool,
1367    /// The `customerCertificate` member.
1368    #[serde(rename = "customerCertificate")]
1369    #[serde(default, skip_serializing_if = "Option::is_none")]
1370    pub customer_certificate: Option<CertificateHashData>,
1371    /// The `idToken` member.
1372    #[serde(rename = "idToken")]
1373    #[serde(default, skip_serializing_if = "Option::is_none")]
1374    pub id_token: Option<IdToken>,
1375    /// A (e.g. vendor specific) identifier of the customer this request refers to. This field contains a custom identifier other than IdToken and Certificate.
1376    /// One of the possible identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the request message.
1377    #[serde(rename = "customerIdentifier")]
1378    #[serde(default, skip_serializing_if = "Option::is_none")]
1379    pub customer_identifier: Option<String>,
1380    /// The `customData` member.
1381    #[serde(rename = "customData")]
1382    #[serde(default, skip_serializing_if = "Option::is_none")]
1383    pub custom_data: Option<crate::types::CustomData>,
1384}
1385
1386impl CustomerInformationRequest {
1387    /// Creates a `CustomerInformationRequest` from its required fields.
1388    #[must_use]
1389    pub fn new(request_id: i32, report: bool, clear: bool) -> Self {
1390        Self {
1391            request_id,
1392            report,
1393            clear,
1394            customer_certificate: None,
1395            id_token: None,
1396            customer_identifier: None,
1397            custom_data: None,
1398        }
1399    }
1400
1401    /// Sets the optional `customerCertificate` field.
1402    #[must_use]
1403    pub fn with_customer_certificate(mut self, value: CertificateHashData) -> Self {
1404        self.customer_certificate = Some(value);
1405        self
1406    }
1407
1408    /// Sets the optional `idToken` field.
1409    #[must_use]
1410    pub fn with_id_token(mut self, value: IdToken) -> Self {
1411        self.id_token = Some(value);
1412        self
1413    }
1414
1415    /// Sets the optional `customerIdentifier` field.
1416    #[must_use]
1417    pub fn with_customer_identifier(mut self, value: impl Into<String>) -> Self {
1418        self.customer_identifier = Some(value.into());
1419        self
1420    }
1421
1422    /// Sets the optional `customData` field.
1423    #[must_use]
1424    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1425        self.custom_data = Some(value);
1426        self
1427    }
1428}
1429
1430impl Validate for CustomerInformationRequest {
1431    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1432        path.push_key("customerCertificate");
1433        if let Some(value) = &self.customer_certificate {
1434            Validate::validate_at(value, path, out);
1435        }
1436        path.pop();
1437        path.push_key("idToken");
1438        if let Some(value) = &self.id_token {
1439            Validate::validate_at(value, path, out);
1440        }
1441        path.pop();
1442        path.push_key("customerIdentifier");
1443        if let Some(value) = &self.customer_identifier {
1444            validate::string(value.as_str(), None, Some(64), path, out);
1445        }
1446        path.pop();
1447        path.push_key("customData");
1448        if let Some(value) = &self.custom_data {
1449            Validate::validate_at(value, path, out);
1450        }
1451        path.pop();
1452    }
1453}
1454
1455impl Sealed for CustomerInformationRequest {}
1456impl Request for CustomerInformationRequest {
1457    type Action = Action;
1458    const ACTION: Action = Action::CustomerInformation;
1459    const KIND: MessageKind = MessageKind::Call;
1460    const ORIGIN: Origin = Origin::Csms;
1461    type Response = CustomerInformationResponse;
1462}
1463
1464impl Confirmed for CustomerInformationRequest {}
1465
1466/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1467#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1468pub struct CustomerInformationResponse {
1469    /// The `status` member.
1470    pub status: CustomerInformationStatus,
1471    /// The `statusInfo` member.
1472    #[serde(rename = "statusInfo")]
1473    #[serde(default, skip_serializing_if = "Option::is_none")]
1474    pub status_info: Option<StatusInfo>,
1475    /// The `customData` member.
1476    #[serde(rename = "customData")]
1477    #[serde(default, skip_serializing_if = "Option::is_none")]
1478    pub custom_data: Option<crate::types::CustomData>,
1479}
1480
1481impl CustomerInformationResponse {
1482    /// Creates a `CustomerInformationResponse` from its required fields.
1483    #[must_use]
1484    pub fn new(status: CustomerInformationStatus) -> Self {
1485        Self {
1486            status,
1487            status_info: None,
1488            custom_data: None,
1489        }
1490    }
1491
1492    /// Sets the optional `statusInfo` field.
1493    #[must_use]
1494    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1495        self.status_info = Some(value);
1496        self
1497    }
1498
1499    /// Sets the optional `customData` field.
1500    #[must_use]
1501    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1502        self.custom_data = Some(value);
1503        self
1504    }
1505}
1506
1507impl Validate for CustomerInformationResponse {
1508    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1509        path.push_key("status");
1510        Validate::validate_at(&self.status, path, out);
1511        path.pop();
1512        path.push_key("statusInfo");
1513        if let Some(value) = &self.status_info {
1514            Validate::validate_at(value, path, out);
1515        }
1516        path.pop();
1517        path.push_key("customData");
1518        if let Some(value) = &self.custom_data {
1519            Validate::validate_at(value, path, out);
1520        }
1521        path.pop();
1522    }
1523}
1524
1525impl Sealed for CustomerInformationResponse {}
1526impl Response for CustomerInformationResponse {}
1527
1528/// Spec: OCPP 2.0.1 · P — Data Transfer · either direction · CALL.
1529#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1530pub struct DataTransferRequest {
1531    /// This identifies the Vendor specific implementation
1532    #[serde(rename = "vendorId")]
1533    pub vendor_id: String,
1534    /// May be used to indicate a specific message or implementation.
1535    #[serde(rename = "messageId")]
1536    #[serde(default, skip_serializing_if = "Option::is_none")]
1537    pub message_id: Option<String>,
1538    /// Data without specified length or format. This needs to be decided by both parties (Open to implementation).
1539    #[serde(default, skip_serializing_if = "Option::is_none")]
1540    pub data: Option<serde_json::Value>,
1541    /// The `customData` member.
1542    #[serde(rename = "customData")]
1543    #[serde(default, skip_serializing_if = "Option::is_none")]
1544    pub custom_data: Option<crate::types::CustomData>,
1545}
1546
1547impl DataTransferRequest {
1548    /// Creates a `DataTransferRequest` from its required fields.
1549    #[must_use]
1550    pub fn new(vendor_id: impl Into<String>) -> Self {
1551        Self {
1552            vendor_id: vendor_id.into(),
1553            message_id: None,
1554            data: None,
1555            custom_data: None,
1556        }
1557    }
1558
1559    /// Sets the optional `messageId` field.
1560    #[must_use]
1561    pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
1562        self.message_id = Some(value.into());
1563        self
1564    }
1565
1566    /// Sets the optional `data` field.
1567    #[must_use]
1568    pub fn with_data(mut self, value: serde_json::Value) -> Self {
1569        self.data = Some(value);
1570        self
1571    }
1572
1573    /// Sets the optional `customData` field.
1574    #[must_use]
1575    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1576        self.custom_data = Some(value);
1577        self
1578    }
1579}
1580
1581impl Validate for DataTransferRequest {
1582    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1583        path.push_key("vendorId");
1584        validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
1585        path.pop();
1586        path.push_key("messageId");
1587        if let Some(value) = &self.message_id {
1588            validate::string(value.as_str(), None, Some(50), path, out);
1589        }
1590        path.pop();
1591        path.push_key("customData");
1592        if let Some(value) = &self.custom_data {
1593            Validate::validate_at(value, path, out);
1594        }
1595        path.pop();
1596    }
1597}
1598
1599impl Sealed for DataTransferRequest {}
1600impl Request for DataTransferRequest {
1601    type Action = Action;
1602    const ACTION: Action = Action::DataTransfer;
1603    const KIND: MessageKind = MessageKind::Call;
1604    const ORIGIN: Origin = Origin::Both;
1605    type Response = DataTransferResponse;
1606}
1607
1608impl Confirmed for DataTransferRequest {}
1609
1610/// Spec: OCPP 2.0.1 · P — Data Transfer · either direction · CALL.
1611#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1612pub struct DataTransferResponse {
1613    /// The `status` member.
1614    pub status: DataTransferStatus,
1615    /// The `statusInfo` member.
1616    #[serde(rename = "statusInfo")]
1617    #[serde(default, skip_serializing_if = "Option::is_none")]
1618    pub status_info: Option<StatusInfo>,
1619    /// Data without specified length or format, in response to request.
1620    #[serde(default, skip_serializing_if = "Option::is_none")]
1621    pub data: Option<serde_json::Value>,
1622    /// The `customData` member.
1623    #[serde(rename = "customData")]
1624    #[serde(default, skip_serializing_if = "Option::is_none")]
1625    pub custom_data: Option<crate::types::CustomData>,
1626}
1627
1628impl DataTransferResponse {
1629    /// Creates a `DataTransferResponse` from its required fields.
1630    #[must_use]
1631    pub fn new(status: DataTransferStatus) -> Self {
1632        Self {
1633            status,
1634            status_info: None,
1635            data: None,
1636            custom_data: None,
1637        }
1638    }
1639
1640    /// Sets the optional `statusInfo` field.
1641    #[must_use]
1642    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1643        self.status_info = Some(value);
1644        self
1645    }
1646
1647    /// Sets the optional `data` field.
1648    #[must_use]
1649    pub fn with_data(mut self, value: serde_json::Value) -> Self {
1650        self.data = Some(value);
1651        self
1652    }
1653
1654    /// Sets the optional `customData` field.
1655    #[must_use]
1656    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1657        self.custom_data = Some(value);
1658        self
1659    }
1660}
1661
1662impl Validate for DataTransferResponse {
1663    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1664        path.push_key("status");
1665        Validate::validate_at(&self.status, path, out);
1666        path.pop();
1667        path.push_key("statusInfo");
1668        if let Some(value) = &self.status_info {
1669            Validate::validate_at(value, path, out);
1670        }
1671        path.pop();
1672        path.push_key("customData");
1673        if let Some(value) = &self.custom_data {
1674            Validate::validate_at(value, path, out);
1675        }
1676        path.pop();
1677    }
1678}
1679
1680impl Sealed for DataTransferResponse {}
1681impl Response for DataTransferResponse {}
1682
1683/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
1684#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1685pub struct DeleteCertificateRequest {
1686    /// The `certificateHashData` member.
1687    #[serde(rename = "certificateHashData")]
1688    pub certificate_hash_data: CertificateHashData,
1689    /// The `customData` member.
1690    #[serde(rename = "customData")]
1691    #[serde(default, skip_serializing_if = "Option::is_none")]
1692    pub custom_data: Option<crate::types::CustomData>,
1693}
1694
1695impl DeleteCertificateRequest {
1696    /// Creates a `DeleteCertificateRequest` from its required fields.
1697    #[must_use]
1698    pub fn new(certificate_hash_data: CertificateHashData) -> Self {
1699        Self {
1700            certificate_hash_data,
1701            custom_data: None,
1702        }
1703    }
1704
1705    /// Sets the optional `customData` field.
1706    #[must_use]
1707    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1708        self.custom_data = Some(value);
1709        self
1710    }
1711}
1712
1713impl Validate for DeleteCertificateRequest {
1714    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1715        path.push_key("certificateHashData");
1716        Validate::validate_at(&self.certificate_hash_data, path, out);
1717        path.pop();
1718        path.push_key("customData");
1719        if let Some(value) = &self.custom_data {
1720            Validate::validate_at(value, path, out);
1721        }
1722        path.pop();
1723    }
1724}
1725
1726impl Sealed for DeleteCertificateRequest {}
1727impl Request for DeleteCertificateRequest {
1728    type Action = Action;
1729    const ACTION: Action = Action::DeleteCertificate;
1730    const KIND: MessageKind = MessageKind::Call;
1731    const ORIGIN: Origin = Origin::Csms;
1732    type Response = DeleteCertificateResponse;
1733}
1734
1735impl Confirmed for DeleteCertificateRequest {}
1736
1737/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
1738#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1739pub struct DeleteCertificateResponse {
1740    /// The `status` member.
1741    pub status: DeleteCertificateStatus,
1742    /// The `statusInfo` member.
1743    #[serde(rename = "statusInfo")]
1744    #[serde(default, skip_serializing_if = "Option::is_none")]
1745    pub status_info: Option<StatusInfo>,
1746    /// The `customData` member.
1747    #[serde(rename = "customData")]
1748    #[serde(default, skip_serializing_if = "Option::is_none")]
1749    pub custom_data: Option<crate::types::CustomData>,
1750}
1751
1752impl DeleteCertificateResponse {
1753    /// Creates a `DeleteCertificateResponse` from its required fields.
1754    #[must_use]
1755    pub fn new(status: DeleteCertificateStatus) -> Self {
1756        Self {
1757            status,
1758            status_info: None,
1759            custom_data: None,
1760        }
1761    }
1762
1763    /// Sets the optional `statusInfo` field.
1764    #[must_use]
1765    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1766        self.status_info = Some(value);
1767        self
1768    }
1769
1770    /// Sets the optional `customData` field.
1771    #[must_use]
1772    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1773        self.custom_data = Some(value);
1774        self
1775    }
1776}
1777
1778impl Validate for DeleteCertificateResponse {
1779    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1780        path.push_key("status");
1781        Validate::validate_at(&self.status, path, out);
1782        path.pop();
1783        path.push_key("statusInfo");
1784        if let Some(value) = &self.status_info {
1785            Validate::validate_at(value, path, out);
1786        }
1787        path.pop();
1788        path.push_key("customData");
1789        if let Some(value) = &self.custom_data {
1790            Validate::validate_at(value, path, out);
1791        }
1792        path.pop();
1793    }
1794}
1795
1796impl Sealed for DeleteCertificateResponse {}
1797impl Response for DeleteCertificateResponse {}
1798
1799/// Spec: OCPP 2.0.1 · L — Firmware Management · Charging Station → CSMS · CALL.
1800#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1801pub struct FirmwareStatusNotificationRequest {
1802    /// The `status` member.
1803    pub status: FirmwareStatus,
1804    /// The request id that was provided in the
1805    /// UpdateFirmwareRequest that started this firmware update.
1806    /// This field is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no firmware update ongoing.
1807    #[serde(rename = "requestId")]
1808    #[serde(default, skip_serializing_if = "Option::is_none")]
1809    pub request_id: Option<i32>,
1810    /// The `customData` member.
1811    #[serde(rename = "customData")]
1812    #[serde(default, skip_serializing_if = "Option::is_none")]
1813    pub custom_data: Option<crate::types::CustomData>,
1814}
1815
1816impl FirmwareStatusNotificationRequest {
1817    /// Creates a `FirmwareStatusNotificationRequest` from its required fields.
1818    #[must_use]
1819    pub fn new(status: FirmwareStatus) -> Self {
1820        Self {
1821            status,
1822            request_id: None,
1823            custom_data: None,
1824        }
1825    }
1826
1827    /// Sets the optional `requestId` field.
1828    #[must_use]
1829    pub fn with_request_id(mut self, value: i32) -> Self {
1830        self.request_id = Some(value);
1831        self
1832    }
1833
1834    /// Sets the optional `customData` field.
1835    #[must_use]
1836    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1837        self.custom_data = Some(value);
1838        self
1839    }
1840}
1841
1842impl Validate for FirmwareStatusNotificationRequest {
1843    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1844        path.push_key("status");
1845        Validate::validate_at(&self.status, path, out);
1846        path.pop();
1847        path.push_key("customData");
1848        if let Some(value) = &self.custom_data {
1849            Validate::validate_at(value, path, out);
1850        }
1851        path.pop();
1852    }
1853}
1854
1855impl Sealed for FirmwareStatusNotificationRequest {}
1856impl Request for FirmwareStatusNotificationRequest {
1857    type Action = Action;
1858    const ACTION: Action = Action::FirmwareStatusNotification;
1859    const KIND: MessageKind = MessageKind::Call;
1860    const ORIGIN: Origin = Origin::ChargingStation;
1861    type Response = FirmwareStatusNotificationResponse;
1862}
1863
1864impl Confirmed for FirmwareStatusNotificationRequest {}
1865
1866/// Spec: OCPP 2.0.1 · L — Firmware Management · Charging Station → CSMS · CALL.
1867#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1868pub struct FirmwareStatusNotificationResponse {
1869    /// The `customData` member.
1870    #[serde(rename = "customData")]
1871    #[serde(default, skip_serializing_if = "Option::is_none")]
1872    pub custom_data: Option<crate::types::CustomData>,
1873}
1874
1875impl FirmwareStatusNotificationResponse {
1876    /// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
1877    #[must_use]
1878    pub fn new() -> Self {
1879        Self::default()
1880    }
1881
1882    /// Sets the optional `customData` field.
1883    #[must_use]
1884    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1885        self.custom_data = Some(value);
1886        self
1887    }
1888}
1889
1890impl Validate for FirmwareStatusNotificationResponse {
1891    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1892        path.push_key("customData");
1893        if let Some(value) = &self.custom_data {
1894            Validate::validate_at(value, path, out);
1895        }
1896        path.pop();
1897    }
1898}
1899
1900impl Sealed for FirmwareStatusNotificationResponse {}
1901impl Response for FirmwareStatusNotificationResponse {}
1902
1903/// Spec: OCPP 2.0.1 · M — Certificate Management · Charging Station → CSMS · CALL.
1904#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1905pub struct Get15118EVCertificateRequest {
1906    /// Schema version currently used for the 15118 session between EV and Charging Station. Needed for parsing of the EXI stream by the CSMS.
1907    #[serde(rename = "iso15118SchemaVersion")]
1908    pub iso15118_schema_version: String,
1909    /// The `action` member.
1910    pub action: CertificateAction,
1911    /// Raw CertificateInstallationReq request from EV, Base64 encoded.
1912    #[serde(rename = "exiRequest")]
1913    pub exi_request: String,
1914    /// The `customData` member.
1915    #[serde(rename = "customData")]
1916    #[serde(default, skip_serializing_if = "Option::is_none")]
1917    pub custom_data: Option<crate::types::CustomData>,
1918}
1919
1920impl Get15118EVCertificateRequest {
1921    /// Creates a `Get15118EVCertificateRequest` from its required fields.
1922    #[must_use]
1923    pub fn new(
1924        iso15118_schema_version: impl Into<String>,
1925        action: CertificateAction,
1926        exi_request: impl Into<String>,
1927    ) -> Self {
1928        Self {
1929            iso15118_schema_version: iso15118_schema_version.into(),
1930            action,
1931            exi_request: exi_request.into(),
1932            custom_data: None,
1933        }
1934    }
1935
1936    /// Sets the optional `customData` field.
1937    #[must_use]
1938    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1939        self.custom_data = Some(value);
1940        self
1941    }
1942}
1943
1944impl Validate for Get15118EVCertificateRequest {
1945    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1946        path.push_key("iso15118SchemaVersion");
1947        validate::string(
1948            self.iso15118_schema_version.as_str(),
1949            None,
1950            Some(50),
1951            path,
1952            out,
1953        );
1954        path.pop();
1955        path.push_key("action");
1956        Validate::validate_at(&self.action, path, out);
1957        path.pop();
1958        path.push_key("exiRequest");
1959        validate::string(self.exi_request.as_str(), None, Some(5600), path, out);
1960        path.pop();
1961        path.push_key("customData");
1962        if let Some(value) = &self.custom_data {
1963            Validate::validate_at(value, path, out);
1964        }
1965        path.pop();
1966    }
1967}
1968
1969impl Sealed for Get15118EVCertificateRequest {}
1970impl Request for Get15118EVCertificateRequest {
1971    type Action = Action;
1972    const ACTION: Action = Action::Get15118EVCertificate;
1973    const KIND: MessageKind = MessageKind::Call;
1974    const ORIGIN: Origin = Origin::ChargingStation;
1975    type Response = Get15118EVCertificateResponse;
1976}
1977
1978impl Confirmed for Get15118EVCertificateRequest {}
1979
1980/// Spec: OCPP 2.0.1 · M — Certificate Management · Charging Station → CSMS · CALL.
1981#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1982pub struct Get15118EVCertificateResponse {
1983    /// The `status` member.
1984    pub status: Iso15118EVCertificateStatus,
1985    /// Raw CertificateInstallationRes response for the EV, Base64 encoded.
1986    #[serde(rename = "exiResponse")]
1987    pub exi_response: String,
1988    /// The `statusInfo` member.
1989    #[serde(rename = "statusInfo")]
1990    #[serde(default, skip_serializing_if = "Option::is_none")]
1991    pub status_info: Option<StatusInfo>,
1992    /// The `customData` member.
1993    #[serde(rename = "customData")]
1994    #[serde(default, skip_serializing_if = "Option::is_none")]
1995    pub custom_data: Option<crate::types::CustomData>,
1996}
1997
1998impl Get15118EVCertificateResponse {
1999    /// Creates a `Get15118EVCertificateResponse` from its required fields.
2000    #[must_use]
2001    pub fn new(status: Iso15118EVCertificateStatus, exi_response: impl Into<String>) -> Self {
2002        Self {
2003            status,
2004            exi_response: exi_response.into(),
2005            status_info: None,
2006            custom_data: None,
2007        }
2008    }
2009
2010    /// Sets the optional `statusInfo` field.
2011    #[must_use]
2012    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2013        self.status_info = Some(value);
2014        self
2015    }
2016
2017    /// Sets the optional `customData` field.
2018    #[must_use]
2019    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2020        self.custom_data = Some(value);
2021        self
2022    }
2023}
2024
2025impl Validate for Get15118EVCertificateResponse {
2026    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2027        path.push_key("status");
2028        Validate::validate_at(&self.status, path, out);
2029        path.pop();
2030        path.push_key("exiResponse");
2031        validate::string(self.exi_response.as_str(), None, Some(7500), path, out);
2032        path.pop();
2033        path.push_key("statusInfo");
2034        if let Some(value) = &self.status_info {
2035            Validate::validate_at(value, path, out);
2036        }
2037        path.pop();
2038        path.push_key("customData");
2039        if let Some(value) = &self.custom_data {
2040            Validate::validate_at(value, path, out);
2041        }
2042        path.pop();
2043    }
2044}
2045
2046impl Sealed for Get15118EVCertificateResponse {}
2047impl Response for Get15118EVCertificateResponse {}
2048
2049/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
2050#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2051pub struct GetBaseReportRequest {
2052    /// The Id of the request.
2053    #[serde(rename = "requestId")]
2054    pub request_id: i32,
2055    /// The `reportBase` member.
2056    #[serde(rename = "reportBase")]
2057    pub report_base: ReportBase,
2058    /// The `customData` member.
2059    #[serde(rename = "customData")]
2060    #[serde(default, skip_serializing_if = "Option::is_none")]
2061    pub custom_data: Option<crate::types::CustomData>,
2062}
2063
2064impl GetBaseReportRequest {
2065    /// Creates a `GetBaseReportRequest` from its required fields.
2066    #[must_use]
2067    pub fn new(request_id: i32, report_base: ReportBase) -> Self {
2068        Self {
2069            request_id,
2070            report_base,
2071            custom_data: None,
2072        }
2073    }
2074
2075    /// Sets the optional `customData` field.
2076    #[must_use]
2077    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2078        self.custom_data = Some(value);
2079        self
2080    }
2081}
2082
2083impl Validate for GetBaseReportRequest {
2084    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2085        path.push_key("reportBase");
2086        Validate::validate_at(&self.report_base, path, out);
2087        path.pop();
2088        path.push_key("customData");
2089        if let Some(value) = &self.custom_data {
2090            Validate::validate_at(value, path, out);
2091        }
2092        path.pop();
2093    }
2094}
2095
2096impl Sealed for GetBaseReportRequest {}
2097impl Request for GetBaseReportRequest {
2098    type Action = Action;
2099    const ACTION: Action = Action::GetBaseReport;
2100    const KIND: MessageKind = MessageKind::Call;
2101    const ORIGIN: Origin = Origin::Csms;
2102    type Response = GetBaseReportResponse;
2103}
2104
2105impl Confirmed for GetBaseReportRequest {}
2106
2107/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
2108#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2109pub struct GetBaseReportResponse {
2110    /// The `status` member.
2111    pub status: GenericDeviceModelStatus,
2112    /// The `statusInfo` member.
2113    #[serde(rename = "statusInfo")]
2114    #[serde(default, skip_serializing_if = "Option::is_none")]
2115    pub status_info: Option<StatusInfo>,
2116    /// The `customData` member.
2117    #[serde(rename = "customData")]
2118    #[serde(default, skip_serializing_if = "Option::is_none")]
2119    pub custom_data: Option<crate::types::CustomData>,
2120}
2121
2122impl GetBaseReportResponse {
2123    /// Creates a `GetBaseReportResponse` from its required fields.
2124    #[must_use]
2125    pub fn new(status: GenericDeviceModelStatus) -> Self {
2126        Self {
2127            status,
2128            status_info: None,
2129            custom_data: None,
2130        }
2131    }
2132
2133    /// Sets the optional `statusInfo` field.
2134    #[must_use]
2135    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2136        self.status_info = Some(value);
2137        self
2138    }
2139
2140    /// Sets the optional `customData` field.
2141    #[must_use]
2142    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2143        self.custom_data = Some(value);
2144        self
2145    }
2146}
2147
2148impl Validate for GetBaseReportResponse {
2149    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2150        path.push_key("status");
2151        Validate::validate_at(&self.status, path, out);
2152        path.pop();
2153        path.push_key("statusInfo");
2154        if let Some(value) = &self.status_info {
2155            Validate::validate_at(value, path, out);
2156        }
2157        path.pop();
2158        path.push_key("customData");
2159        if let Some(value) = &self.custom_data {
2160            Validate::validate_at(value, path, out);
2161        }
2162        path.pop();
2163    }
2164}
2165
2166impl Sealed for GetBaseReportResponse {}
2167impl Response for GetBaseReportResponse {}
2168
2169/// Spec: OCPP 2.0.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2170#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2171pub struct GetCertificateStatusRequest {
2172    /// The `ocspRequestData` member.
2173    #[serde(rename = "ocspRequestData")]
2174    pub ocsp_request_data: OCSPRequestData,
2175    /// The `customData` member.
2176    #[serde(rename = "customData")]
2177    #[serde(default, skip_serializing_if = "Option::is_none")]
2178    pub custom_data: Option<crate::types::CustomData>,
2179}
2180
2181impl GetCertificateStatusRequest {
2182    /// Creates a `GetCertificateStatusRequest` from its required fields.
2183    #[must_use]
2184    pub fn new(ocsp_request_data: OCSPRequestData) -> Self {
2185        Self {
2186            ocsp_request_data,
2187            custom_data: None,
2188        }
2189    }
2190
2191    /// Sets the optional `customData` field.
2192    #[must_use]
2193    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2194        self.custom_data = Some(value);
2195        self
2196    }
2197}
2198
2199impl Validate for GetCertificateStatusRequest {
2200    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2201        path.push_key("ocspRequestData");
2202        Validate::validate_at(&self.ocsp_request_data, path, out);
2203        path.pop();
2204        path.push_key("customData");
2205        if let Some(value) = &self.custom_data {
2206            Validate::validate_at(value, path, out);
2207        }
2208        path.pop();
2209    }
2210}
2211
2212impl Sealed for GetCertificateStatusRequest {}
2213impl Request for GetCertificateStatusRequest {
2214    type Action = Action;
2215    const ACTION: Action = Action::GetCertificateStatus;
2216    const KIND: MessageKind = MessageKind::Call;
2217    const ORIGIN: Origin = Origin::ChargingStation;
2218    type Response = GetCertificateStatusResponse;
2219}
2220
2221impl Confirmed for GetCertificateStatusRequest {}
2222
2223/// Spec: OCPP 2.0.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2224#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2225pub struct GetCertificateStatusResponse {
2226    /// The `status` member.
2227    pub status: GetCertificateStatusEnum,
2228    /// The `statusInfo` member.
2229    #[serde(rename = "statusInfo")]
2230    #[serde(default, skip_serializing_if = "Option::is_none")]
2231    pub status_info: Option<StatusInfo>,
2232    /// 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.
2233    #[serde(rename = "ocspResult")]
2234    #[serde(default, skip_serializing_if = "Option::is_none")]
2235    pub ocsp_result: Option<String>,
2236    /// The `customData` member.
2237    #[serde(rename = "customData")]
2238    #[serde(default, skip_serializing_if = "Option::is_none")]
2239    pub custom_data: Option<crate::types::CustomData>,
2240}
2241
2242impl GetCertificateStatusResponse {
2243    /// Creates a `GetCertificateStatusResponse` from its required fields.
2244    #[must_use]
2245    pub fn new(status: GetCertificateStatusEnum) -> Self {
2246        Self {
2247            status,
2248            status_info: None,
2249            ocsp_result: None,
2250            custom_data: None,
2251        }
2252    }
2253
2254    /// Sets the optional `statusInfo` field.
2255    #[must_use]
2256    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2257        self.status_info = Some(value);
2258        self
2259    }
2260
2261    /// Sets the optional `ocspResult` field.
2262    #[must_use]
2263    pub fn with_ocsp_result(mut self, value: impl Into<String>) -> Self {
2264        self.ocsp_result = Some(value.into());
2265        self
2266    }
2267
2268    /// Sets the optional `customData` field.
2269    #[must_use]
2270    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2271        self.custom_data = Some(value);
2272        self
2273    }
2274}
2275
2276impl Validate for GetCertificateStatusResponse {
2277    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2278        path.push_key("status");
2279        Validate::validate_at(&self.status, path, out);
2280        path.pop();
2281        path.push_key("statusInfo");
2282        if let Some(value) = &self.status_info {
2283            Validate::validate_at(value, path, out);
2284        }
2285        path.pop();
2286        path.push_key("ocspResult");
2287        if let Some(value) = &self.ocsp_result {
2288            validate::string(value.as_str(), None, Some(5500), path, out);
2289        }
2290        path.pop();
2291        path.push_key("customData");
2292        if let Some(value) = &self.custom_data {
2293            Validate::validate_at(value, path, out);
2294        }
2295        path.pop();
2296    }
2297}
2298
2299impl Sealed for GetCertificateStatusResponse {}
2300impl Response for GetCertificateStatusResponse {}
2301
2302/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
2303#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2304pub struct GetChargingProfilesRequest {
2305    /// Reference identification that is to be used by the Charging Station in the &lt;&lt;reportchargingprofilesrequest, ReportChargingProfilesRequest&gt;&gt; when provided.
2306    #[serde(rename = "requestId")]
2307    pub request_id: i32,
2308    /// The `chargingProfile` member.
2309    #[serde(rename = "chargingProfile")]
2310    pub charging_profile: ChargingProfileCriterion,
2311    /// 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.
2312    #[serde(rename = "evseId")]
2313    #[serde(default, skip_serializing_if = "Option::is_none")]
2314    pub evse_id: Option<i32>,
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 GetChargingProfilesRequest {
2322    /// Creates a `GetChargingProfilesRequest` from its required fields.
2323    #[must_use]
2324    pub fn new(request_id: i32, charging_profile: ChargingProfileCriterion) -> Self {
2325        Self {
2326            request_id,
2327            charging_profile,
2328            evse_id: None,
2329            custom_data: None,
2330        }
2331    }
2332
2333    /// Sets the optional `evseId` field.
2334    #[must_use]
2335    pub fn with_evse_id(mut self, value: i32) -> Self {
2336        self.evse_id = Some(value);
2337        self
2338    }
2339
2340    /// Sets the optional `customData` field.
2341    #[must_use]
2342    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2343        self.custom_data = Some(value);
2344        self
2345    }
2346}
2347
2348impl Validate for GetChargingProfilesRequest {
2349    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2350        path.push_key("chargingProfile");
2351        Validate::validate_at(&self.charging_profile, path, out);
2352        path.pop();
2353        path.push_key("customData");
2354        if let Some(value) = &self.custom_data {
2355            Validate::validate_at(value, path, out);
2356        }
2357        path.pop();
2358    }
2359}
2360
2361impl Sealed for GetChargingProfilesRequest {}
2362impl Request for GetChargingProfilesRequest {
2363    type Action = Action;
2364    const ACTION: Action = Action::GetChargingProfiles;
2365    const KIND: MessageKind = MessageKind::Call;
2366    const ORIGIN: Origin = Origin::Csms;
2367    type Response = GetChargingProfilesResponse;
2368}
2369
2370impl Confirmed for GetChargingProfilesRequest {}
2371
2372/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
2373#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2374pub struct GetChargingProfilesResponse {
2375    /// The `status` member.
2376    pub status: GetChargingProfileStatus,
2377    /// The `statusInfo` member.
2378    #[serde(rename = "statusInfo")]
2379    #[serde(default, skip_serializing_if = "Option::is_none")]
2380    pub status_info: Option<StatusInfo>,
2381    /// The `customData` member.
2382    #[serde(rename = "customData")]
2383    #[serde(default, skip_serializing_if = "Option::is_none")]
2384    pub custom_data: Option<crate::types::CustomData>,
2385}
2386
2387impl GetChargingProfilesResponse {
2388    /// Creates a `GetChargingProfilesResponse` from its required fields.
2389    #[must_use]
2390    pub fn new(status: GetChargingProfileStatus) -> Self {
2391        Self {
2392            status,
2393            status_info: None,
2394            custom_data: None,
2395        }
2396    }
2397
2398    /// Sets the optional `statusInfo` field.
2399    #[must_use]
2400    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2401        self.status_info = Some(value);
2402        self
2403    }
2404
2405    /// Sets the optional `customData` field.
2406    #[must_use]
2407    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2408        self.custom_data = Some(value);
2409        self
2410    }
2411}
2412
2413impl Validate for GetChargingProfilesResponse {
2414    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2415        path.push_key("status");
2416        Validate::validate_at(&self.status, path, out);
2417        path.pop();
2418        path.push_key("statusInfo");
2419        if let Some(value) = &self.status_info {
2420            Validate::validate_at(value, path, out);
2421        }
2422        path.pop();
2423        path.push_key("customData");
2424        if let Some(value) = &self.custom_data {
2425            Validate::validate_at(value, path, out);
2426        }
2427        path.pop();
2428    }
2429}
2430
2431impl Sealed for GetChargingProfilesResponse {}
2432impl Response for GetChargingProfilesResponse {}
2433
2434/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
2435#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2436pub struct GetCompositeScheduleRequest {
2437    /// Length of the requested schedule in seconds.
2438    pub duration: i32,
2439    /// 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.
2440    #[serde(rename = "evseId")]
2441    pub evse_id: i32,
2442    /// The `chargingRateUnit` member.
2443    #[serde(rename = "chargingRateUnit")]
2444    #[serde(default, skip_serializing_if = "Option::is_none")]
2445    pub charging_rate_unit: Option<ChargingRateUnit>,
2446    /// The `customData` member.
2447    #[serde(rename = "customData")]
2448    #[serde(default, skip_serializing_if = "Option::is_none")]
2449    pub custom_data: Option<crate::types::CustomData>,
2450}
2451
2452impl GetCompositeScheduleRequest {
2453    /// Creates a `GetCompositeScheduleRequest` from its required fields.
2454    #[must_use]
2455    pub fn new(duration: i32, evse_id: i32) -> Self {
2456        Self {
2457            duration,
2458            evse_id,
2459            charging_rate_unit: None,
2460            custom_data: None,
2461        }
2462    }
2463
2464    /// Sets the optional `chargingRateUnit` field.
2465    #[must_use]
2466    pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
2467        self.charging_rate_unit = Some(value);
2468        self
2469    }
2470
2471    /// Sets the optional `customData` field.
2472    #[must_use]
2473    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2474        self.custom_data = Some(value);
2475        self
2476    }
2477}
2478
2479impl Validate for GetCompositeScheduleRequest {
2480    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2481        path.push_key("chargingRateUnit");
2482        if let Some(value) = &self.charging_rate_unit {
2483            Validate::validate_at(value, path, out);
2484        }
2485        path.pop();
2486        path.push_key("customData");
2487        if let Some(value) = &self.custom_data {
2488            Validate::validate_at(value, path, out);
2489        }
2490        path.pop();
2491    }
2492}
2493
2494impl Sealed for GetCompositeScheduleRequest {}
2495impl Request for GetCompositeScheduleRequest {
2496    type Action = Action;
2497    const ACTION: Action = Action::GetCompositeSchedule;
2498    const KIND: MessageKind = MessageKind::Call;
2499    const ORIGIN: Origin = Origin::Csms;
2500    type Response = GetCompositeScheduleResponse;
2501}
2502
2503impl Confirmed for GetCompositeScheduleRequest {}
2504
2505/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
2506#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2507pub struct GetCompositeScheduleResponse {
2508    /// The `status` member.
2509    pub status: GenericStatus,
2510    /// The `statusInfo` member.
2511    #[serde(rename = "statusInfo")]
2512    #[serde(default, skip_serializing_if = "Option::is_none")]
2513    pub status_info: Option<StatusInfo>,
2514    /// The `schedule` member.
2515    #[serde(default, skip_serializing_if = "Option::is_none")]
2516    pub schedule: Option<CompositeSchedule>,
2517    /// The `customData` member.
2518    #[serde(rename = "customData")]
2519    #[serde(default, skip_serializing_if = "Option::is_none")]
2520    pub custom_data: Option<crate::types::CustomData>,
2521}
2522
2523impl GetCompositeScheduleResponse {
2524    /// Creates a `GetCompositeScheduleResponse` from its required fields.
2525    #[must_use]
2526    pub fn new(status: GenericStatus) -> Self {
2527        Self {
2528            status,
2529            status_info: None,
2530            schedule: None,
2531            custom_data: None,
2532        }
2533    }
2534
2535    /// Sets the optional `statusInfo` field.
2536    #[must_use]
2537    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2538        self.status_info = Some(value);
2539        self
2540    }
2541
2542    /// Sets the optional `schedule` field.
2543    #[must_use]
2544    pub fn with_schedule(mut self, value: CompositeSchedule) -> Self {
2545        self.schedule = Some(value);
2546        self
2547    }
2548
2549    /// Sets the optional `customData` field.
2550    #[must_use]
2551    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2552        self.custom_data = Some(value);
2553        self
2554    }
2555}
2556
2557impl Validate for GetCompositeScheduleResponse {
2558    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2559        path.push_key("status");
2560        Validate::validate_at(&self.status, path, out);
2561        path.pop();
2562        path.push_key("statusInfo");
2563        if let Some(value) = &self.status_info {
2564            Validate::validate_at(value, path, out);
2565        }
2566        path.pop();
2567        path.push_key("schedule");
2568        if let Some(value) = &self.schedule {
2569            Validate::validate_at(value, path, out);
2570        }
2571        path.pop();
2572        path.push_key("customData");
2573        if let Some(value) = &self.custom_data {
2574            Validate::validate_at(value, path, out);
2575        }
2576        path.pop();
2577    }
2578}
2579
2580impl Sealed for GetCompositeScheduleResponse {}
2581impl Response for GetCompositeScheduleResponse {}
2582
2583/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
2584#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2585pub struct GetDisplayMessagesRequest {
2586    /// The Id of this request.
2587    #[serde(rename = "requestId")]
2588    pub request_id: i32,
2589    /// 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;
2590    #[serde(default, skip_serializing_if = "Option::is_none")]
2591    pub id: Option<Vec<i32>>,
2592    /// The `priority` member.
2593    #[serde(default, skip_serializing_if = "Option::is_none")]
2594    pub priority: Option<MessagePriority>,
2595    /// The `state` member.
2596    #[serde(default, skip_serializing_if = "Option::is_none")]
2597    pub state: Option<MessageState>,
2598    /// The `customData` member.
2599    #[serde(rename = "customData")]
2600    #[serde(default, skip_serializing_if = "Option::is_none")]
2601    pub custom_data: Option<crate::types::CustomData>,
2602}
2603
2604impl GetDisplayMessagesRequest {
2605    /// Creates a `GetDisplayMessagesRequest` from its required fields.
2606    #[must_use]
2607    pub fn new(request_id: i32) -> Self {
2608        Self {
2609            request_id,
2610            id: None,
2611            priority: None,
2612            state: None,
2613            custom_data: None,
2614        }
2615    }
2616
2617    /// Sets the optional `id` field.
2618    #[must_use]
2619    pub fn with_id(mut self, value: Vec<i32>) -> Self {
2620        self.id = Some(value);
2621        self
2622    }
2623
2624    /// Sets the optional `priority` field.
2625    #[must_use]
2626    pub fn with_priority(mut self, value: MessagePriority) -> Self {
2627        self.priority = Some(value);
2628        self
2629    }
2630
2631    /// Sets the optional `state` field.
2632    #[must_use]
2633    pub fn with_state(mut self, value: MessageState) -> Self {
2634        self.state = Some(value);
2635        self
2636    }
2637
2638    /// Sets the optional `customData` field.
2639    #[must_use]
2640    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2641        self.custom_data = Some(value);
2642        self
2643    }
2644}
2645
2646impl Validate for GetDisplayMessagesRequest {
2647    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2648        path.push_key("id");
2649        if let Some(value) = &self.id {
2650            validate::list_len(value.len(), Some(1), None, path, out);
2651        }
2652        path.pop();
2653        path.push_key("priority");
2654        if let Some(value) = &self.priority {
2655            Validate::validate_at(value, path, out);
2656        }
2657        path.pop();
2658        path.push_key("state");
2659        if let Some(value) = &self.state {
2660            Validate::validate_at(value, path, out);
2661        }
2662        path.pop();
2663        path.push_key("customData");
2664        if let Some(value) = &self.custom_data {
2665            Validate::validate_at(value, path, out);
2666        }
2667        path.pop();
2668    }
2669}
2670
2671impl Sealed for GetDisplayMessagesRequest {}
2672impl Request for GetDisplayMessagesRequest {
2673    type Action = Action;
2674    const ACTION: Action = Action::GetDisplayMessages;
2675    const KIND: MessageKind = MessageKind::Call;
2676    const ORIGIN: Origin = Origin::Csms;
2677    type Response = GetDisplayMessagesResponse;
2678}
2679
2680impl Confirmed for GetDisplayMessagesRequest {}
2681
2682/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
2683#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2684pub struct GetDisplayMessagesResponse {
2685    /// The `status` member.
2686    pub status: GetDisplayMessagesStatus,
2687    /// The `statusInfo` member.
2688    #[serde(rename = "statusInfo")]
2689    #[serde(default, skip_serializing_if = "Option::is_none")]
2690    pub status_info: Option<StatusInfo>,
2691    /// The `customData` member.
2692    #[serde(rename = "customData")]
2693    #[serde(default, skip_serializing_if = "Option::is_none")]
2694    pub custom_data: Option<crate::types::CustomData>,
2695}
2696
2697impl GetDisplayMessagesResponse {
2698    /// Creates a `GetDisplayMessagesResponse` from its required fields.
2699    #[must_use]
2700    pub fn new(status: GetDisplayMessagesStatus) -> Self {
2701        Self {
2702            status,
2703            status_info: None,
2704            custom_data: None,
2705        }
2706    }
2707
2708    /// Sets the optional `statusInfo` field.
2709    #[must_use]
2710    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2711        self.status_info = Some(value);
2712        self
2713    }
2714
2715    /// Sets the optional `customData` field.
2716    #[must_use]
2717    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2718        self.custom_data = Some(value);
2719        self
2720    }
2721}
2722
2723impl Validate for GetDisplayMessagesResponse {
2724    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2725        path.push_key("status");
2726        Validate::validate_at(&self.status, path, out);
2727        path.pop();
2728        path.push_key("statusInfo");
2729        if let Some(value) = &self.status_info {
2730            Validate::validate_at(value, path, out);
2731        }
2732        path.pop();
2733        path.push_key("customData");
2734        if let Some(value) = &self.custom_data {
2735            Validate::validate_at(value, path, out);
2736        }
2737        path.pop();
2738    }
2739}
2740
2741impl Sealed for GetDisplayMessagesResponse {}
2742impl Response for GetDisplayMessagesResponse {}
2743
2744/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2745#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2746pub struct GetInstalledCertificateIdsRequest {
2747    /// Indicates the type of certificates requested. When omitted, all certificate types are requested.
2748    #[serde(rename = "certificateType")]
2749    #[serde(default, skip_serializing_if = "Option::is_none")]
2750    pub certificate_type: Option<Vec<GetCertificateIdUse>>,
2751    /// The `customData` member.
2752    #[serde(rename = "customData")]
2753    #[serde(default, skip_serializing_if = "Option::is_none")]
2754    pub custom_data: Option<crate::types::CustomData>,
2755}
2756
2757impl GetInstalledCertificateIdsRequest {
2758    /// Creates an empty `GetInstalledCertificateIdsRequest`. Every field of this type is optional.
2759    #[must_use]
2760    pub fn new() -> Self {
2761        Self::default()
2762    }
2763
2764    /// Sets the optional `certificateType` field.
2765    #[must_use]
2766    pub fn with_certificate_type(mut self, value: Vec<GetCertificateIdUse>) -> Self {
2767        self.certificate_type = Some(value);
2768        self
2769    }
2770
2771    /// Sets the optional `customData` field.
2772    #[must_use]
2773    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2774        self.custom_data = Some(value);
2775        self
2776    }
2777}
2778
2779impl Validate for GetInstalledCertificateIdsRequest {
2780    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2781        path.push_key("certificateType");
2782        if let Some(value) = &self.certificate_type {
2783            validate::list_len(value.len(), Some(1), None, path, out);
2784            for (index, item) in value.iter().enumerate() {
2785                path.push_index(index);
2786                Validate::validate_at(item, path, out);
2787                path.pop();
2788            }
2789        }
2790        path.pop();
2791        path.push_key("customData");
2792        if let Some(value) = &self.custom_data {
2793            Validate::validate_at(value, path, out);
2794        }
2795        path.pop();
2796    }
2797}
2798
2799impl Sealed for GetInstalledCertificateIdsRequest {}
2800impl Request for GetInstalledCertificateIdsRequest {
2801    type Action = Action;
2802    const ACTION: Action = Action::GetInstalledCertificateIds;
2803    const KIND: MessageKind = MessageKind::Call;
2804    const ORIGIN: Origin = Origin::Csms;
2805    type Response = GetInstalledCertificateIdsResponse;
2806}
2807
2808impl Confirmed for GetInstalledCertificateIdsRequest {}
2809
2810/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2811#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2812pub struct GetInstalledCertificateIdsResponse {
2813    /// The `status` member.
2814    pub status: GetInstalledCertificateStatus,
2815    /// The `statusInfo` member.
2816    #[serde(rename = "statusInfo")]
2817    #[serde(default, skip_serializing_if = "Option::is_none")]
2818    pub status_info: Option<StatusInfo>,
2819    /// The `certificateHashDataChain` member.
2820    #[serde(rename = "certificateHashDataChain")]
2821    #[serde(default, skip_serializing_if = "Option::is_none")]
2822    pub certificate_hash_data_chain: Option<Vec<CertificateHashDataChain>>,
2823    /// The `customData` member.
2824    #[serde(rename = "customData")]
2825    #[serde(default, skip_serializing_if = "Option::is_none")]
2826    pub custom_data: Option<crate::types::CustomData>,
2827}
2828
2829impl GetInstalledCertificateIdsResponse {
2830    /// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
2831    #[must_use]
2832    pub fn new(status: GetInstalledCertificateStatus) -> Self {
2833        Self {
2834            status,
2835            status_info: None,
2836            certificate_hash_data_chain: None,
2837            custom_data: None,
2838        }
2839    }
2840
2841    /// Sets the optional `statusInfo` field.
2842    #[must_use]
2843    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2844        self.status_info = Some(value);
2845        self
2846    }
2847
2848    /// Sets the optional `certificateHashDataChain` field.
2849    #[must_use]
2850    pub fn with_certificate_hash_data_chain(
2851        mut self,
2852        value: Vec<CertificateHashDataChain>,
2853    ) -> Self {
2854        self.certificate_hash_data_chain = Some(value);
2855        self
2856    }
2857
2858    /// Sets the optional `customData` field.
2859    #[must_use]
2860    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2861        self.custom_data = Some(value);
2862        self
2863    }
2864}
2865
2866impl Validate for GetInstalledCertificateIdsResponse {
2867    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2868        path.push_key("status");
2869        Validate::validate_at(&self.status, path, out);
2870        path.pop();
2871        path.push_key("statusInfo");
2872        if let Some(value) = &self.status_info {
2873            Validate::validate_at(value, path, out);
2874        }
2875        path.pop();
2876        path.push_key("certificateHashDataChain");
2877        if let Some(value) = &self.certificate_hash_data_chain {
2878            validate::list_len(value.len(), Some(1), None, path, out);
2879            for (index, item) in value.iter().enumerate() {
2880                path.push_index(index);
2881                Validate::validate_at(item, path, out);
2882                path.pop();
2883            }
2884        }
2885        path.pop();
2886        path.push_key("customData");
2887        if let Some(value) = &self.custom_data {
2888            Validate::validate_at(value, path, out);
2889        }
2890        path.pop();
2891    }
2892}
2893
2894impl Sealed for GetInstalledCertificateIdsResponse {}
2895impl Response for GetInstalledCertificateIdsResponse {}
2896
2897/// Spec: OCPP 2.0.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
2898#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2899pub struct GetLocalListVersionRequest {
2900    /// The `customData` member.
2901    #[serde(rename = "customData")]
2902    #[serde(default, skip_serializing_if = "Option::is_none")]
2903    pub custom_data: Option<crate::types::CustomData>,
2904}
2905
2906impl GetLocalListVersionRequest {
2907    /// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
2908    #[must_use]
2909    pub fn new() -> Self {
2910        Self::default()
2911    }
2912
2913    /// Sets the optional `customData` field.
2914    #[must_use]
2915    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2916        self.custom_data = Some(value);
2917        self
2918    }
2919}
2920
2921impl Validate for GetLocalListVersionRequest {
2922    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2923        path.push_key("customData");
2924        if let Some(value) = &self.custom_data {
2925            Validate::validate_at(value, path, out);
2926        }
2927        path.pop();
2928    }
2929}
2930
2931impl Sealed for GetLocalListVersionRequest {}
2932impl Request for GetLocalListVersionRequest {
2933    type Action = Action;
2934    const ACTION: Action = Action::GetLocalListVersion;
2935    const KIND: MessageKind = MessageKind::Call;
2936    const ORIGIN: Origin = Origin::Csms;
2937    type Response = GetLocalListVersionResponse;
2938}
2939
2940impl Confirmed for GetLocalListVersionRequest {}
2941
2942/// Spec: OCPP 2.0.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
2943#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2944pub struct GetLocalListVersionResponse {
2945    /// This contains the current version number of the local authorization list in the Charging Station.
2946    #[serde(rename = "versionNumber")]
2947    pub version_number: i32,
2948    /// The `customData` member.
2949    #[serde(rename = "customData")]
2950    #[serde(default, skip_serializing_if = "Option::is_none")]
2951    pub custom_data: Option<crate::types::CustomData>,
2952}
2953
2954impl GetLocalListVersionResponse {
2955    /// Creates a `GetLocalListVersionResponse` from its required fields.
2956    #[must_use]
2957    pub fn new(version_number: i32) -> Self {
2958        Self {
2959            version_number,
2960            custom_data: None,
2961        }
2962    }
2963
2964    /// Sets the optional `customData` field.
2965    #[must_use]
2966    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2967        self.custom_data = Some(value);
2968        self
2969    }
2970}
2971
2972impl Validate for GetLocalListVersionResponse {
2973    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2974        path.push_key("customData");
2975        if let Some(value) = &self.custom_data {
2976            Validate::validate_at(value, path, out);
2977        }
2978        path.pop();
2979    }
2980}
2981
2982impl Sealed for GetLocalListVersionResponse {}
2983impl Response for GetLocalListVersionResponse {}
2984
2985/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
2986#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2987pub struct GetLogRequest {
2988    /// The `log` member.
2989    pub log: LogParameters,
2990    /// The `logType` member.
2991    #[serde(rename = "logType")]
2992    pub log_type: Log,
2993    /// The Id of this request
2994    #[serde(rename = "requestId")]
2995    pub request_id: i32,
2996    /// This specifies how many times the Charging Station must try 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.
2997    #[serde(default, skip_serializing_if = "Option::is_none")]
2998    pub retries: Option<i32>,
2999    /// 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.
3000    #[serde(rename = "retryInterval")]
3001    #[serde(default, skip_serializing_if = "Option::is_none")]
3002    pub retry_interval: Option<i32>,
3003    /// The `customData` member.
3004    #[serde(rename = "customData")]
3005    #[serde(default, skip_serializing_if = "Option::is_none")]
3006    pub custom_data: Option<crate::types::CustomData>,
3007}
3008
3009impl GetLogRequest {
3010    /// Creates a `GetLogRequest` from its required fields.
3011    #[must_use]
3012    pub fn new(log: LogParameters, log_type: Log, request_id: i32) -> Self {
3013        Self {
3014            log,
3015            log_type,
3016            request_id,
3017            retries: None,
3018            retry_interval: None,
3019            custom_data: None,
3020        }
3021    }
3022
3023    /// Sets the optional `retries` field.
3024    #[must_use]
3025    pub fn with_retries(mut self, value: i32) -> Self {
3026        self.retries = Some(value);
3027        self
3028    }
3029
3030    /// Sets the optional `retryInterval` field.
3031    #[must_use]
3032    pub fn with_retry_interval(mut self, value: i32) -> Self {
3033        self.retry_interval = Some(value);
3034        self
3035    }
3036
3037    /// Sets the optional `customData` field.
3038    #[must_use]
3039    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3040        self.custom_data = Some(value);
3041        self
3042    }
3043}
3044
3045impl Validate for GetLogRequest {
3046    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3047        path.push_key("log");
3048        Validate::validate_at(&self.log, path, out);
3049        path.pop();
3050        path.push_key("logType");
3051        Validate::validate_at(&self.log_type, path, out);
3052        path.pop();
3053        path.push_key("customData");
3054        if let Some(value) = &self.custom_data {
3055            Validate::validate_at(value, path, out);
3056        }
3057        path.pop();
3058    }
3059}
3060
3061impl Sealed for GetLogRequest {}
3062impl Request for GetLogRequest {
3063    type Action = Action;
3064    const ACTION: Action = Action::GetLog;
3065    const KIND: MessageKind = MessageKind::Call;
3066    const ORIGIN: Origin = Origin::Csms;
3067    type Response = GetLogResponse;
3068}
3069
3070impl Confirmed for GetLogRequest {}
3071
3072/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
3073#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3074pub struct GetLogResponse {
3075    /// The `status` member.
3076    pub status: LogStatus,
3077    /// The `statusInfo` member.
3078    #[serde(rename = "statusInfo")]
3079    #[serde(default, skip_serializing_if = "Option::is_none")]
3080    pub status_info: Option<StatusInfo>,
3081    /// This contains the name of the log file that will be uploaded. This field is not present when no logging information is available.
3082    #[serde(default, skip_serializing_if = "Option::is_none")]
3083    pub filename: Option<String>,
3084    /// The `customData` member.
3085    #[serde(rename = "customData")]
3086    #[serde(default, skip_serializing_if = "Option::is_none")]
3087    pub custom_data: Option<crate::types::CustomData>,
3088}
3089
3090impl GetLogResponse {
3091    /// Creates a `GetLogResponse` from its required fields.
3092    #[must_use]
3093    pub fn new(status: LogStatus) -> Self {
3094        Self {
3095            status,
3096            status_info: None,
3097            filename: None,
3098            custom_data: None,
3099        }
3100    }
3101
3102    /// Sets the optional `statusInfo` field.
3103    #[must_use]
3104    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3105        self.status_info = Some(value);
3106        self
3107    }
3108
3109    /// Sets the optional `filename` field.
3110    #[must_use]
3111    pub fn with_filename(mut self, value: impl Into<String>) -> Self {
3112        self.filename = Some(value.into());
3113        self
3114    }
3115
3116    /// Sets the optional `customData` field.
3117    #[must_use]
3118    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3119        self.custom_data = Some(value);
3120        self
3121    }
3122}
3123
3124impl Validate for GetLogResponse {
3125    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3126        path.push_key("status");
3127        Validate::validate_at(&self.status, path, out);
3128        path.pop();
3129        path.push_key("statusInfo");
3130        if let Some(value) = &self.status_info {
3131            Validate::validate_at(value, path, out);
3132        }
3133        path.pop();
3134        path.push_key("filename");
3135        if let Some(value) = &self.filename {
3136            validate::string(value.as_str(), None, Some(255), path, out);
3137        }
3138        path.pop();
3139        path.push_key("customData");
3140        if let Some(value) = &self.custom_data {
3141            Validate::validate_at(value, path, out);
3142        }
3143        path.pop();
3144    }
3145}
3146
3147impl Sealed for GetLogResponse {}
3148impl Response for GetLogResponse {}
3149
3150/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
3151#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3152pub struct GetMonitoringReportRequest {
3153    /// The Id of the request.
3154    #[serde(rename = "requestId")]
3155    pub request_id: i32,
3156    /// The `componentVariable` member.
3157    #[serde(rename = "componentVariable")]
3158    #[serde(default, skip_serializing_if = "Option::is_none")]
3159    pub component_variable: Option<Vec<ComponentVariable>>,
3160    /// This field contains criteria for components for which a monitoring report is requested
3161    #[serde(rename = "monitoringCriteria")]
3162    #[serde(default, skip_serializing_if = "Option::is_none")]
3163    pub monitoring_criteria: Option<Vec<MonitoringCriterion>>,
3164    /// The `customData` member.
3165    #[serde(rename = "customData")]
3166    #[serde(default, skip_serializing_if = "Option::is_none")]
3167    pub custom_data: Option<crate::types::CustomData>,
3168}
3169
3170impl GetMonitoringReportRequest {
3171    /// Creates a `GetMonitoringReportRequest` from its required fields.
3172    #[must_use]
3173    pub fn new(request_id: i32) -> Self {
3174        Self {
3175            request_id,
3176            component_variable: None,
3177            monitoring_criteria: None,
3178            custom_data: None,
3179        }
3180    }
3181
3182    /// Sets the optional `componentVariable` field.
3183    #[must_use]
3184    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
3185        self.component_variable = Some(value);
3186        self
3187    }
3188
3189    /// Sets the optional `monitoringCriteria` field.
3190    #[must_use]
3191    pub fn with_monitoring_criteria(mut self, value: Vec<MonitoringCriterion>) -> Self {
3192        self.monitoring_criteria = Some(value);
3193        self
3194    }
3195
3196    /// Sets the optional `customData` field.
3197    #[must_use]
3198    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3199        self.custom_data = Some(value);
3200        self
3201    }
3202}
3203
3204impl Validate for GetMonitoringReportRequest {
3205    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3206        path.push_key("componentVariable");
3207        if let Some(value) = &self.component_variable {
3208            validate::list_len(value.len(), Some(1), None, path, out);
3209            for (index, item) in value.iter().enumerate() {
3210                path.push_index(index);
3211                Validate::validate_at(item, path, out);
3212                path.pop();
3213            }
3214        }
3215        path.pop();
3216        path.push_key("monitoringCriteria");
3217        if let Some(value) = &self.monitoring_criteria {
3218            validate::list_len(value.len(), Some(1), Some(3), path, out);
3219            for (index, item) in value.iter().enumerate() {
3220                path.push_index(index);
3221                Validate::validate_at(item, path, out);
3222                path.pop();
3223            }
3224        }
3225        path.pop();
3226        path.push_key("customData");
3227        if let Some(value) = &self.custom_data {
3228            Validate::validate_at(value, path, out);
3229        }
3230        path.pop();
3231    }
3232}
3233
3234impl Sealed for GetMonitoringReportRequest {}
3235impl Request for GetMonitoringReportRequest {
3236    type Action = Action;
3237    const ACTION: Action = Action::GetMonitoringReport;
3238    const KIND: MessageKind = MessageKind::Call;
3239    const ORIGIN: Origin = Origin::Csms;
3240    type Response = GetMonitoringReportResponse;
3241}
3242
3243impl Confirmed for GetMonitoringReportRequest {}
3244
3245/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
3246#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3247pub struct GetMonitoringReportResponse {
3248    /// The `status` member.
3249    pub status: GenericDeviceModelStatus,
3250    /// The `statusInfo` member.
3251    #[serde(rename = "statusInfo")]
3252    #[serde(default, skip_serializing_if = "Option::is_none")]
3253    pub status_info: Option<StatusInfo>,
3254    /// The `customData` member.
3255    #[serde(rename = "customData")]
3256    #[serde(default, skip_serializing_if = "Option::is_none")]
3257    pub custom_data: Option<crate::types::CustomData>,
3258}
3259
3260impl GetMonitoringReportResponse {
3261    /// Creates a `GetMonitoringReportResponse` from its required fields.
3262    #[must_use]
3263    pub fn new(status: GenericDeviceModelStatus) -> Self {
3264        Self {
3265            status,
3266            status_info: None,
3267            custom_data: None,
3268        }
3269    }
3270
3271    /// Sets the optional `statusInfo` field.
3272    #[must_use]
3273    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3274        self.status_info = Some(value);
3275        self
3276    }
3277
3278    /// Sets the optional `customData` field.
3279    #[must_use]
3280    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3281        self.custom_data = Some(value);
3282        self
3283    }
3284}
3285
3286impl Validate for GetMonitoringReportResponse {
3287    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3288        path.push_key("status");
3289        Validate::validate_at(&self.status, path, out);
3290        path.pop();
3291        path.push_key("statusInfo");
3292        if let Some(value) = &self.status_info {
3293            Validate::validate_at(value, path, out);
3294        }
3295        path.pop();
3296        path.push_key("customData");
3297        if let Some(value) = &self.custom_data {
3298            Validate::validate_at(value, path, out);
3299        }
3300        path.pop();
3301    }
3302}
3303
3304impl Sealed for GetMonitoringReportResponse {}
3305impl Response for GetMonitoringReportResponse {}
3306
3307/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
3308#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3309pub struct GetReportRequest {
3310    /// The Id of the request.
3311    #[serde(rename = "requestId")]
3312    pub request_id: i32,
3313    /// The `componentVariable` member.
3314    #[serde(rename = "componentVariable")]
3315    #[serde(default, skip_serializing_if = "Option::is_none")]
3316    pub component_variable: Option<Vec<ComponentVariable>>,
3317    /// This field contains criteria for components for which a report is requested
3318    #[serde(rename = "componentCriteria")]
3319    #[serde(default, skip_serializing_if = "Option::is_none")]
3320    pub component_criteria: Option<Vec<ComponentCriterion>>,
3321    /// The `customData` member.
3322    #[serde(rename = "customData")]
3323    #[serde(default, skip_serializing_if = "Option::is_none")]
3324    pub custom_data: Option<crate::types::CustomData>,
3325}
3326
3327impl GetReportRequest {
3328    /// Creates a `GetReportRequest` from its required fields.
3329    #[must_use]
3330    pub fn new(request_id: i32) -> Self {
3331        Self {
3332            request_id,
3333            component_variable: None,
3334            component_criteria: None,
3335            custom_data: None,
3336        }
3337    }
3338
3339    /// Sets the optional `componentVariable` field.
3340    #[must_use]
3341    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
3342        self.component_variable = Some(value);
3343        self
3344    }
3345
3346    /// Sets the optional `componentCriteria` field.
3347    #[must_use]
3348    pub fn with_component_criteria(mut self, value: Vec<ComponentCriterion>) -> Self {
3349        self.component_criteria = Some(value);
3350        self
3351    }
3352
3353    /// Sets the optional `customData` field.
3354    #[must_use]
3355    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3356        self.custom_data = Some(value);
3357        self
3358    }
3359}
3360
3361impl Validate for GetReportRequest {
3362    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3363        path.push_key("componentVariable");
3364        if let Some(value) = &self.component_variable {
3365            validate::list_len(value.len(), Some(1), None, path, out);
3366            for (index, item) in value.iter().enumerate() {
3367                path.push_index(index);
3368                Validate::validate_at(item, path, out);
3369                path.pop();
3370            }
3371        }
3372        path.pop();
3373        path.push_key("componentCriteria");
3374        if let Some(value) = &self.component_criteria {
3375            validate::list_len(value.len(), Some(1), Some(4), path, out);
3376            for (index, item) in value.iter().enumerate() {
3377                path.push_index(index);
3378                Validate::validate_at(item, path, out);
3379                path.pop();
3380            }
3381        }
3382        path.pop();
3383        path.push_key("customData");
3384        if let Some(value) = &self.custom_data {
3385            Validate::validate_at(value, path, out);
3386        }
3387        path.pop();
3388    }
3389}
3390
3391impl Sealed for GetReportRequest {}
3392impl Request for GetReportRequest {
3393    type Action = Action;
3394    const ACTION: Action = Action::GetReport;
3395    const KIND: MessageKind = MessageKind::Call;
3396    const ORIGIN: Origin = Origin::Csms;
3397    type Response = GetReportResponse;
3398}
3399
3400impl Confirmed for GetReportRequest {}
3401
3402/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
3403#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3404pub struct GetReportResponse {
3405    /// The `status` member.
3406    pub status: GenericDeviceModelStatus,
3407    /// The `statusInfo` member.
3408    #[serde(rename = "statusInfo")]
3409    #[serde(default, skip_serializing_if = "Option::is_none")]
3410    pub status_info: Option<StatusInfo>,
3411    /// The `customData` member.
3412    #[serde(rename = "customData")]
3413    #[serde(default, skip_serializing_if = "Option::is_none")]
3414    pub custom_data: Option<crate::types::CustomData>,
3415}
3416
3417impl GetReportResponse {
3418    /// Creates a `GetReportResponse` from its required fields.
3419    #[must_use]
3420    pub fn new(status: GenericDeviceModelStatus) -> Self {
3421        Self {
3422            status,
3423            status_info: None,
3424            custom_data: None,
3425        }
3426    }
3427
3428    /// Sets the optional `statusInfo` field.
3429    #[must_use]
3430    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3431        self.status_info = Some(value);
3432        self
3433    }
3434
3435    /// Sets the optional `customData` field.
3436    #[must_use]
3437    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3438        self.custom_data = Some(value);
3439        self
3440    }
3441}
3442
3443impl Validate for GetReportResponse {
3444    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3445        path.push_key("status");
3446        Validate::validate_at(&self.status, path, out);
3447        path.pop();
3448        path.push_key("statusInfo");
3449        if let Some(value) = &self.status_info {
3450            Validate::validate_at(value, path, out);
3451        }
3452        path.pop();
3453        path.push_key("customData");
3454        if let Some(value) = &self.custom_data {
3455            Validate::validate_at(value, path, out);
3456        }
3457        path.pop();
3458    }
3459}
3460
3461impl Sealed for GetReportResponse {}
3462impl Response for GetReportResponse {}
3463
3464/// Spec: OCPP 2.0.1 · E — Transactions · CSMS → Charging Station · CALL.
3465#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3466pub struct GetTransactionStatusRequest {
3467    /// The Id of the transaction for which the status is requested.
3468    #[serde(rename = "transactionId")]
3469    #[serde(default, skip_serializing_if = "Option::is_none")]
3470    pub transaction_id: Option<String>,
3471    /// The `customData` member.
3472    #[serde(rename = "customData")]
3473    #[serde(default, skip_serializing_if = "Option::is_none")]
3474    pub custom_data: Option<crate::types::CustomData>,
3475}
3476
3477impl GetTransactionStatusRequest {
3478    /// Creates an empty `GetTransactionStatusRequest`. Every field of this type is optional.
3479    #[must_use]
3480    pub fn new() -> Self {
3481        Self::default()
3482    }
3483
3484    /// Sets the optional `transactionId` field.
3485    #[must_use]
3486    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
3487        self.transaction_id = Some(value.into());
3488        self
3489    }
3490
3491    /// Sets the optional `customData` field.
3492    #[must_use]
3493    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3494        self.custom_data = Some(value);
3495        self
3496    }
3497}
3498
3499impl Validate for GetTransactionStatusRequest {
3500    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3501        path.push_key("transactionId");
3502        if let Some(value) = &self.transaction_id {
3503            validate::string(value.as_str(), None, Some(36), path, out);
3504        }
3505        path.pop();
3506        path.push_key("customData");
3507        if let Some(value) = &self.custom_data {
3508            Validate::validate_at(value, path, out);
3509        }
3510        path.pop();
3511    }
3512}
3513
3514impl Sealed for GetTransactionStatusRequest {}
3515impl Request for GetTransactionStatusRequest {
3516    type Action = Action;
3517    const ACTION: Action = Action::GetTransactionStatus;
3518    const KIND: MessageKind = MessageKind::Call;
3519    const ORIGIN: Origin = Origin::Csms;
3520    type Response = GetTransactionStatusResponse;
3521}
3522
3523impl Confirmed for GetTransactionStatusRequest {}
3524
3525/// Spec: OCPP 2.0.1 · E — Transactions · CSMS → Charging Station · CALL.
3526#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3527pub struct GetTransactionStatusResponse {
3528    /// Whether there are still message to be delivered.
3529    #[serde(rename = "messagesInQueue")]
3530    pub messages_in_queue: bool,
3531    /// Whether the transaction is still ongoing.
3532    #[serde(rename = "ongoingIndicator")]
3533    #[serde(default, skip_serializing_if = "Option::is_none")]
3534    pub ongoing_indicator: Option<bool>,
3535    /// The `customData` member.
3536    #[serde(rename = "customData")]
3537    #[serde(default, skip_serializing_if = "Option::is_none")]
3538    pub custom_data: Option<crate::types::CustomData>,
3539}
3540
3541impl GetTransactionStatusResponse {
3542    /// Creates a `GetTransactionStatusResponse` from its required fields.
3543    #[must_use]
3544    pub fn new(messages_in_queue: bool) -> Self {
3545        Self {
3546            messages_in_queue,
3547            ongoing_indicator: None,
3548            custom_data: None,
3549        }
3550    }
3551
3552    /// Sets the optional `ongoingIndicator` field.
3553    #[must_use]
3554    pub fn with_ongoing_indicator(mut self, value: bool) -> Self {
3555        self.ongoing_indicator = Some(value);
3556        self
3557    }
3558
3559    /// Sets the optional `customData` field.
3560    #[must_use]
3561    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3562        self.custom_data = Some(value);
3563        self
3564    }
3565}
3566
3567impl Validate for GetTransactionStatusResponse {
3568    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
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 GetTransactionStatusResponse {}
3578impl Response for GetTransactionStatusResponse {}
3579
3580/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
3581#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3582pub struct GetVariablesRequest {
3583    /// The `getVariableData` member.
3584    #[serde(rename = "getVariableData")]
3585    pub get_variable_data: Vec<GetVariableData>,
3586    /// The `customData` member.
3587    #[serde(rename = "customData")]
3588    #[serde(default, skip_serializing_if = "Option::is_none")]
3589    pub custom_data: Option<crate::types::CustomData>,
3590}
3591
3592impl GetVariablesRequest {
3593    /// Creates a `GetVariablesRequest` from its required fields.
3594    #[must_use]
3595    pub fn new(get_variable_data: Vec<GetVariableData>) -> Self {
3596        Self {
3597            get_variable_data,
3598            custom_data: None,
3599        }
3600    }
3601
3602    /// Sets the optional `customData` field.
3603    #[must_use]
3604    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3605        self.custom_data = Some(value);
3606        self
3607    }
3608}
3609
3610impl Validate for GetVariablesRequest {
3611    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3612        path.push_key("getVariableData");
3613        validate::list_len(self.get_variable_data.len(), Some(1), None, path, out);
3614        for (index, item) in self.get_variable_data.iter().enumerate() {
3615            path.push_index(index);
3616            Validate::validate_at(item, path, out);
3617            path.pop();
3618        }
3619        path.pop();
3620        path.push_key("customData");
3621        if let Some(value) = &self.custom_data {
3622            Validate::validate_at(value, path, out);
3623        }
3624        path.pop();
3625    }
3626}
3627
3628impl Sealed for GetVariablesRequest {}
3629impl Request for GetVariablesRequest {
3630    type Action = Action;
3631    const ACTION: Action = Action::GetVariables;
3632    const KIND: MessageKind = MessageKind::Call;
3633    const ORIGIN: Origin = Origin::Csms;
3634    type Response = GetVariablesResponse;
3635}
3636
3637impl Confirmed for GetVariablesRequest {}
3638
3639/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
3640#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3641pub struct GetVariablesResponse {
3642    /// The `getVariableResult` member.
3643    #[serde(rename = "getVariableResult")]
3644    pub get_variable_result: Vec<GetVariableResult>,
3645    /// The `customData` member.
3646    #[serde(rename = "customData")]
3647    #[serde(default, skip_serializing_if = "Option::is_none")]
3648    pub custom_data: Option<crate::types::CustomData>,
3649}
3650
3651impl GetVariablesResponse {
3652    /// Creates a `GetVariablesResponse` from its required fields.
3653    #[must_use]
3654    pub fn new(get_variable_result: Vec<GetVariableResult>) -> Self {
3655        Self {
3656            get_variable_result,
3657            custom_data: None,
3658        }
3659    }
3660
3661    /// Sets the optional `customData` field.
3662    #[must_use]
3663    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3664        self.custom_data = Some(value);
3665        self
3666    }
3667}
3668
3669impl Validate for GetVariablesResponse {
3670    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3671        path.push_key("getVariableResult");
3672        validate::list_len(self.get_variable_result.len(), Some(1), None, path, out);
3673        for (index, item) in self.get_variable_result.iter().enumerate() {
3674            path.push_index(index);
3675            Validate::validate_at(item, path, out);
3676            path.pop();
3677        }
3678        path.pop();
3679        path.push_key("customData");
3680        if let Some(value) = &self.custom_data {
3681            Validate::validate_at(value, path, out);
3682        }
3683        path.pop();
3684    }
3685}
3686
3687impl Sealed for GetVariablesResponse {}
3688impl Response for GetVariablesResponse {}
3689
3690/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
3691#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3692pub struct HeartbeatRequest {
3693    /// The `customData` member.
3694    #[serde(rename = "customData")]
3695    #[serde(default, skip_serializing_if = "Option::is_none")]
3696    pub custom_data: Option<crate::types::CustomData>,
3697}
3698
3699impl HeartbeatRequest {
3700    /// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
3701    #[must_use]
3702    pub fn new() -> Self {
3703        Self::default()
3704    }
3705
3706    /// Sets the optional `customData` field.
3707    #[must_use]
3708    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3709        self.custom_data = Some(value);
3710        self
3711    }
3712}
3713
3714impl Validate for HeartbeatRequest {
3715    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3716        path.push_key("customData");
3717        if let Some(value) = &self.custom_data {
3718            Validate::validate_at(value, path, out);
3719        }
3720        path.pop();
3721    }
3722}
3723
3724impl Sealed for HeartbeatRequest {}
3725impl Request for HeartbeatRequest {
3726    type Action = Action;
3727    const ACTION: Action = Action::Heartbeat;
3728    const KIND: MessageKind = MessageKind::Call;
3729    const ORIGIN: Origin = Origin::ChargingStation;
3730    type Response = HeartbeatResponse;
3731}
3732
3733impl Confirmed for HeartbeatRequest {}
3734
3735/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
3736#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3737pub struct HeartbeatResponse {
3738    /// Contains the current time of the CSMS.
3739    #[serde(rename = "currentTime")]
3740    pub current_time: crate::types::DateTime,
3741    /// The `customData` member.
3742    #[serde(rename = "customData")]
3743    #[serde(default, skip_serializing_if = "Option::is_none")]
3744    pub custom_data: Option<crate::types::CustomData>,
3745}
3746
3747impl HeartbeatResponse {
3748    /// Creates a `HeartbeatResponse` from its required fields.
3749    #[must_use]
3750    pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
3751        Self {
3752            current_time: current_time.into(),
3753            custom_data: None,
3754        }
3755    }
3756
3757    /// Sets the optional `customData` field.
3758    #[must_use]
3759    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3760        self.custom_data = Some(value);
3761        self
3762    }
3763}
3764
3765impl Validate for HeartbeatResponse {
3766    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3767        path.push_key("customData");
3768        if let Some(value) = &self.custom_data {
3769            Validate::validate_at(value, path, out);
3770        }
3771        path.pop();
3772    }
3773}
3774
3775impl Sealed for HeartbeatResponse {}
3776impl Response for HeartbeatResponse {}
3777
3778/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
3779#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3780pub struct InstallCertificateRequest {
3781    /// The `certificateType` member.
3782    #[serde(rename = "certificateType")]
3783    pub certificate_type: InstallCertificateUse,
3784    /// A PEM encoded X.509 certificate.
3785    pub certificate: String,
3786    /// The `customData` member.
3787    #[serde(rename = "customData")]
3788    #[serde(default, skip_serializing_if = "Option::is_none")]
3789    pub custom_data: Option<crate::types::CustomData>,
3790}
3791
3792impl InstallCertificateRequest {
3793    /// Creates a `InstallCertificateRequest` from its required fields.
3794    #[must_use]
3795    pub fn new(certificate_type: InstallCertificateUse, certificate: impl Into<String>) -> Self {
3796        Self {
3797            certificate_type,
3798            certificate: certificate.into(),
3799            custom_data: None,
3800        }
3801    }
3802
3803    /// Sets the optional `customData` field.
3804    #[must_use]
3805    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3806        self.custom_data = Some(value);
3807        self
3808    }
3809}
3810
3811impl Validate for InstallCertificateRequest {
3812    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3813        path.push_key("certificateType");
3814        Validate::validate_at(&self.certificate_type, path, out);
3815        path.pop();
3816        path.push_key("certificate");
3817        validate::string(self.certificate.as_str(), None, Some(5500), path, out);
3818        path.pop();
3819        path.push_key("customData");
3820        if let Some(value) = &self.custom_data {
3821            Validate::validate_at(value, path, out);
3822        }
3823        path.pop();
3824    }
3825}
3826
3827impl Sealed for InstallCertificateRequest {}
3828impl Request for InstallCertificateRequest {
3829    type Action = Action;
3830    const ACTION: Action = Action::InstallCertificate;
3831    const KIND: MessageKind = MessageKind::Call;
3832    const ORIGIN: Origin = Origin::Csms;
3833    type Response = InstallCertificateResponse;
3834}
3835
3836impl Confirmed for InstallCertificateRequest {}
3837
3838/// Spec: OCPP 2.0.1 · M — Certificate Management · CSMS → Charging Station · CALL.
3839#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3840pub struct InstallCertificateResponse {
3841    /// The `status` member.
3842    pub status: InstallCertificateStatus,
3843    /// The `statusInfo` member.
3844    #[serde(rename = "statusInfo")]
3845    #[serde(default, skip_serializing_if = "Option::is_none")]
3846    pub status_info: Option<StatusInfo>,
3847    /// The `customData` member.
3848    #[serde(rename = "customData")]
3849    #[serde(default, skip_serializing_if = "Option::is_none")]
3850    pub custom_data: Option<crate::types::CustomData>,
3851}
3852
3853impl InstallCertificateResponse {
3854    /// Creates a `InstallCertificateResponse` from its required fields.
3855    #[must_use]
3856    pub fn new(status: InstallCertificateStatus) -> Self {
3857        Self {
3858            status,
3859            status_info: None,
3860            custom_data: None,
3861        }
3862    }
3863
3864    /// Sets the optional `statusInfo` field.
3865    #[must_use]
3866    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3867        self.status_info = Some(value);
3868        self
3869    }
3870
3871    /// Sets the optional `customData` field.
3872    #[must_use]
3873    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3874        self.custom_data = Some(value);
3875        self
3876    }
3877}
3878
3879impl Validate for InstallCertificateResponse {
3880    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3881        path.push_key("status");
3882        Validate::validate_at(&self.status, path, out);
3883        path.pop();
3884        path.push_key("statusInfo");
3885        if let Some(value) = &self.status_info {
3886            Validate::validate_at(value, path, out);
3887        }
3888        path.pop();
3889        path.push_key("customData");
3890        if let Some(value) = &self.custom_data {
3891            Validate::validate_at(value, path, out);
3892        }
3893        path.pop();
3894    }
3895}
3896
3897impl Sealed for InstallCertificateResponse {}
3898impl Response for InstallCertificateResponse {}
3899
3900/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
3901#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3902pub struct LogStatusNotificationRequest {
3903    /// The `status` member.
3904    pub status: UploadLogStatus,
3905    /// The request id that was provided in GetLogRequest that started this log upload. This field is mandatory,
3906    /// unless the message was triggered by a TriggerMessageRequest AND there is no log upload ongoing.
3907    #[serde(rename = "requestId")]
3908    #[serde(default, skip_serializing_if = "Option::is_none")]
3909    pub request_id: Option<i32>,
3910    /// The `customData` member.
3911    #[serde(rename = "customData")]
3912    #[serde(default, skip_serializing_if = "Option::is_none")]
3913    pub custom_data: Option<crate::types::CustomData>,
3914}
3915
3916impl LogStatusNotificationRequest {
3917    /// Creates a `LogStatusNotificationRequest` from its required fields.
3918    #[must_use]
3919    pub fn new(status: UploadLogStatus) -> Self {
3920        Self {
3921            status,
3922            request_id: None,
3923            custom_data: None,
3924        }
3925    }
3926
3927    /// Sets the optional `requestId` field.
3928    #[must_use]
3929    pub fn with_request_id(mut self, value: i32) -> Self {
3930        self.request_id = Some(value);
3931        self
3932    }
3933
3934    /// Sets the optional `customData` field.
3935    #[must_use]
3936    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3937        self.custom_data = Some(value);
3938        self
3939    }
3940}
3941
3942impl Validate for LogStatusNotificationRequest {
3943    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3944        path.push_key("status");
3945        Validate::validate_at(&self.status, path, out);
3946        path.pop();
3947        path.push_key("customData");
3948        if let Some(value) = &self.custom_data {
3949            Validate::validate_at(value, path, out);
3950        }
3951        path.pop();
3952    }
3953}
3954
3955impl Sealed for LogStatusNotificationRequest {}
3956impl Request for LogStatusNotificationRequest {
3957    type Action = Action;
3958    const ACTION: Action = Action::LogStatusNotification;
3959    const KIND: MessageKind = MessageKind::Call;
3960    const ORIGIN: Origin = Origin::ChargingStation;
3961    type Response = LogStatusNotificationResponse;
3962}
3963
3964impl Confirmed for LogStatusNotificationRequest {}
3965
3966/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
3967#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3968pub struct LogStatusNotificationResponse {
3969    /// The `customData` member.
3970    #[serde(rename = "customData")]
3971    #[serde(default, skip_serializing_if = "Option::is_none")]
3972    pub custom_data: Option<crate::types::CustomData>,
3973}
3974
3975impl LogStatusNotificationResponse {
3976    /// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
3977    #[must_use]
3978    pub fn new() -> Self {
3979        Self::default()
3980    }
3981
3982    /// Sets the optional `customData` field.
3983    #[must_use]
3984    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3985        self.custom_data = Some(value);
3986        self
3987    }
3988}
3989
3990impl Validate for LogStatusNotificationResponse {
3991    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3992        path.push_key("customData");
3993        if let Some(value) = &self.custom_data {
3994            Validate::validate_at(value, path, out);
3995        }
3996        path.pop();
3997    }
3998}
3999
4000impl Sealed for LogStatusNotificationResponse {}
4001impl Response for LogStatusNotificationResponse {}
4002
4003/// Request_ Body
4004/// urn:x-enexis:ecdm:uid:2:234744
4005///
4006/// Spec: OCPP 2.0.1 · J — Meter Values · Charging Station → CSMS · CALL.
4007#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4008pub struct MeterValuesRequest {
4009    /// Request_ Body. EVSEID. Numeric_ Identifier
4010    /// urn:x-enexis:ecdm:uid:1:571101
4011    /// This contains a number (&gt;0) designating an EVSE of the Charging Station. ‘0’ (zero) is used to designate the main power meter.
4012    #[serde(rename = "evseId")]
4013    pub evse_id: i32,
4014    /// The `meterValue` member.
4015    #[serde(rename = "meterValue")]
4016    pub meter_value: Vec<MeterValue>,
4017    /// The `customData` member.
4018    #[serde(rename = "customData")]
4019    #[serde(default, skip_serializing_if = "Option::is_none")]
4020    pub custom_data: Option<crate::types::CustomData>,
4021}
4022
4023impl MeterValuesRequest {
4024    /// Creates a `MeterValuesRequest` from its required fields.
4025    #[must_use]
4026    pub fn new(evse_id: i32, meter_value: Vec<MeterValue>) -> Self {
4027        Self {
4028            evse_id,
4029            meter_value,
4030            custom_data: None,
4031        }
4032    }
4033
4034    /// Sets the optional `customData` field.
4035    #[must_use]
4036    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4037        self.custom_data = Some(value);
4038        self
4039    }
4040}
4041
4042impl Validate for MeterValuesRequest {
4043    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4044        path.push_key("meterValue");
4045        validate::list_len(self.meter_value.len(), Some(1), None, path, out);
4046        for (index, item) in self.meter_value.iter().enumerate() {
4047            path.push_index(index);
4048            Validate::validate_at(item, path, out);
4049            path.pop();
4050        }
4051        path.pop();
4052        path.push_key("customData");
4053        if let Some(value) = &self.custom_data {
4054            Validate::validate_at(value, path, out);
4055        }
4056        path.pop();
4057    }
4058}
4059
4060impl Sealed for MeterValuesRequest {}
4061impl Request for MeterValuesRequest {
4062    type Action = Action;
4063    const ACTION: Action = Action::MeterValues;
4064    const KIND: MessageKind = MessageKind::Call;
4065    const ORIGIN: Origin = Origin::ChargingStation;
4066    type Response = MeterValuesResponse;
4067}
4068
4069impl Confirmed for MeterValuesRequest {}
4070
4071/// Spec: OCPP 2.0.1 · J — Meter Values · Charging Station → CSMS · CALL.
4072#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4073pub struct MeterValuesResponse {
4074    /// The `customData` member.
4075    #[serde(rename = "customData")]
4076    #[serde(default, skip_serializing_if = "Option::is_none")]
4077    pub custom_data: Option<crate::types::CustomData>,
4078}
4079
4080impl MeterValuesResponse {
4081    /// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
4082    #[must_use]
4083    pub fn new() -> Self {
4084        Self::default()
4085    }
4086
4087    /// Sets the optional `customData` field.
4088    #[must_use]
4089    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4090        self.custom_data = Some(value);
4091        self
4092    }
4093}
4094
4095impl Validate for MeterValuesResponse {
4096    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4097        path.push_key("customData");
4098        if let Some(value) = &self.custom_data {
4099            Validate::validate_at(value, path, out);
4100        }
4101        path.pop();
4102    }
4103}
4104
4105impl Sealed for MeterValuesResponse {}
4106impl Response for MeterValuesResponse {}
4107
4108/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4109#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4110pub struct NotifyChargingLimitRequest {
4111    /// The `chargingLimit` member.
4112    #[serde(rename = "chargingLimit")]
4113    pub charging_limit: ChargingLimit,
4114    /// The `chargingSchedule` member.
4115    #[serde(rename = "chargingSchedule")]
4116    #[serde(default, skip_serializing_if = "Option::is_none")]
4117    pub charging_schedule: Option<Vec<ChargingSchedule>>,
4118    /// The charging schedule contained in this notification applies to an EVSE. evseId must be &gt; 0.
4119    #[serde(rename = "evseId")]
4120    #[serde(default, skip_serializing_if = "Option::is_none")]
4121    pub evse_id: Option<i32>,
4122    /// The `customData` member.
4123    #[serde(rename = "customData")]
4124    #[serde(default, skip_serializing_if = "Option::is_none")]
4125    pub custom_data: Option<crate::types::CustomData>,
4126}
4127
4128impl NotifyChargingLimitRequest {
4129    /// Creates a `NotifyChargingLimitRequest` from its required fields.
4130    #[must_use]
4131    pub fn new(charging_limit: ChargingLimit) -> Self {
4132        Self {
4133            charging_limit,
4134            charging_schedule: None,
4135            evse_id: None,
4136            custom_data: None,
4137        }
4138    }
4139
4140    /// Sets the optional `chargingSchedule` field.
4141    #[must_use]
4142    pub fn with_charging_schedule(mut self, value: Vec<ChargingSchedule>) -> Self {
4143        self.charging_schedule = Some(value);
4144        self
4145    }
4146
4147    /// Sets the optional `evseId` field.
4148    #[must_use]
4149    pub fn with_evse_id(mut self, value: i32) -> Self {
4150        self.evse_id = Some(value);
4151        self
4152    }
4153
4154    /// Sets the optional `customData` field.
4155    #[must_use]
4156    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4157        self.custom_data = Some(value);
4158        self
4159    }
4160}
4161
4162impl Validate for NotifyChargingLimitRequest {
4163    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4164        path.push_key("chargingLimit");
4165        Validate::validate_at(&self.charging_limit, path, out);
4166        path.pop();
4167        path.push_key("chargingSchedule");
4168        if let Some(value) = &self.charging_schedule {
4169            validate::list_len(value.len(), Some(1), None, path, out);
4170            for (index, item) in value.iter().enumerate() {
4171                path.push_index(index);
4172                Validate::validate_at(item, path, out);
4173                path.pop();
4174            }
4175        }
4176        path.pop();
4177        path.push_key("customData");
4178        if let Some(value) = &self.custom_data {
4179            Validate::validate_at(value, path, out);
4180        }
4181        path.pop();
4182    }
4183}
4184
4185impl Sealed for NotifyChargingLimitRequest {}
4186impl Request for NotifyChargingLimitRequest {
4187    type Action = Action;
4188    const ACTION: Action = Action::NotifyChargingLimit;
4189    const KIND: MessageKind = MessageKind::Call;
4190    const ORIGIN: Origin = Origin::ChargingStation;
4191    type Response = NotifyChargingLimitResponse;
4192}
4193
4194impl Confirmed for NotifyChargingLimitRequest {}
4195
4196/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4197#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4198pub struct NotifyChargingLimitResponse {
4199    /// The `customData` member.
4200    #[serde(rename = "customData")]
4201    #[serde(default, skip_serializing_if = "Option::is_none")]
4202    pub custom_data: Option<crate::types::CustomData>,
4203}
4204
4205impl NotifyChargingLimitResponse {
4206    /// Creates an empty `NotifyChargingLimitResponse`. Every field of this type is optional.
4207    #[must_use]
4208    pub fn new() -> Self {
4209        Self::default()
4210    }
4211
4212    /// Sets the optional `customData` field.
4213    #[must_use]
4214    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4215        self.custom_data = Some(value);
4216        self
4217    }
4218}
4219
4220impl Validate for NotifyChargingLimitResponse {
4221    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4222        path.push_key("customData");
4223        if let Some(value) = &self.custom_data {
4224            Validate::validate_at(value, path, out);
4225        }
4226        path.pop();
4227    }
4228}
4229
4230impl Sealed for NotifyChargingLimitResponse {}
4231impl Response for NotifyChargingLimitResponse {}
4232
4233/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4234#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4235pub struct NotifyCustomerInformationRequest {
4236    /// (Part of) the requested data. No format specified in which the data is returned. Should be human readable.
4237    pub data: String,
4238    /// Sequence number of this message. First message starts at 0.
4239    #[serde(rename = "seqNo")]
4240    pub seq_no: i32,
4241    ///  Timestamp of the moment this message was generated at the Charging Station.
4242    #[serde(rename = "generatedAt")]
4243    pub generated_at: crate::types::DateTime,
4244    /// The Id of the request.
4245    #[serde(rename = "requestId")]
4246    pub request_id: i32,
4247    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
4248    /// Schema default: `false`.
4249    #[serde(default, skip_serializing_if = "Option::is_none")]
4250    pub tbc: Option<bool>,
4251    /// The `customData` member.
4252    #[serde(rename = "customData")]
4253    #[serde(default, skip_serializing_if = "Option::is_none")]
4254    pub custom_data: Option<crate::types::CustomData>,
4255}
4256
4257impl NotifyCustomerInformationRequest {
4258    /// Creates a `NotifyCustomerInformationRequest` from its required fields.
4259    #[must_use]
4260    pub fn new(
4261        data: impl Into<String>,
4262        seq_no: i32,
4263        generated_at: impl Into<crate::types::DateTime>,
4264        request_id: i32,
4265    ) -> Self {
4266        Self {
4267            data: data.into(),
4268            seq_no,
4269            generated_at: generated_at.into(),
4270            request_id,
4271            tbc: None,
4272            custom_data: None,
4273        }
4274    }
4275
4276    /// Sets the optional `tbc` field.
4277    #[must_use]
4278    pub fn with_tbc(mut self, value: bool) -> Self {
4279        self.tbc = Some(value);
4280        self
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 NotifyCustomerInformationRequest {
4292    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4293        path.push_key("data");
4294        validate::string(self.data.as_str(), None, Some(512), path, out);
4295        path.pop();
4296        path.push_key("customData");
4297        if let Some(value) = &self.custom_data {
4298            Validate::validate_at(value, path, out);
4299        }
4300        path.pop();
4301    }
4302}
4303
4304impl Sealed for NotifyCustomerInformationRequest {}
4305impl Request for NotifyCustomerInformationRequest {
4306    type Action = Action;
4307    const ACTION: Action = Action::NotifyCustomerInformation;
4308    const KIND: MessageKind = MessageKind::Call;
4309    const ORIGIN: Origin = Origin::ChargingStation;
4310    type Response = NotifyCustomerInformationResponse;
4311}
4312
4313impl Confirmed for NotifyCustomerInformationRequest {}
4314
4315/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4316#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4317pub struct NotifyCustomerInformationResponse {
4318    /// The `customData` member.
4319    #[serde(rename = "customData")]
4320    #[serde(default, skip_serializing_if = "Option::is_none")]
4321    pub custom_data: Option<crate::types::CustomData>,
4322}
4323
4324impl NotifyCustomerInformationResponse {
4325    /// Creates an empty `NotifyCustomerInformationResponse`. Every field of this type is optional.
4326    #[must_use]
4327    pub fn new() -> Self {
4328        Self::default()
4329    }
4330
4331    /// Sets the optional `customData` field.
4332    #[must_use]
4333    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4334        self.custom_data = Some(value);
4335        self
4336    }
4337}
4338
4339impl Validate for NotifyCustomerInformationResponse {
4340    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4341        path.push_key("customData");
4342        if let Some(value) = &self.custom_data {
4343            Validate::validate_at(value, path, out);
4344        }
4345        path.pop();
4346    }
4347}
4348
4349impl Sealed for NotifyCustomerInformationResponse {}
4350impl Response for NotifyCustomerInformationResponse {}
4351
4352/// Spec: OCPP 2.0.1 · O — Display Message · Charging Station → CSMS · CALL.
4353#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4354pub struct NotifyDisplayMessagesRequest {
4355    /// The id of the &lt;&lt;getdisplaymessagesrequest,GetDisplayMessagesRequest&gt;&gt; that requested this message.
4356    #[serde(rename = "requestId")]
4357    pub request_id: i32,
4358    /// The `messageInfo` member.
4359    #[serde(rename = "messageInfo")]
4360    #[serde(default, skip_serializing_if = "Option::is_none")]
4361    pub message_info: Option<Vec<MessageInfo>>,
4362    /// "to be continued" indicator. Indicates whether another part of the report follows in an upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
4363    /// Schema default: `false`.
4364    #[serde(default, skip_serializing_if = "Option::is_none")]
4365    pub tbc: Option<bool>,
4366    /// The `customData` member.
4367    #[serde(rename = "customData")]
4368    #[serde(default, skip_serializing_if = "Option::is_none")]
4369    pub custom_data: Option<crate::types::CustomData>,
4370}
4371
4372impl NotifyDisplayMessagesRequest {
4373    /// Creates a `NotifyDisplayMessagesRequest` from its required fields.
4374    #[must_use]
4375    pub fn new(request_id: i32) -> Self {
4376        Self {
4377            request_id,
4378            message_info: None,
4379            tbc: None,
4380            custom_data: None,
4381        }
4382    }
4383
4384    /// Sets the optional `messageInfo` field.
4385    #[must_use]
4386    pub fn with_message_info(mut self, value: Vec<MessageInfo>) -> Self {
4387        self.message_info = Some(value);
4388        self
4389    }
4390
4391    /// Sets the optional `tbc` field.
4392    #[must_use]
4393    pub fn with_tbc(mut self, value: bool) -> Self {
4394        self.tbc = Some(value);
4395        self
4396    }
4397
4398    /// Sets the optional `customData` field.
4399    #[must_use]
4400    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4401        self.custom_data = Some(value);
4402        self
4403    }
4404}
4405
4406impl Validate for NotifyDisplayMessagesRequest {
4407    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4408        path.push_key("messageInfo");
4409        if let Some(value) = &self.message_info {
4410            validate::list_len(value.len(), Some(1), None, path, out);
4411            for (index, item) in value.iter().enumerate() {
4412                path.push_index(index);
4413                Validate::validate_at(item, path, out);
4414                path.pop();
4415            }
4416        }
4417        path.pop();
4418        path.push_key("customData");
4419        if let Some(value) = &self.custom_data {
4420            Validate::validate_at(value, path, out);
4421        }
4422        path.pop();
4423    }
4424}
4425
4426impl Sealed for NotifyDisplayMessagesRequest {}
4427impl Request for NotifyDisplayMessagesRequest {
4428    type Action = Action;
4429    const ACTION: Action = Action::NotifyDisplayMessages;
4430    const KIND: MessageKind = MessageKind::Call;
4431    const ORIGIN: Origin = Origin::ChargingStation;
4432    type Response = NotifyDisplayMessagesResponse;
4433}
4434
4435impl Confirmed for NotifyDisplayMessagesRequest {}
4436
4437/// Spec: OCPP 2.0.1 · O — Display Message · Charging Station → CSMS · CALL.
4438#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4439pub struct NotifyDisplayMessagesResponse {
4440    /// The `customData` member.
4441    #[serde(rename = "customData")]
4442    #[serde(default, skip_serializing_if = "Option::is_none")]
4443    pub custom_data: Option<crate::types::CustomData>,
4444}
4445
4446impl NotifyDisplayMessagesResponse {
4447    /// Creates an empty `NotifyDisplayMessagesResponse`. Every field of this type is optional.
4448    #[must_use]
4449    pub fn new() -> Self {
4450        Self::default()
4451    }
4452
4453    /// Sets the optional `customData` field.
4454    #[must_use]
4455    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4456        self.custom_data = Some(value);
4457        self
4458    }
4459}
4460
4461impl Validate for NotifyDisplayMessagesResponse {
4462    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4463        path.push_key("customData");
4464        if let Some(value) = &self.custom_data {
4465            Validate::validate_at(value, path, out);
4466        }
4467        path.pop();
4468    }
4469}
4470
4471impl Sealed for NotifyDisplayMessagesResponse {}
4472impl Response for NotifyDisplayMessagesResponse {}
4473
4474/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4475#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4476pub struct NotifyEVChargingNeedsRequest {
4477    /// The `chargingNeeds` member.
4478    #[serde(rename = "chargingNeeds")]
4479    pub charging_needs: ChargingNeeds,
4480    /// Defines the EVSE and connector to which the EV is connected. EvseId may not be 0.
4481    #[serde(rename = "evseId")]
4482    pub evse_id: i32,
4483    /// Contains the maximum schedule tuples the car supports per schedule.
4484    #[serde(rename = "maxScheduleTuples")]
4485    #[serde(default, skip_serializing_if = "Option::is_none")]
4486    pub max_schedule_tuples: Option<i32>,
4487    /// The `customData` member.
4488    #[serde(rename = "customData")]
4489    #[serde(default, skip_serializing_if = "Option::is_none")]
4490    pub custom_data: Option<crate::types::CustomData>,
4491}
4492
4493impl NotifyEVChargingNeedsRequest {
4494    /// Creates a `NotifyEVChargingNeedsRequest` from its required fields.
4495    #[must_use]
4496    pub fn new(charging_needs: ChargingNeeds, evse_id: i32) -> Self {
4497        Self {
4498            charging_needs,
4499            evse_id,
4500            max_schedule_tuples: None,
4501            custom_data: None,
4502        }
4503    }
4504
4505    /// Sets the optional `maxScheduleTuples` field.
4506    #[must_use]
4507    pub fn with_max_schedule_tuples(mut self, value: i32) -> Self {
4508        self.max_schedule_tuples = Some(value);
4509        self
4510    }
4511
4512    /// Sets the optional `customData` field.
4513    #[must_use]
4514    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4515        self.custom_data = Some(value);
4516        self
4517    }
4518}
4519
4520impl Validate for NotifyEVChargingNeedsRequest {
4521    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4522        path.push_key("chargingNeeds");
4523        Validate::validate_at(&self.charging_needs, path, out);
4524        path.pop();
4525        path.push_key("customData");
4526        if let Some(value) = &self.custom_data {
4527            Validate::validate_at(value, path, out);
4528        }
4529        path.pop();
4530    }
4531}
4532
4533impl Sealed for NotifyEVChargingNeedsRequest {}
4534impl Request for NotifyEVChargingNeedsRequest {
4535    type Action = Action;
4536    const ACTION: Action = Action::NotifyEVChargingNeeds;
4537    const KIND: MessageKind = MessageKind::Call;
4538    const ORIGIN: Origin = Origin::ChargingStation;
4539    type Response = NotifyEVChargingNeedsResponse;
4540}
4541
4542impl Confirmed for NotifyEVChargingNeedsRequest {}
4543
4544/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4545#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4546pub struct NotifyEVChargingNeedsResponse {
4547    /// The `status` member.
4548    pub status: NotifyEVChargingNeedsStatus,
4549    /// The `statusInfo` member.
4550    #[serde(rename = "statusInfo")]
4551    #[serde(default, skip_serializing_if = "Option::is_none")]
4552    pub status_info: Option<StatusInfo>,
4553    /// The `customData` member.
4554    #[serde(rename = "customData")]
4555    #[serde(default, skip_serializing_if = "Option::is_none")]
4556    pub custom_data: Option<crate::types::CustomData>,
4557}
4558
4559impl NotifyEVChargingNeedsResponse {
4560    /// Creates a `NotifyEVChargingNeedsResponse` from its required fields.
4561    #[must_use]
4562    pub fn new(status: NotifyEVChargingNeedsStatus) -> Self {
4563        Self {
4564            status,
4565            status_info: None,
4566            custom_data: None,
4567        }
4568    }
4569
4570    /// Sets the optional `statusInfo` field.
4571    #[must_use]
4572    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4573        self.status_info = Some(value);
4574        self
4575    }
4576
4577    /// Sets the optional `customData` field.
4578    #[must_use]
4579    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4580        self.custom_data = Some(value);
4581        self
4582    }
4583}
4584
4585impl Validate for NotifyEVChargingNeedsResponse {
4586    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4587        path.push_key("status");
4588        Validate::validate_at(&self.status, path, out);
4589        path.pop();
4590        path.push_key("statusInfo");
4591        if let Some(value) = &self.status_info {
4592            Validate::validate_at(value, path, out);
4593        }
4594        path.pop();
4595        path.push_key("customData");
4596        if let Some(value) = &self.custom_data {
4597            Validate::validate_at(value, path, out);
4598        }
4599        path.pop();
4600    }
4601}
4602
4603impl Sealed for NotifyEVChargingNeedsResponse {}
4604impl Response for NotifyEVChargingNeedsResponse {}
4605
4606/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4607#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4608pub struct NotifyEVChargingScheduleRequest {
4609    /// Periods contained in the charging profile are relative to this point in time.
4610    #[serde(rename = "timeBase")]
4611    pub time_base: crate::types::DateTime,
4612    /// The `chargingSchedule` member.
4613    #[serde(rename = "chargingSchedule")]
4614    pub charging_schedule: ChargingSchedule,
4615    /// The charging schedule contained in this notification applies to an EVSE. EvseId must be &gt; 0.
4616    #[serde(rename = "evseId")]
4617    pub evse_id: i32,
4618    /// The `customData` member.
4619    #[serde(rename = "customData")]
4620    #[serde(default, skip_serializing_if = "Option::is_none")]
4621    pub custom_data: Option<crate::types::CustomData>,
4622}
4623
4624impl NotifyEVChargingScheduleRequest {
4625    /// Creates a `NotifyEVChargingScheduleRequest` from its required fields.
4626    #[must_use]
4627    pub fn new(
4628        time_base: impl Into<crate::types::DateTime>,
4629        charging_schedule: ChargingSchedule,
4630        evse_id: i32,
4631    ) -> Self {
4632        Self {
4633            time_base: time_base.into(),
4634            charging_schedule,
4635            evse_id,
4636            custom_data: None,
4637        }
4638    }
4639
4640    /// Sets the optional `customData` field.
4641    #[must_use]
4642    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4643        self.custom_data = Some(value);
4644        self
4645    }
4646}
4647
4648impl Validate for NotifyEVChargingScheduleRequest {
4649    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4650        path.push_key("chargingSchedule");
4651        Validate::validate_at(&self.charging_schedule, path, out);
4652        path.pop();
4653        path.push_key("customData");
4654        if let Some(value) = &self.custom_data {
4655            Validate::validate_at(value, path, out);
4656        }
4657        path.pop();
4658    }
4659}
4660
4661impl Sealed for NotifyEVChargingScheduleRequest {}
4662impl Request for NotifyEVChargingScheduleRequest {
4663    type Action = Action;
4664    const ACTION: Action = Action::NotifyEVChargingSchedule;
4665    const KIND: MessageKind = MessageKind::Call;
4666    const ORIGIN: Origin = Origin::ChargingStation;
4667    type Response = NotifyEVChargingScheduleResponse;
4668}
4669
4670impl Confirmed for NotifyEVChargingScheduleRequest {}
4671
4672/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
4673#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4674pub struct NotifyEVChargingScheduleResponse {
4675    /// The `status` member.
4676    pub status: GenericStatus,
4677    /// The `statusInfo` member.
4678    #[serde(rename = "statusInfo")]
4679    #[serde(default, skip_serializing_if = "Option::is_none")]
4680    pub status_info: Option<StatusInfo>,
4681    /// The `customData` member.
4682    #[serde(rename = "customData")]
4683    #[serde(default, skip_serializing_if = "Option::is_none")]
4684    pub custom_data: Option<crate::types::CustomData>,
4685}
4686
4687impl NotifyEVChargingScheduleResponse {
4688    /// Creates a `NotifyEVChargingScheduleResponse` from its required fields.
4689    #[must_use]
4690    pub fn new(status: GenericStatus) -> Self {
4691        Self {
4692            status,
4693            status_info: None,
4694            custom_data: None,
4695        }
4696    }
4697
4698    /// Sets the optional `statusInfo` field.
4699    #[must_use]
4700    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4701        self.status_info = Some(value);
4702        self
4703    }
4704
4705    /// Sets the optional `customData` field.
4706    #[must_use]
4707    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4708        self.custom_data = Some(value);
4709        self
4710    }
4711}
4712
4713impl Validate for NotifyEVChargingScheduleResponse {
4714    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4715        path.push_key("status");
4716        Validate::validate_at(&self.status, path, out);
4717        path.pop();
4718        path.push_key("statusInfo");
4719        if let Some(value) = &self.status_info {
4720            Validate::validate_at(value, path, out);
4721        }
4722        path.pop();
4723        path.push_key("customData");
4724        if let Some(value) = &self.custom_data {
4725            Validate::validate_at(value, path, out);
4726        }
4727        path.pop();
4728    }
4729}
4730
4731impl Sealed for NotifyEVChargingScheduleResponse {}
4732impl Response for NotifyEVChargingScheduleResponse {}
4733
4734/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4735#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4736pub struct NotifyEventRequest {
4737    /// Timestamp of the moment this message was generated at the Charging Station.
4738    #[serde(rename = "generatedAt")]
4739    pub generated_at: crate::types::DateTime,
4740    /// Sequence number of this message. First message starts at 0.
4741    #[serde(rename = "seqNo")]
4742    pub seq_no: i32,
4743    /// The `eventData` member.
4744    #[serde(rename = "eventData")]
4745    pub event_data: Vec<EventData>,
4746    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyEventRequest message. Default value when omitted is false.
4747    /// Schema default: `false`.
4748    #[serde(default, skip_serializing_if = "Option::is_none")]
4749    pub tbc: Option<bool>,
4750    /// The `customData` member.
4751    #[serde(rename = "customData")]
4752    #[serde(default, skip_serializing_if = "Option::is_none")]
4753    pub custom_data: Option<crate::types::CustomData>,
4754}
4755
4756impl NotifyEventRequest {
4757    /// Creates a `NotifyEventRequest` from its required fields.
4758    #[must_use]
4759    pub fn new(
4760        generated_at: impl Into<crate::types::DateTime>,
4761        seq_no: i32,
4762        event_data: Vec<EventData>,
4763    ) -> Self {
4764        Self {
4765            generated_at: generated_at.into(),
4766            seq_no,
4767            event_data,
4768            tbc: None,
4769            custom_data: None,
4770        }
4771    }
4772
4773    /// Sets the optional `tbc` field.
4774    #[must_use]
4775    pub fn with_tbc(mut self, value: bool) -> Self {
4776        self.tbc = Some(value);
4777        self
4778    }
4779
4780    /// Sets the optional `customData` field.
4781    #[must_use]
4782    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4783        self.custom_data = Some(value);
4784        self
4785    }
4786}
4787
4788impl Validate for NotifyEventRequest {
4789    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4790        path.push_key("eventData");
4791        validate::list_len(self.event_data.len(), Some(1), None, path, out);
4792        for (index, item) in self.event_data.iter().enumerate() {
4793            path.push_index(index);
4794            Validate::validate_at(item, path, out);
4795            path.pop();
4796        }
4797        path.pop();
4798        path.push_key("customData");
4799        if let Some(value) = &self.custom_data {
4800            Validate::validate_at(value, path, out);
4801        }
4802        path.pop();
4803    }
4804}
4805
4806impl Sealed for NotifyEventRequest {}
4807impl Request for NotifyEventRequest {
4808    type Action = Action;
4809    const ACTION: Action = Action::NotifyEvent;
4810    const KIND: MessageKind = MessageKind::Call;
4811    const ORIGIN: Origin = Origin::ChargingStation;
4812    type Response = NotifyEventResponse;
4813}
4814
4815impl Confirmed for NotifyEventRequest {}
4816
4817/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4818#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4819pub struct NotifyEventResponse {
4820    /// The `customData` member.
4821    #[serde(rename = "customData")]
4822    #[serde(default, skip_serializing_if = "Option::is_none")]
4823    pub custom_data: Option<crate::types::CustomData>,
4824}
4825
4826impl NotifyEventResponse {
4827    /// Creates an empty `NotifyEventResponse`. Every field of this type is optional.
4828    #[must_use]
4829    pub fn new() -> Self {
4830        Self::default()
4831    }
4832
4833    /// Sets the optional `customData` field.
4834    #[must_use]
4835    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4836        self.custom_data = Some(value);
4837        self
4838    }
4839}
4840
4841impl Validate for NotifyEventResponse {
4842    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4843        path.push_key("customData");
4844        if let Some(value) = &self.custom_data {
4845            Validate::validate_at(value, path, out);
4846        }
4847        path.pop();
4848    }
4849}
4850
4851impl Sealed for NotifyEventResponse {}
4852impl Response for NotifyEventResponse {}
4853
4854/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4855#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4856pub struct NotifyMonitoringReportRequest {
4857    /// The id of the GetMonitoringRequest that requested this report.
4858    #[serde(rename = "requestId")]
4859    pub request_id: i32,
4860    /// Sequence number of this message. First message starts at 0.
4861    #[serde(rename = "seqNo")]
4862    pub seq_no: i32,
4863    /// Timestamp of the moment this message was generated at the Charging Station.
4864    #[serde(rename = "generatedAt")]
4865    pub generated_at: crate::types::DateTime,
4866    /// The `monitor` member.
4867    #[serde(default, skip_serializing_if = "Option::is_none")]
4868    pub monitor: Option<Vec<MonitoringData>>,
4869    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
4870    /// Schema default: `false`.
4871    #[serde(default, skip_serializing_if = "Option::is_none")]
4872    pub tbc: Option<bool>,
4873    /// The `customData` member.
4874    #[serde(rename = "customData")]
4875    #[serde(default, skip_serializing_if = "Option::is_none")]
4876    pub custom_data: Option<crate::types::CustomData>,
4877}
4878
4879impl NotifyMonitoringReportRequest {
4880    /// Creates a `NotifyMonitoringReportRequest` from its required fields.
4881    #[must_use]
4882    pub fn new(
4883        request_id: i32,
4884        seq_no: i32,
4885        generated_at: impl Into<crate::types::DateTime>,
4886    ) -> Self {
4887        Self {
4888            request_id,
4889            seq_no,
4890            generated_at: generated_at.into(),
4891            monitor: None,
4892            tbc: None,
4893            custom_data: None,
4894        }
4895    }
4896
4897    /// Sets the optional `monitor` field.
4898    #[must_use]
4899    pub fn with_monitor(mut self, value: Vec<MonitoringData>) -> Self {
4900        self.monitor = Some(value);
4901        self
4902    }
4903
4904    /// Sets the optional `tbc` field.
4905    #[must_use]
4906    pub fn with_tbc(mut self, value: bool) -> Self {
4907        self.tbc = Some(value);
4908        self
4909    }
4910
4911    /// Sets the optional `customData` field.
4912    #[must_use]
4913    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4914        self.custom_data = Some(value);
4915        self
4916    }
4917}
4918
4919impl Validate for NotifyMonitoringReportRequest {
4920    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4921        path.push_key("monitor");
4922        if let Some(value) = &self.monitor {
4923            validate::list_len(value.len(), Some(1), None, path, out);
4924            for (index, item) in value.iter().enumerate() {
4925                path.push_index(index);
4926                Validate::validate_at(item, path, out);
4927                path.pop();
4928            }
4929        }
4930        path.pop();
4931        path.push_key("customData");
4932        if let Some(value) = &self.custom_data {
4933            Validate::validate_at(value, path, out);
4934        }
4935        path.pop();
4936    }
4937}
4938
4939impl Sealed for NotifyMonitoringReportRequest {}
4940impl Request for NotifyMonitoringReportRequest {
4941    type Action = Action;
4942    const ACTION: Action = Action::NotifyMonitoringReport;
4943    const KIND: MessageKind = MessageKind::Call;
4944    const ORIGIN: Origin = Origin::ChargingStation;
4945    type Response = NotifyMonitoringReportResponse;
4946}
4947
4948impl Confirmed for NotifyMonitoringReportRequest {}
4949
4950/// Spec: OCPP 2.0.1 · N — Diagnostics · Charging Station → CSMS · CALL.
4951#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4952pub struct NotifyMonitoringReportResponse {
4953    /// The `customData` member.
4954    #[serde(rename = "customData")]
4955    #[serde(default, skip_serializing_if = "Option::is_none")]
4956    pub custom_data: Option<crate::types::CustomData>,
4957}
4958
4959impl NotifyMonitoringReportResponse {
4960    /// Creates an empty `NotifyMonitoringReportResponse`. Every field of this type is optional.
4961    #[must_use]
4962    pub fn new() -> Self {
4963        Self::default()
4964    }
4965
4966    /// Sets the optional `customData` field.
4967    #[must_use]
4968    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4969        self.custom_data = Some(value);
4970        self
4971    }
4972}
4973
4974impl Validate for NotifyMonitoringReportResponse {
4975    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4976        path.push_key("customData");
4977        if let Some(value) = &self.custom_data {
4978            Validate::validate_at(value, path, out);
4979        }
4980        path.pop();
4981    }
4982}
4983
4984impl Sealed for NotifyMonitoringReportResponse {}
4985impl Response for NotifyMonitoringReportResponse {}
4986
4987/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
4988#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4989pub struct NotifyReportRequest {
4990    /// The id of the GetReportRequest  or GetBaseReportRequest that requested this report
4991    #[serde(rename = "requestId")]
4992    pub request_id: i32,
4993    /// Timestamp of the moment this message was generated at the Charging Station.
4994    #[serde(rename = "generatedAt")]
4995    pub generated_at: crate::types::DateTime,
4996    /// Sequence number of this message. First message starts at 0.
4997    #[serde(rename = "seqNo")]
4998    pub seq_no: i32,
4999    /// The `reportData` member.
5000    #[serde(rename = "reportData")]
5001    #[serde(default, skip_serializing_if = "Option::is_none")]
5002    pub report_data: Option<Vec<ReportData>>,
5003    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyReportRequest message. Default value when omitted is false.
5004    /// Schema default: `false`.
5005    #[serde(default, skip_serializing_if = "Option::is_none")]
5006    pub tbc: Option<bool>,
5007    /// The `customData` member.
5008    #[serde(rename = "customData")]
5009    #[serde(default, skip_serializing_if = "Option::is_none")]
5010    pub custom_data: Option<crate::types::CustomData>,
5011}
5012
5013impl NotifyReportRequest {
5014    /// Creates a `NotifyReportRequest` from its required fields.
5015    #[must_use]
5016    pub fn new(
5017        request_id: i32,
5018        generated_at: impl Into<crate::types::DateTime>,
5019        seq_no: i32,
5020    ) -> Self {
5021        Self {
5022            request_id,
5023            generated_at: generated_at.into(),
5024            seq_no,
5025            report_data: None,
5026            tbc: None,
5027            custom_data: None,
5028        }
5029    }
5030
5031    /// Sets the optional `reportData` field.
5032    #[must_use]
5033    pub fn with_report_data(mut self, value: Vec<ReportData>) -> Self {
5034        self.report_data = Some(value);
5035        self
5036    }
5037
5038    /// Sets the optional `tbc` field.
5039    #[must_use]
5040    pub fn with_tbc(mut self, value: bool) -> Self {
5041        self.tbc = Some(value);
5042        self
5043    }
5044
5045    /// Sets the optional `customData` field.
5046    #[must_use]
5047    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5048        self.custom_data = Some(value);
5049        self
5050    }
5051}
5052
5053impl Validate for NotifyReportRequest {
5054    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5055        path.push_key("reportData");
5056        if let Some(value) = &self.report_data {
5057            validate::list_len(value.len(), Some(1), None, path, out);
5058            for (index, item) in value.iter().enumerate() {
5059                path.push_index(index);
5060                Validate::validate_at(item, path, out);
5061                path.pop();
5062            }
5063        }
5064        path.pop();
5065        path.push_key("customData");
5066        if let Some(value) = &self.custom_data {
5067            Validate::validate_at(value, path, out);
5068        }
5069        path.pop();
5070    }
5071}
5072
5073impl Sealed for NotifyReportRequest {}
5074impl Request for NotifyReportRequest {
5075    type Action = Action;
5076    const ACTION: Action = Action::NotifyReport;
5077    const KIND: MessageKind = MessageKind::Call;
5078    const ORIGIN: Origin = Origin::ChargingStation;
5079    type Response = NotifyReportResponse;
5080}
5081
5082impl Confirmed for NotifyReportRequest {}
5083
5084/// Spec: OCPP 2.0.1 · B — Provisioning · Charging Station → CSMS · CALL.
5085#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5086pub struct NotifyReportResponse {
5087    /// The `customData` member.
5088    #[serde(rename = "customData")]
5089    #[serde(default, skip_serializing_if = "Option::is_none")]
5090    pub custom_data: Option<crate::types::CustomData>,
5091}
5092
5093impl NotifyReportResponse {
5094    /// Creates an empty `NotifyReportResponse`. Every field of this type is optional.
5095    #[must_use]
5096    pub fn new() -> Self {
5097        Self::default()
5098    }
5099
5100    /// Sets the optional `customData` field.
5101    #[must_use]
5102    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5103        self.custom_data = Some(value);
5104        self
5105    }
5106}
5107
5108impl Validate for NotifyReportResponse {
5109    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5110        path.push_key("customData");
5111        if let Some(value) = &self.custom_data {
5112            Validate::validate_at(value, path, out);
5113        }
5114        path.pop();
5115    }
5116}
5117
5118impl Sealed for NotifyReportResponse {}
5119impl Response for NotifyReportResponse {}
5120
5121/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
5122#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5123pub struct PublishFirmwareRequest {
5124    /// This contains a string containing a URI pointing to a
5125    /// location from which to retrieve the firmware.
5126    pub location: String,
5127    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
5128    pub checksum: String,
5129    /// The Id of the request.
5130    #[serde(rename = "requestId")]
5131    pub request_id: i32,
5132    /// This specifies how many times Charging Station must try
5133    /// to download the firmware before giving up. If this field is not
5134    /// present, it is left to Charging Station to decide how many times it wants to retry.
5135    #[serde(default, skip_serializing_if = "Option::is_none")]
5136    pub retries: Option<i32>,
5137    /// The interval in seconds
5138    /// after which a retry may be
5139    /// attempted. If this field is not
5140    /// present, it is left to Charging
5141    /// Station to decide how long to wait
5142    /// between attempts.
5143    #[serde(rename = "retryInterval")]
5144    #[serde(default, skip_serializing_if = "Option::is_none")]
5145    pub retry_interval: Option<i32>,
5146    /// The `customData` member.
5147    #[serde(rename = "customData")]
5148    #[serde(default, skip_serializing_if = "Option::is_none")]
5149    pub custom_data: Option<crate::types::CustomData>,
5150}
5151
5152impl PublishFirmwareRequest {
5153    /// Creates a `PublishFirmwareRequest` from its required fields.
5154    #[must_use]
5155    pub fn new(location: impl Into<String>, checksum: impl Into<String>, request_id: i32) -> Self {
5156        Self {
5157            location: location.into(),
5158            checksum: checksum.into(),
5159            request_id,
5160            retries: None,
5161            retry_interval: None,
5162            custom_data: None,
5163        }
5164    }
5165
5166    /// Sets the optional `retries` field.
5167    #[must_use]
5168    pub fn with_retries(mut self, value: i32) -> Self {
5169        self.retries = Some(value);
5170        self
5171    }
5172
5173    /// Sets the optional `retryInterval` field.
5174    #[must_use]
5175    pub fn with_retry_interval(mut self, value: i32) -> Self {
5176        self.retry_interval = Some(value);
5177        self
5178    }
5179
5180    /// Sets the optional `customData` field.
5181    #[must_use]
5182    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5183        self.custom_data = Some(value);
5184        self
5185    }
5186}
5187
5188impl Validate for PublishFirmwareRequest {
5189    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5190        path.push_key("location");
5191        validate::string(self.location.as_str(), None, Some(512), path, out);
5192        path.pop();
5193        path.push_key("checksum");
5194        validate::string(self.checksum.as_str(), None, Some(32), path, out);
5195        path.pop();
5196        path.push_key("customData");
5197        if let Some(value) = &self.custom_data {
5198            Validate::validate_at(value, path, out);
5199        }
5200        path.pop();
5201    }
5202}
5203
5204impl Sealed for PublishFirmwareRequest {}
5205impl Request for PublishFirmwareRequest {
5206    type Action = Action;
5207    const ACTION: Action = Action::PublishFirmware;
5208    const KIND: MessageKind = MessageKind::Call;
5209    const ORIGIN: Origin = Origin::Csms;
5210    type Response = PublishFirmwareResponse;
5211}
5212
5213impl Confirmed for PublishFirmwareRequest {}
5214
5215/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
5216#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5217pub struct PublishFirmwareResponse {
5218    /// The `status` member.
5219    pub status: GenericStatus,
5220    /// The `statusInfo` member.
5221    #[serde(rename = "statusInfo")]
5222    #[serde(default, skip_serializing_if = "Option::is_none")]
5223    pub status_info: Option<StatusInfo>,
5224    /// The `customData` member.
5225    #[serde(rename = "customData")]
5226    #[serde(default, skip_serializing_if = "Option::is_none")]
5227    pub custom_data: Option<crate::types::CustomData>,
5228}
5229
5230impl PublishFirmwareResponse {
5231    /// Creates a `PublishFirmwareResponse` from its required fields.
5232    #[must_use]
5233    pub fn new(status: GenericStatus) -> Self {
5234        Self {
5235            status,
5236            status_info: None,
5237            custom_data: None,
5238        }
5239    }
5240
5241    /// Sets the optional `statusInfo` field.
5242    #[must_use]
5243    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5244        self.status_info = Some(value);
5245        self
5246    }
5247
5248    /// Sets the optional `customData` field.
5249    #[must_use]
5250    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5251        self.custom_data = Some(value);
5252        self
5253    }
5254}
5255
5256impl Validate for PublishFirmwareResponse {
5257    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5258        path.push_key("status");
5259        Validate::validate_at(&self.status, path, out);
5260        path.pop();
5261        path.push_key("statusInfo");
5262        if let Some(value) = &self.status_info {
5263            Validate::validate_at(value, path, out);
5264        }
5265        path.pop();
5266        path.push_key("customData");
5267        if let Some(value) = &self.custom_data {
5268            Validate::validate_at(value, path, out);
5269        }
5270        path.pop();
5271    }
5272}
5273
5274impl Sealed for PublishFirmwareResponse {}
5275impl Response for PublishFirmwareResponse {}
5276
5277/// Spec: OCPP 2.0.1 · L — Firmware Management · Charging Station → CSMS · CALL.
5278#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5279pub struct PublishFirmwareStatusNotificationRequest {
5280    /// The `status` member.
5281    pub status: PublishFirmwareStatus,
5282    /// Required if status is Published. Can be multiple URI’s, if the Local Controller supports e.g. HTTP, HTTPS, and FTP.
5283    #[serde(default, skip_serializing_if = "Option::is_none")]
5284    pub location: Option<Vec<String>>,
5285    /// The request id that was
5286    /// provided in the
5287    /// PublishFirmwareRequest which
5288    /// triggered this action.
5289    #[serde(rename = "requestId")]
5290    #[serde(default, skip_serializing_if = "Option::is_none")]
5291    pub request_id: Option<i32>,
5292    /// The `customData` member.
5293    #[serde(rename = "customData")]
5294    #[serde(default, skip_serializing_if = "Option::is_none")]
5295    pub custom_data: Option<crate::types::CustomData>,
5296}
5297
5298impl PublishFirmwareStatusNotificationRequest {
5299    /// Creates a `PublishFirmwareStatusNotificationRequest` from its required fields.
5300    #[must_use]
5301    pub fn new(status: PublishFirmwareStatus) -> Self {
5302        Self {
5303            status,
5304            location: None,
5305            request_id: None,
5306            custom_data: None,
5307        }
5308    }
5309
5310    /// Sets the optional `location` field.
5311    #[must_use]
5312    pub fn with_location(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
5313        self.location = Some(value.into_iter().map(Into::into).collect());
5314        self
5315    }
5316
5317    /// Sets the optional `requestId` field.
5318    #[must_use]
5319    pub fn with_request_id(mut self, value: i32) -> Self {
5320        self.request_id = Some(value);
5321        self
5322    }
5323
5324    /// Sets the optional `customData` field.
5325    #[must_use]
5326    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5327        self.custom_data = Some(value);
5328        self
5329    }
5330}
5331
5332impl Validate for PublishFirmwareStatusNotificationRequest {
5333    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5334        path.push_key("status");
5335        Validate::validate_at(&self.status, path, out);
5336        path.pop();
5337        path.push_key("location");
5338        if let Some(value) = &self.location {
5339            validate::list_len(value.len(), Some(1), None, path, out);
5340            for (index, item) in value.iter().enumerate() {
5341                path.push_index(index);
5342                validate::string(item.as_str(), None, Some(512), path, out);
5343                path.pop();
5344            }
5345        }
5346        path.pop();
5347        path.push_key("customData");
5348        if let Some(value) = &self.custom_data {
5349            Validate::validate_at(value, path, out);
5350        }
5351        path.pop();
5352    }
5353}
5354
5355impl Sealed for PublishFirmwareStatusNotificationRequest {}
5356impl Request for PublishFirmwareStatusNotificationRequest {
5357    type Action = Action;
5358    const ACTION: Action = Action::PublishFirmwareStatusNotification;
5359    const KIND: MessageKind = MessageKind::Call;
5360    const ORIGIN: Origin = Origin::ChargingStation;
5361    type Response = PublishFirmwareStatusNotificationResponse;
5362}
5363
5364impl Confirmed for PublishFirmwareStatusNotificationRequest {}
5365
5366/// Spec: OCPP 2.0.1 · L — Firmware Management · Charging Station → CSMS · CALL.
5367#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5368pub struct PublishFirmwareStatusNotificationResponse {
5369    /// The `customData` member.
5370    #[serde(rename = "customData")]
5371    #[serde(default, skip_serializing_if = "Option::is_none")]
5372    pub custom_data: Option<crate::types::CustomData>,
5373}
5374
5375impl PublishFirmwareStatusNotificationResponse {
5376    /// Creates an empty `PublishFirmwareStatusNotificationResponse`. Every field of this type is optional.
5377    #[must_use]
5378    pub fn new() -> Self {
5379        Self::default()
5380    }
5381
5382    /// Sets the optional `customData` field.
5383    #[must_use]
5384    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5385        self.custom_data = Some(value);
5386        self
5387    }
5388}
5389
5390impl Validate for PublishFirmwareStatusNotificationResponse {
5391    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
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 PublishFirmwareStatusNotificationResponse {}
5401impl Response for PublishFirmwareStatusNotificationResponse {}
5402
5403/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5404#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5405pub struct ReportChargingProfilesRequest {
5406    /// 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.
5407    #[serde(rename = "requestId")]
5408    pub request_id: i32,
5409    /// The `chargingLimitSource` member.
5410    #[serde(rename = "chargingLimitSource")]
5411    pub charging_limit_source: ChargingLimitSource,
5412    /// The `chargingProfile` member.
5413    #[serde(rename = "chargingProfile")]
5414    pub charging_profile: Vec<ChargingProfile>,
5415    /// The evse to which the charging profile applies. If evseId = 0, the message contains an overall limit for the Charging Station.
5416    #[serde(rename = "evseId")]
5417    pub evse_id: i32,
5418    /// To Be Continued. Default value when omitted: false. false indicates that there are no further messages as part of this report.
5419    /// Schema default: `false`.
5420    #[serde(default, skip_serializing_if = "Option::is_none")]
5421    pub tbc: Option<bool>,
5422    /// The `customData` member.
5423    #[serde(rename = "customData")]
5424    #[serde(default, skip_serializing_if = "Option::is_none")]
5425    pub custom_data: Option<crate::types::CustomData>,
5426}
5427
5428impl ReportChargingProfilesRequest {
5429    /// Creates a `ReportChargingProfilesRequest` from its required fields.
5430    #[must_use]
5431    pub fn new(
5432        request_id: i32,
5433        charging_limit_source: ChargingLimitSource,
5434        charging_profile: Vec<ChargingProfile>,
5435        evse_id: i32,
5436    ) -> Self {
5437        Self {
5438            request_id,
5439            charging_limit_source,
5440            charging_profile,
5441            evse_id,
5442            tbc: None,
5443            custom_data: None,
5444        }
5445    }
5446
5447    /// Sets the optional `tbc` field.
5448    #[must_use]
5449    pub fn with_tbc(mut self, value: bool) -> Self {
5450        self.tbc = Some(value);
5451        self
5452    }
5453
5454    /// Sets the optional `customData` field.
5455    #[must_use]
5456    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5457        self.custom_data = Some(value);
5458        self
5459    }
5460}
5461
5462impl Validate for ReportChargingProfilesRequest {
5463    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5464        path.push_key("chargingLimitSource");
5465        Validate::validate_at(&self.charging_limit_source, path, out);
5466        path.pop();
5467        path.push_key("chargingProfile");
5468        validate::list_len(self.charging_profile.len(), Some(1), None, path, out);
5469        for (index, item) in self.charging_profile.iter().enumerate() {
5470            path.push_index(index);
5471            Validate::validate_at(item, path, out);
5472            path.pop();
5473        }
5474        path.pop();
5475        path.push_key("customData");
5476        if let Some(value) = &self.custom_data {
5477            Validate::validate_at(value, path, out);
5478        }
5479        path.pop();
5480    }
5481}
5482
5483impl Sealed for ReportChargingProfilesRequest {}
5484impl Request for ReportChargingProfilesRequest {
5485    type Action = Action;
5486    const ACTION: Action = Action::ReportChargingProfiles;
5487    const KIND: MessageKind = MessageKind::Call;
5488    const ORIGIN: Origin = Origin::ChargingStation;
5489    type Response = ReportChargingProfilesResponse;
5490}
5491
5492impl Confirmed for ReportChargingProfilesRequest {}
5493
5494/// Spec: OCPP 2.0.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5495#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5496pub struct ReportChargingProfilesResponse {
5497    /// The `customData` member.
5498    #[serde(rename = "customData")]
5499    #[serde(default, skip_serializing_if = "Option::is_none")]
5500    pub custom_data: Option<crate::types::CustomData>,
5501}
5502
5503impl ReportChargingProfilesResponse {
5504    /// Creates an empty `ReportChargingProfilesResponse`. Every field of this type is optional.
5505    #[must_use]
5506    pub fn new() -> Self {
5507        Self::default()
5508    }
5509
5510    /// Sets the optional `customData` field.
5511    #[must_use]
5512    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5513        self.custom_data = Some(value);
5514        self
5515    }
5516}
5517
5518impl Validate for ReportChargingProfilesResponse {
5519    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5520        path.push_key("customData");
5521        if let Some(value) = &self.custom_data {
5522            Validate::validate_at(value, path, out);
5523        }
5524        path.pop();
5525    }
5526}
5527
5528impl Sealed for ReportChargingProfilesResponse {}
5529impl Response for ReportChargingProfilesResponse {}
5530
5531/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
5532#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5533pub struct RequestStartTransactionRequest {
5534    /// The `idToken` member.
5535    #[serde(rename = "idToken")]
5536    pub id_token: IdToken,
5537    /// Id given by the server to this start request. The Charging Station might 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.
5538    #[serde(rename = "remoteStartId")]
5539    pub remote_start_id: i32,
5540    /// Number of the EVSE on which to start the transaction. EvseId SHALL be &gt; 0
5541    #[serde(rename = "evseId")]
5542    #[serde(default, skip_serializing_if = "Option::is_none")]
5543    pub evse_id: Option<i32>,
5544    /// The `groupIdToken` member.
5545    #[serde(rename = "groupIdToken")]
5546    #[serde(default, skip_serializing_if = "Option::is_none")]
5547    pub group_id_token: Option<IdToken>,
5548    /// The `chargingProfile` member.
5549    #[serde(rename = "chargingProfile")]
5550    #[serde(default, skip_serializing_if = "Option::is_none")]
5551    pub charging_profile: Option<ChargingProfile>,
5552    /// The `customData` member.
5553    #[serde(rename = "customData")]
5554    #[serde(default, skip_serializing_if = "Option::is_none")]
5555    pub custom_data: Option<crate::types::CustomData>,
5556}
5557
5558impl RequestStartTransactionRequest {
5559    /// Creates a `RequestStartTransactionRequest` from its required fields.
5560    #[must_use]
5561    pub fn new(id_token: IdToken, remote_start_id: i32) -> Self {
5562        Self {
5563            id_token,
5564            remote_start_id,
5565            evse_id: None,
5566            group_id_token: None,
5567            charging_profile: None,
5568            custom_data: None,
5569        }
5570    }
5571
5572    /// Sets the optional `evseId` field.
5573    #[must_use]
5574    pub fn with_evse_id(mut self, value: i32) -> Self {
5575        self.evse_id = Some(value);
5576        self
5577    }
5578
5579    /// Sets the optional `groupIdToken` field.
5580    #[must_use]
5581    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
5582        self.group_id_token = Some(value);
5583        self
5584    }
5585
5586    /// Sets the optional `chargingProfile` field.
5587    #[must_use]
5588    pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
5589        self.charging_profile = Some(value);
5590        self
5591    }
5592
5593    /// Sets the optional `customData` field.
5594    #[must_use]
5595    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5596        self.custom_data = Some(value);
5597        self
5598    }
5599}
5600
5601impl Validate for RequestStartTransactionRequest {
5602    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5603        path.push_key("idToken");
5604        Validate::validate_at(&self.id_token, path, out);
5605        path.pop();
5606        path.push_key("groupIdToken");
5607        if let Some(value) = &self.group_id_token {
5608            Validate::validate_at(value, path, out);
5609        }
5610        path.pop();
5611        path.push_key("chargingProfile");
5612        if let Some(value) = &self.charging_profile {
5613            Validate::validate_at(value, path, out);
5614        }
5615        path.pop();
5616        path.push_key("customData");
5617        if let Some(value) = &self.custom_data {
5618            Validate::validate_at(value, path, out);
5619        }
5620        path.pop();
5621    }
5622}
5623
5624impl Sealed for RequestStartTransactionRequest {}
5625impl Request for RequestStartTransactionRequest {
5626    type Action = Action;
5627    const ACTION: Action = Action::RequestStartTransaction;
5628    const KIND: MessageKind = MessageKind::Call;
5629    const ORIGIN: Origin = Origin::Csms;
5630    type Response = RequestStartTransactionResponse;
5631}
5632
5633impl Confirmed for RequestStartTransactionRequest {}
5634
5635/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
5636#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5637pub struct RequestStartTransactionResponse {
5638    /// The `status` member.
5639    pub status: RequestStartStopStatus,
5640    /// The `statusInfo` member.
5641    #[serde(rename = "statusInfo")]
5642    #[serde(default, skip_serializing_if = "Option::is_none")]
5643    pub status_info: Option<StatusInfo>,
5644    /// 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.
5645    #[serde(rename = "transactionId")]
5646    #[serde(default, skip_serializing_if = "Option::is_none")]
5647    pub transaction_id: Option<String>,
5648    /// The `customData` member.
5649    #[serde(rename = "customData")]
5650    #[serde(default, skip_serializing_if = "Option::is_none")]
5651    pub custom_data: Option<crate::types::CustomData>,
5652}
5653
5654impl RequestStartTransactionResponse {
5655    /// Creates a `RequestStartTransactionResponse` from its required fields.
5656    #[must_use]
5657    pub fn new(status: RequestStartStopStatus) -> Self {
5658        Self {
5659            status,
5660            status_info: None,
5661            transaction_id: None,
5662            custom_data: None,
5663        }
5664    }
5665
5666    /// Sets the optional `statusInfo` field.
5667    #[must_use]
5668    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5669        self.status_info = Some(value);
5670        self
5671    }
5672
5673    /// Sets the optional `transactionId` field.
5674    #[must_use]
5675    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5676        self.transaction_id = Some(value.into());
5677        self
5678    }
5679
5680    /// Sets the optional `customData` field.
5681    #[must_use]
5682    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5683        self.custom_data = Some(value);
5684        self
5685    }
5686}
5687
5688impl Validate for RequestStartTransactionResponse {
5689    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5690        path.push_key("status");
5691        Validate::validate_at(&self.status, path, out);
5692        path.pop();
5693        path.push_key("statusInfo");
5694        if let Some(value) = &self.status_info {
5695            Validate::validate_at(value, path, out);
5696        }
5697        path.pop();
5698        path.push_key("transactionId");
5699        if let Some(value) = &self.transaction_id {
5700            validate::string(value.as_str(), None, Some(36), path, out);
5701        }
5702        path.pop();
5703        path.push_key("customData");
5704        if let Some(value) = &self.custom_data {
5705            Validate::validate_at(value, path, out);
5706        }
5707        path.pop();
5708    }
5709}
5710
5711impl Sealed for RequestStartTransactionResponse {}
5712impl Response for RequestStartTransactionResponse {}
5713
5714/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
5715#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5716pub struct RequestStopTransactionRequest {
5717    /// The identifier of the transaction which the Charging Station is requested to stop.
5718    #[serde(rename = "transactionId")]
5719    pub transaction_id: String,
5720    /// The `customData` member.
5721    #[serde(rename = "customData")]
5722    #[serde(default, skip_serializing_if = "Option::is_none")]
5723    pub custom_data: Option<crate::types::CustomData>,
5724}
5725
5726impl RequestStopTransactionRequest {
5727    /// Creates a `RequestStopTransactionRequest` from its required fields.
5728    #[must_use]
5729    pub fn new(transaction_id: impl Into<String>) -> Self {
5730        Self {
5731            transaction_id: transaction_id.into(),
5732            custom_data: None,
5733        }
5734    }
5735
5736    /// Sets the optional `customData` field.
5737    #[must_use]
5738    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5739        self.custom_data = Some(value);
5740        self
5741    }
5742}
5743
5744impl Validate for RequestStopTransactionRequest {
5745    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5746        path.push_key("transactionId");
5747        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
5748        path.pop();
5749        path.push_key("customData");
5750        if let Some(value) = &self.custom_data {
5751            Validate::validate_at(value, path, out);
5752        }
5753        path.pop();
5754    }
5755}
5756
5757impl Sealed for RequestStopTransactionRequest {}
5758impl Request for RequestStopTransactionRequest {
5759    type Action = Action;
5760    const ACTION: Action = Action::RequestStopTransaction;
5761    const KIND: MessageKind = MessageKind::Call;
5762    const ORIGIN: Origin = Origin::Csms;
5763    type Response = RequestStopTransactionResponse;
5764}
5765
5766impl Confirmed for RequestStopTransactionRequest {}
5767
5768/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
5769#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5770pub struct RequestStopTransactionResponse {
5771    /// The `status` member.
5772    pub status: RequestStartStopStatus,
5773    /// The `statusInfo` member.
5774    #[serde(rename = "statusInfo")]
5775    #[serde(default, skip_serializing_if = "Option::is_none")]
5776    pub status_info: Option<StatusInfo>,
5777    /// The `customData` member.
5778    #[serde(rename = "customData")]
5779    #[serde(default, skip_serializing_if = "Option::is_none")]
5780    pub custom_data: Option<crate::types::CustomData>,
5781}
5782
5783impl RequestStopTransactionResponse {
5784    /// Creates a `RequestStopTransactionResponse` from its required fields.
5785    #[must_use]
5786    pub fn new(status: RequestStartStopStatus) -> Self {
5787        Self {
5788            status,
5789            status_info: None,
5790            custom_data: None,
5791        }
5792    }
5793
5794    /// Sets the optional `statusInfo` field.
5795    #[must_use]
5796    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5797        self.status_info = Some(value);
5798        self
5799    }
5800
5801    /// Sets the optional `customData` field.
5802    #[must_use]
5803    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5804        self.custom_data = Some(value);
5805        self
5806    }
5807}
5808
5809impl Validate for RequestStopTransactionResponse {
5810    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5811        path.push_key("status");
5812        Validate::validate_at(&self.status, path, out);
5813        path.pop();
5814        path.push_key("statusInfo");
5815        if let Some(value) = &self.status_info {
5816            Validate::validate_at(value, path, out);
5817        }
5818        path.pop();
5819        path.push_key("customData");
5820        if let Some(value) = &self.custom_data {
5821            Validate::validate_at(value, path, out);
5822        }
5823        path.pop();
5824    }
5825}
5826
5827impl Sealed for RequestStopTransactionResponse {}
5828impl Response for RequestStopTransactionResponse {}
5829
5830/// Spec: OCPP 2.0.1 · H — Reservation · Charging Station → CSMS · CALL.
5831#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5832pub struct ReservationStatusUpdateRequest {
5833    /// The ID of the reservation.
5834    #[serde(rename = "reservationId")]
5835    pub reservation_id: i32,
5836    /// The `reservationUpdateStatus` member.
5837    #[serde(rename = "reservationUpdateStatus")]
5838    pub reservation_update_status: ReservationUpdateStatus,
5839    /// The `customData` member.
5840    #[serde(rename = "customData")]
5841    #[serde(default, skip_serializing_if = "Option::is_none")]
5842    pub custom_data: Option<crate::types::CustomData>,
5843}
5844
5845impl ReservationStatusUpdateRequest {
5846    /// Creates a `ReservationStatusUpdateRequest` from its required fields.
5847    #[must_use]
5848    pub fn new(reservation_id: i32, reservation_update_status: ReservationUpdateStatus) -> Self {
5849        Self {
5850            reservation_id,
5851            reservation_update_status,
5852            custom_data: None,
5853        }
5854    }
5855
5856    /// Sets the optional `customData` field.
5857    #[must_use]
5858    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5859        self.custom_data = Some(value);
5860        self
5861    }
5862}
5863
5864impl Validate for ReservationStatusUpdateRequest {
5865    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5866        path.push_key("reservationUpdateStatus");
5867        Validate::validate_at(&self.reservation_update_status, path, out);
5868        path.pop();
5869        path.push_key("customData");
5870        if let Some(value) = &self.custom_data {
5871            Validate::validate_at(value, path, out);
5872        }
5873        path.pop();
5874    }
5875}
5876
5877impl Sealed for ReservationStatusUpdateRequest {}
5878impl Request for ReservationStatusUpdateRequest {
5879    type Action = Action;
5880    const ACTION: Action = Action::ReservationStatusUpdate;
5881    const KIND: MessageKind = MessageKind::Call;
5882    const ORIGIN: Origin = Origin::ChargingStation;
5883    type Response = ReservationStatusUpdateResponse;
5884}
5885
5886impl Confirmed for ReservationStatusUpdateRequest {}
5887
5888/// Spec: OCPP 2.0.1 · H — Reservation · Charging Station → CSMS · CALL.
5889#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5890pub struct ReservationStatusUpdateResponse {
5891    /// The `customData` member.
5892    #[serde(rename = "customData")]
5893    #[serde(default, skip_serializing_if = "Option::is_none")]
5894    pub custom_data: Option<crate::types::CustomData>,
5895}
5896
5897impl ReservationStatusUpdateResponse {
5898    /// Creates an empty `ReservationStatusUpdateResponse`. Every field of this type is optional.
5899    #[must_use]
5900    pub fn new() -> Self {
5901        Self::default()
5902    }
5903
5904    /// Sets the optional `customData` field.
5905    #[must_use]
5906    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5907        self.custom_data = Some(value);
5908        self
5909    }
5910}
5911
5912impl Validate for ReservationStatusUpdateResponse {
5913    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5914        path.push_key("customData");
5915        if let Some(value) = &self.custom_data {
5916            Validate::validate_at(value, path, out);
5917        }
5918        path.pop();
5919    }
5920}
5921
5922impl Sealed for ReservationStatusUpdateResponse {}
5923impl Response for ReservationStatusUpdateResponse {}
5924
5925/// Spec: OCPP 2.0.1 · H — Reservation · CSMS → Charging Station · CALL.
5926#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5927pub struct ReserveNowRequest {
5928    /// Id of reservation.
5929    pub id: i32,
5930    /// Date and time at which the reservation expires.
5931    #[serde(rename = "expiryDateTime")]
5932    pub expiry_date_time: crate::types::DateTime,
5933    /// The `idToken` member.
5934    #[serde(rename = "idToken")]
5935    pub id_token: IdToken,
5936    /// The `connectorType` member.
5937    #[serde(rename = "connectorType")]
5938    #[serde(default, skip_serializing_if = "Option::is_none")]
5939    pub connector_type: Option<Connector>,
5940    /// This contains ID of the evse to be reserved.
5941    #[serde(rename = "evseId")]
5942    #[serde(default, skip_serializing_if = "Option::is_none")]
5943    pub evse_id: Option<i32>,
5944    /// The `groupIdToken` member.
5945    #[serde(rename = "groupIdToken")]
5946    #[serde(default, skip_serializing_if = "Option::is_none")]
5947    pub group_id_token: Option<IdToken>,
5948    /// The `customData` member.
5949    #[serde(rename = "customData")]
5950    #[serde(default, skip_serializing_if = "Option::is_none")]
5951    pub custom_data: Option<crate::types::CustomData>,
5952}
5953
5954impl ReserveNowRequest {
5955    /// Creates a `ReserveNowRequest` from its required fields.
5956    #[must_use]
5957    pub fn new(
5958        id: i32,
5959        expiry_date_time: impl Into<crate::types::DateTime>,
5960        id_token: IdToken,
5961    ) -> Self {
5962        Self {
5963            id,
5964            expiry_date_time: expiry_date_time.into(),
5965            id_token,
5966            connector_type: None,
5967            evse_id: None,
5968            group_id_token: None,
5969            custom_data: None,
5970        }
5971    }
5972
5973    /// Sets the optional `connectorType` field.
5974    #[must_use]
5975    pub fn with_connector_type(mut self, value: Connector) -> Self {
5976        self.connector_type = Some(value);
5977        self
5978    }
5979
5980    /// Sets the optional `evseId` field.
5981    #[must_use]
5982    pub fn with_evse_id(mut self, value: i32) -> Self {
5983        self.evse_id = Some(value);
5984        self
5985    }
5986
5987    /// Sets the optional `groupIdToken` field.
5988    #[must_use]
5989    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
5990        self.group_id_token = Some(value);
5991        self
5992    }
5993
5994    /// Sets the optional `customData` field.
5995    #[must_use]
5996    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5997        self.custom_data = Some(value);
5998        self
5999    }
6000}
6001
6002impl Validate for ReserveNowRequest {
6003    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6004        path.push_key("idToken");
6005        Validate::validate_at(&self.id_token, path, out);
6006        path.pop();
6007        path.push_key("connectorType");
6008        if let Some(value) = &self.connector_type {
6009            Validate::validate_at(value, path, out);
6010        }
6011        path.pop();
6012        path.push_key("groupIdToken");
6013        if let Some(value) = &self.group_id_token {
6014            Validate::validate_at(value, path, out);
6015        }
6016        path.pop();
6017        path.push_key("customData");
6018        if let Some(value) = &self.custom_data {
6019            Validate::validate_at(value, path, out);
6020        }
6021        path.pop();
6022    }
6023}
6024
6025impl Sealed for ReserveNowRequest {}
6026impl Request for ReserveNowRequest {
6027    type Action = Action;
6028    const ACTION: Action = Action::ReserveNow;
6029    const KIND: MessageKind = MessageKind::Call;
6030    const ORIGIN: Origin = Origin::Csms;
6031    type Response = ReserveNowResponse;
6032}
6033
6034impl Confirmed for ReserveNowRequest {}
6035
6036/// Spec: OCPP 2.0.1 · H — Reservation · CSMS → Charging Station · CALL.
6037#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6038pub struct ReserveNowResponse {
6039    /// The `status` member.
6040    pub status: ReserveNowStatus,
6041    /// The `statusInfo` member.
6042    #[serde(rename = "statusInfo")]
6043    #[serde(default, skip_serializing_if = "Option::is_none")]
6044    pub status_info: Option<StatusInfo>,
6045    /// The `customData` member.
6046    #[serde(rename = "customData")]
6047    #[serde(default, skip_serializing_if = "Option::is_none")]
6048    pub custom_data: Option<crate::types::CustomData>,
6049}
6050
6051impl ReserveNowResponse {
6052    /// Creates a `ReserveNowResponse` from its required fields.
6053    #[must_use]
6054    pub fn new(status: ReserveNowStatus) -> Self {
6055        Self {
6056            status,
6057            status_info: None,
6058            custom_data: None,
6059        }
6060    }
6061
6062    /// Sets the optional `statusInfo` field.
6063    #[must_use]
6064    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6065        self.status_info = Some(value);
6066        self
6067    }
6068
6069    /// Sets the optional `customData` field.
6070    #[must_use]
6071    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6072        self.custom_data = Some(value);
6073        self
6074    }
6075}
6076
6077impl Validate for ReserveNowResponse {
6078    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6079        path.push_key("status");
6080        Validate::validate_at(&self.status, path, out);
6081        path.pop();
6082        path.push_key("statusInfo");
6083        if let Some(value) = &self.status_info {
6084            Validate::validate_at(value, path, out);
6085        }
6086        path.pop();
6087        path.push_key("customData");
6088        if let Some(value) = &self.custom_data {
6089            Validate::validate_at(value, path, out);
6090        }
6091        path.pop();
6092    }
6093}
6094
6095impl Sealed for ReserveNowResponse {}
6096impl Response for ReserveNowResponse {}
6097
6098/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
6099#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6100pub struct ResetRequest {
6101    /// The `type` member.
6102    pub r#type: ResetEnum,
6103    /// This contains the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
6104    #[serde(rename = "evseId")]
6105    #[serde(default, skip_serializing_if = "Option::is_none")]
6106    pub evse_id: Option<i32>,
6107    /// The `customData` member.
6108    #[serde(rename = "customData")]
6109    #[serde(default, skip_serializing_if = "Option::is_none")]
6110    pub custom_data: Option<crate::types::CustomData>,
6111}
6112
6113impl ResetRequest {
6114    /// Creates a `ResetRequest` from its required fields.
6115    #[must_use]
6116    pub fn new(r#type: ResetEnum) -> Self {
6117        Self {
6118            r#type,
6119            evse_id: None,
6120            custom_data: None,
6121        }
6122    }
6123
6124    /// Sets the optional `evseId` field.
6125    #[must_use]
6126    pub fn with_evse_id(mut self, value: i32) -> Self {
6127        self.evse_id = Some(value);
6128        self
6129    }
6130
6131    /// Sets the optional `customData` field.
6132    #[must_use]
6133    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6134        self.custom_data = Some(value);
6135        self
6136    }
6137}
6138
6139impl Validate for ResetRequest {
6140    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6141        path.push_key("type");
6142        Validate::validate_at(&self.r#type, path, out);
6143        path.pop();
6144        path.push_key("customData");
6145        if let Some(value) = &self.custom_data {
6146            Validate::validate_at(value, path, out);
6147        }
6148        path.pop();
6149    }
6150}
6151
6152impl Sealed for ResetRequest {}
6153impl Request for ResetRequest {
6154    type Action = Action;
6155    const ACTION: Action = Action::Reset;
6156    const KIND: MessageKind = MessageKind::Call;
6157    const ORIGIN: Origin = Origin::Csms;
6158    type Response = ResetResponse;
6159}
6160
6161impl Confirmed for ResetRequest {}
6162
6163/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
6164#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6165pub struct ResetResponse {
6166    /// The `status` member.
6167    pub status: ResetStatus,
6168    /// The `statusInfo` member.
6169    #[serde(rename = "statusInfo")]
6170    #[serde(default, skip_serializing_if = "Option::is_none")]
6171    pub status_info: Option<StatusInfo>,
6172    /// The `customData` member.
6173    #[serde(rename = "customData")]
6174    #[serde(default, skip_serializing_if = "Option::is_none")]
6175    pub custom_data: Option<crate::types::CustomData>,
6176}
6177
6178impl ResetResponse {
6179    /// Creates a `ResetResponse` from its required fields.
6180    #[must_use]
6181    pub fn new(status: ResetStatus) -> Self {
6182        Self {
6183            status,
6184            status_info: None,
6185            custom_data: None,
6186        }
6187    }
6188
6189    /// Sets the optional `statusInfo` field.
6190    #[must_use]
6191    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6192        self.status_info = Some(value);
6193        self
6194    }
6195
6196    /// Sets the optional `customData` field.
6197    #[must_use]
6198    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6199        self.custom_data = Some(value);
6200        self
6201    }
6202}
6203
6204impl Validate for ResetResponse {
6205    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6206        path.push_key("status");
6207        Validate::validate_at(&self.status, path, out);
6208        path.pop();
6209        path.push_key("statusInfo");
6210        if let Some(value) = &self.status_info {
6211            Validate::validate_at(value, path, out);
6212        }
6213        path.pop();
6214        path.push_key("customData");
6215        if let Some(value) = &self.custom_data {
6216            Validate::validate_at(value, path, out);
6217        }
6218        path.pop();
6219    }
6220}
6221
6222impl Sealed for ResetResponse {}
6223impl Response for ResetResponse {}
6224
6225/// Spec: OCPP 2.0.1 · A — Security · Charging Station → CSMS · CALL.
6226#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6227pub struct SecurityEventNotificationRequest {
6228    /// Type of the security event. This value should be taken from the Security events list.
6229    pub r#type: String,
6230    /// Date and time at which the event occurred.
6231    pub timestamp: crate::types::DateTime,
6232    /// Additional information about the occurred security event.
6233    #[serde(rename = "techInfo")]
6234    #[serde(default, skip_serializing_if = "Option::is_none")]
6235    pub tech_info: Option<String>,
6236    /// The `customData` member.
6237    #[serde(rename = "customData")]
6238    #[serde(default, skip_serializing_if = "Option::is_none")]
6239    pub custom_data: Option<crate::types::CustomData>,
6240}
6241
6242impl SecurityEventNotificationRequest {
6243    /// Creates a `SecurityEventNotificationRequest` from its required fields.
6244    #[must_use]
6245    pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
6246        Self {
6247            r#type: r#type.into(),
6248            timestamp: timestamp.into(),
6249            tech_info: None,
6250            custom_data: None,
6251        }
6252    }
6253
6254    /// Sets the optional `techInfo` field.
6255    #[must_use]
6256    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
6257        self.tech_info = Some(value.into());
6258        self
6259    }
6260
6261    /// Sets the optional `customData` field.
6262    #[must_use]
6263    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6264        self.custom_data = Some(value);
6265        self
6266    }
6267}
6268
6269impl Validate for SecurityEventNotificationRequest {
6270    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6271        path.push_key("type");
6272        validate::string(self.r#type.as_str(), None, Some(50), path, out);
6273        path.pop();
6274        path.push_key("techInfo");
6275        if let Some(value) = &self.tech_info {
6276            validate::string(value.as_str(), None, Some(255), path, out);
6277        }
6278        path.pop();
6279        path.push_key("customData");
6280        if let Some(value) = &self.custom_data {
6281            Validate::validate_at(value, path, out);
6282        }
6283        path.pop();
6284    }
6285}
6286
6287impl Sealed for SecurityEventNotificationRequest {}
6288impl Request for SecurityEventNotificationRequest {
6289    type Action = Action;
6290    const ACTION: Action = Action::SecurityEventNotification;
6291    const KIND: MessageKind = MessageKind::Call;
6292    const ORIGIN: Origin = Origin::ChargingStation;
6293    type Response = SecurityEventNotificationResponse;
6294}
6295
6296impl Confirmed for SecurityEventNotificationRequest {}
6297
6298/// Spec: OCPP 2.0.1 · A — Security · Charging Station → CSMS · CALL.
6299#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6300pub struct SecurityEventNotificationResponse {
6301    /// The `customData` member.
6302    #[serde(rename = "customData")]
6303    #[serde(default, skip_serializing_if = "Option::is_none")]
6304    pub custom_data: Option<crate::types::CustomData>,
6305}
6306
6307impl SecurityEventNotificationResponse {
6308    /// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
6309    #[must_use]
6310    pub fn new() -> Self {
6311        Self::default()
6312    }
6313
6314    /// Sets the optional `customData` field.
6315    #[must_use]
6316    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6317        self.custom_data = Some(value);
6318        self
6319    }
6320}
6321
6322impl Validate for SecurityEventNotificationResponse {
6323    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6324        path.push_key("customData");
6325        if let Some(value) = &self.custom_data {
6326            Validate::validate_at(value, path, out);
6327        }
6328        path.pop();
6329    }
6330}
6331
6332impl Sealed for SecurityEventNotificationResponse {}
6333impl Response for SecurityEventNotificationResponse {}
6334
6335/// Spec: OCPP 2.0.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
6336#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6337pub struct SendLocalListRequest {
6338    /// 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.
6339    #[serde(rename = "versionNumber")]
6340    pub version_number: i32,
6341    /// The `updateType` member.
6342    #[serde(rename = "updateType")]
6343    pub update_type: Update,
6344    /// The `localAuthorizationList` member.
6345    #[serde(rename = "localAuthorizationList")]
6346    #[serde(default, skip_serializing_if = "Option::is_none")]
6347    pub local_authorization_list: Option<Vec<AuthorizationData>>,
6348    /// The `customData` member.
6349    #[serde(rename = "customData")]
6350    #[serde(default, skip_serializing_if = "Option::is_none")]
6351    pub custom_data: Option<crate::types::CustomData>,
6352}
6353
6354impl SendLocalListRequest {
6355    /// Creates a `SendLocalListRequest` from its required fields.
6356    #[must_use]
6357    pub fn new(version_number: i32, update_type: Update) -> Self {
6358        Self {
6359            version_number,
6360            update_type,
6361            local_authorization_list: None,
6362            custom_data: None,
6363        }
6364    }
6365
6366    /// Sets the optional `localAuthorizationList` field.
6367    #[must_use]
6368    pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
6369        self.local_authorization_list = Some(value);
6370        self
6371    }
6372
6373    /// Sets the optional `customData` field.
6374    #[must_use]
6375    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6376        self.custom_data = Some(value);
6377        self
6378    }
6379}
6380
6381impl Validate for SendLocalListRequest {
6382    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6383        path.push_key("updateType");
6384        Validate::validate_at(&self.update_type, path, out);
6385        path.pop();
6386        path.push_key("localAuthorizationList");
6387        if let Some(value) = &self.local_authorization_list {
6388            validate::list_len(value.len(), Some(1), None, path, out);
6389            for (index, item) in value.iter().enumerate() {
6390                path.push_index(index);
6391                Validate::validate_at(item, path, out);
6392                path.pop();
6393            }
6394        }
6395        path.pop();
6396        path.push_key("customData");
6397        if let Some(value) = &self.custom_data {
6398            Validate::validate_at(value, path, out);
6399        }
6400        path.pop();
6401    }
6402}
6403
6404impl Sealed for SendLocalListRequest {}
6405impl Request for SendLocalListRequest {
6406    type Action = Action;
6407    const ACTION: Action = Action::SendLocalList;
6408    const KIND: MessageKind = MessageKind::Call;
6409    const ORIGIN: Origin = Origin::Csms;
6410    type Response = SendLocalListResponse;
6411}
6412
6413impl Confirmed for SendLocalListRequest {}
6414
6415/// Spec: OCPP 2.0.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
6416#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6417pub struct SendLocalListResponse {
6418    /// The `status` member.
6419    pub status: SendLocalListStatus,
6420    /// The `statusInfo` member.
6421    #[serde(rename = "statusInfo")]
6422    #[serde(default, skip_serializing_if = "Option::is_none")]
6423    pub status_info: Option<StatusInfo>,
6424    /// The `customData` member.
6425    #[serde(rename = "customData")]
6426    #[serde(default, skip_serializing_if = "Option::is_none")]
6427    pub custom_data: Option<crate::types::CustomData>,
6428}
6429
6430impl SendLocalListResponse {
6431    /// Creates a `SendLocalListResponse` from its required fields.
6432    #[must_use]
6433    pub fn new(status: SendLocalListStatus) -> Self {
6434        Self {
6435            status,
6436            status_info: None,
6437            custom_data: None,
6438        }
6439    }
6440
6441    /// Sets the optional `statusInfo` field.
6442    #[must_use]
6443    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6444        self.status_info = Some(value);
6445        self
6446    }
6447
6448    /// Sets the optional `customData` field.
6449    #[must_use]
6450    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6451        self.custom_data = Some(value);
6452        self
6453    }
6454}
6455
6456impl Validate for SendLocalListResponse {
6457    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6458        path.push_key("status");
6459        Validate::validate_at(&self.status, path, out);
6460        path.pop();
6461        path.push_key("statusInfo");
6462        if let Some(value) = &self.status_info {
6463            Validate::validate_at(value, path, out);
6464        }
6465        path.pop();
6466        path.push_key("customData");
6467        if let Some(value) = &self.custom_data {
6468            Validate::validate_at(value, path, out);
6469        }
6470        path.pop();
6471    }
6472}
6473
6474impl Sealed for SendLocalListResponse {}
6475impl Response for SendLocalListResponse {}
6476
6477/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
6478#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6479pub struct SetChargingProfileRequest {
6480    /// 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.
6481    #[serde(rename = "evseId")]
6482    pub evse_id: i32,
6483    /// The `chargingProfile` member.
6484    #[serde(rename = "chargingProfile")]
6485    pub charging_profile: ChargingProfile,
6486    /// The `customData` member.
6487    #[serde(rename = "customData")]
6488    #[serde(default, skip_serializing_if = "Option::is_none")]
6489    pub custom_data: Option<crate::types::CustomData>,
6490}
6491
6492impl SetChargingProfileRequest {
6493    /// Creates a `SetChargingProfileRequest` from its required fields.
6494    #[must_use]
6495    pub fn new(evse_id: i32, charging_profile: ChargingProfile) -> Self {
6496        Self {
6497            evse_id,
6498            charging_profile,
6499            custom_data: None,
6500        }
6501    }
6502
6503    /// Sets the optional `customData` field.
6504    #[must_use]
6505    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6506        self.custom_data = Some(value);
6507        self
6508    }
6509}
6510
6511impl Validate for SetChargingProfileRequest {
6512    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6513        path.push_key("chargingProfile");
6514        Validate::validate_at(&self.charging_profile, path, out);
6515        path.pop();
6516        path.push_key("customData");
6517        if let Some(value) = &self.custom_data {
6518            Validate::validate_at(value, path, out);
6519        }
6520        path.pop();
6521    }
6522}
6523
6524impl Sealed for SetChargingProfileRequest {}
6525impl Request for SetChargingProfileRequest {
6526    type Action = Action;
6527    const ACTION: Action = Action::SetChargingProfile;
6528    const KIND: MessageKind = MessageKind::Call;
6529    const ORIGIN: Origin = Origin::Csms;
6530    type Response = SetChargingProfileResponse;
6531}
6532
6533impl Confirmed for SetChargingProfileRequest {}
6534
6535/// Spec: OCPP 2.0.1 · K — Smart Charging · CSMS → Charging Station · CALL.
6536#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6537pub struct SetChargingProfileResponse {
6538    /// The `status` member.
6539    pub status: ChargingProfileStatus,
6540    /// The `statusInfo` member.
6541    #[serde(rename = "statusInfo")]
6542    #[serde(default, skip_serializing_if = "Option::is_none")]
6543    pub status_info: Option<StatusInfo>,
6544    /// The `customData` member.
6545    #[serde(rename = "customData")]
6546    #[serde(default, skip_serializing_if = "Option::is_none")]
6547    pub custom_data: Option<crate::types::CustomData>,
6548}
6549
6550impl SetChargingProfileResponse {
6551    /// Creates a `SetChargingProfileResponse` from its required fields.
6552    #[must_use]
6553    pub fn new(status: ChargingProfileStatus) -> Self {
6554        Self {
6555            status,
6556            status_info: None,
6557            custom_data: None,
6558        }
6559    }
6560
6561    /// Sets the optional `statusInfo` field.
6562    #[must_use]
6563    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6564        self.status_info = Some(value);
6565        self
6566    }
6567
6568    /// Sets the optional `customData` field.
6569    #[must_use]
6570    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6571        self.custom_data = Some(value);
6572        self
6573    }
6574}
6575
6576impl Validate for SetChargingProfileResponse {
6577    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6578        path.push_key("status");
6579        Validate::validate_at(&self.status, path, out);
6580        path.pop();
6581        path.push_key("statusInfo");
6582        if let Some(value) = &self.status_info {
6583            Validate::validate_at(value, path, out);
6584        }
6585        path.pop();
6586        path.push_key("customData");
6587        if let Some(value) = &self.custom_data {
6588            Validate::validate_at(value, path, out);
6589        }
6590        path.pop();
6591    }
6592}
6593
6594impl Sealed for SetChargingProfileResponse {}
6595impl Response for SetChargingProfileResponse {}
6596
6597/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
6598#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6599pub struct SetDisplayMessageRequest {
6600    /// The `message` member.
6601    pub message: MessageInfo,
6602    /// The `customData` member.
6603    #[serde(rename = "customData")]
6604    #[serde(default, skip_serializing_if = "Option::is_none")]
6605    pub custom_data: Option<crate::types::CustomData>,
6606}
6607
6608impl SetDisplayMessageRequest {
6609    /// Creates a `SetDisplayMessageRequest` from its required fields.
6610    #[must_use]
6611    pub fn new(message: MessageInfo) -> Self {
6612        Self {
6613            message,
6614            custom_data: None,
6615        }
6616    }
6617
6618    /// Sets the optional `customData` field.
6619    #[must_use]
6620    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6621        self.custom_data = Some(value);
6622        self
6623    }
6624}
6625
6626impl Validate for SetDisplayMessageRequest {
6627    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6628        path.push_key("message");
6629        Validate::validate_at(&self.message, path, out);
6630        path.pop();
6631        path.push_key("customData");
6632        if let Some(value) = &self.custom_data {
6633            Validate::validate_at(value, path, out);
6634        }
6635        path.pop();
6636    }
6637}
6638
6639impl Sealed for SetDisplayMessageRequest {}
6640impl Request for SetDisplayMessageRequest {
6641    type Action = Action;
6642    const ACTION: Action = Action::SetDisplayMessage;
6643    const KIND: MessageKind = MessageKind::Call;
6644    const ORIGIN: Origin = Origin::Csms;
6645    type Response = SetDisplayMessageResponse;
6646}
6647
6648impl Confirmed for SetDisplayMessageRequest {}
6649
6650/// Spec: OCPP 2.0.1 · O — Display Message · CSMS → Charging Station · CALL.
6651#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6652pub struct SetDisplayMessageResponse {
6653    /// The `status` member.
6654    pub status: DisplayMessageStatus,
6655    /// The `statusInfo` member.
6656    #[serde(rename = "statusInfo")]
6657    #[serde(default, skip_serializing_if = "Option::is_none")]
6658    pub status_info: Option<StatusInfo>,
6659    /// The `customData` member.
6660    #[serde(rename = "customData")]
6661    #[serde(default, skip_serializing_if = "Option::is_none")]
6662    pub custom_data: Option<crate::types::CustomData>,
6663}
6664
6665impl SetDisplayMessageResponse {
6666    /// Creates a `SetDisplayMessageResponse` from its required fields.
6667    #[must_use]
6668    pub fn new(status: DisplayMessageStatus) -> Self {
6669        Self {
6670            status,
6671            status_info: None,
6672            custom_data: None,
6673        }
6674    }
6675
6676    /// Sets the optional `statusInfo` field.
6677    #[must_use]
6678    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6679        self.status_info = Some(value);
6680        self
6681    }
6682
6683    /// Sets the optional `customData` field.
6684    #[must_use]
6685    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6686        self.custom_data = Some(value);
6687        self
6688    }
6689}
6690
6691impl Validate for SetDisplayMessageResponse {
6692    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6693        path.push_key("status");
6694        Validate::validate_at(&self.status, path, out);
6695        path.pop();
6696        path.push_key("statusInfo");
6697        if let Some(value) = &self.status_info {
6698            Validate::validate_at(value, path, out);
6699        }
6700        path.pop();
6701        path.push_key("customData");
6702        if let Some(value) = &self.custom_data {
6703            Validate::validate_at(value, path, out);
6704        }
6705        path.pop();
6706    }
6707}
6708
6709impl Sealed for SetDisplayMessageResponse {}
6710impl Response for SetDisplayMessageResponse {}
6711
6712/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
6713#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6714pub struct SetMonitoringBaseRequest {
6715    /// The `monitoringBase` member.
6716    #[serde(rename = "monitoringBase")]
6717    pub monitoring_base: MonitoringBase,
6718    /// The `customData` member.
6719    #[serde(rename = "customData")]
6720    #[serde(default, skip_serializing_if = "Option::is_none")]
6721    pub custom_data: Option<crate::types::CustomData>,
6722}
6723
6724impl SetMonitoringBaseRequest {
6725    /// Creates a `SetMonitoringBaseRequest` from its required fields.
6726    #[must_use]
6727    pub fn new(monitoring_base: MonitoringBase) -> Self {
6728        Self {
6729            monitoring_base,
6730            custom_data: None,
6731        }
6732    }
6733
6734    /// Sets the optional `customData` field.
6735    #[must_use]
6736    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6737        self.custom_data = Some(value);
6738        self
6739    }
6740}
6741
6742impl Validate for SetMonitoringBaseRequest {
6743    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6744        path.push_key("monitoringBase");
6745        Validate::validate_at(&self.monitoring_base, path, out);
6746        path.pop();
6747        path.push_key("customData");
6748        if let Some(value) = &self.custom_data {
6749            Validate::validate_at(value, path, out);
6750        }
6751        path.pop();
6752    }
6753}
6754
6755impl Sealed for SetMonitoringBaseRequest {}
6756impl Request for SetMonitoringBaseRequest {
6757    type Action = Action;
6758    const ACTION: Action = Action::SetMonitoringBase;
6759    const KIND: MessageKind = MessageKind::Call;
6760    const ORIGIN: Origin = Origin::Csms;
6761    type Response = SetMonitoringBaseResponse;
6762}
6763
6764impl Confirmed for SetMonitoringBaseRequest {}
6765
6766/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
6767#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6768pub struct SetMonitoringBaseResponse {
6769    /// The `status` member.
6770    pub status: GenericDeviceModelStatus,
6771    /// The `statusInfo` member.
6772    #[serde(rename = "statusInfo")]
6773    #[serde(default, skip_serializing_if = "Option::is_none")]
6774    pub status_info: Option<StatusInfo>,
6775    /// The `customData` member.
6776    #[serde(rename = "customData")]
6777    #[serde(default, skip_serializing_if = "Option::is_none")]
6778    pub custom_data: Option<crate::types::CustomData>,
6779}
6780
6781impl SetMonitoringBaseResponse {
6782    /// Creates a `SetMonitoringBaseResponse` from its required fields.
6783    #[must_use]
6784    pub fn new(status: GenericDeviceModelStatus) -> Self {
6785        Self {
6786            status,
6787            status_info: None,
6788            custom_data: None,
6789        }
6790    }
6791
6792    /// Sets the optional `statusInfo` field.
6793    #[must_use]
6794    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6795        self.status_info = Some(value);
6796        self
6797    }
6798
6799    /// Sets the optional `customData` field.
6800    #[must_use]
6801    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6802        self.custom_data = Some(value);
6803        self
6804    }
6805}
6806
6807impl Validate for SetMonitoringBaseResponse {
6808    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6809        path.push_key("status");
6810        Validate::validate_at(&self.status, path, out);
6811        path.pop();
6812        path.push_key("statusInfo");
6813        if let Some(value) = &self.status_info {
6814            Validate::validate_at(value, path, out);
6815        }
6816        path.pop();
6817        path.push_key("customData");
6818        if let Some(value) = &self.custom_data {
6819            Validate::validate_at(value, path, out);
6820        }
6821        path.pop();
6822    }
6823}
6824
6825impl Sealed for SetMonitoringBaseResponse {}
6826impl Response for SetMonitoringBaseResponse {}
6827
6828/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
6829#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6830pub struct SetMonitoringLevelRequest {
6831    /// The Charging Station SHALL only report events with a severity number lower than or equal to this severity.
6832    /// The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
6833    ///
6834    /// The severity levels have the following meaning: +
6835    /// *0-Danger* +
6836    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
6837    /// *1-Hardware Failure* +
6838    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
6839    /// *2-System Failure* +
6840    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
6841    /// *3-Critical* +
6842    /// Indicates a critical error. Action is required. +
6843    /// *4-Error* +
6844    /// Indicates a non-urgent error. Action is required. +
6845    /// *5-Alert* +
6846    /// Indicates an alert event. Default severity for any type of monitoring event.  +
6847    /// *6-Warning* +
6848    /// Indicates a warning event. Action may be required. +
6849    /// *7-Notice* +
6850    /// Indicates an unusual event. No immediate action is required. +
6851    /// *8-Informational* +
6852    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
6853    /// *9-Debug* +
6854    /// Indicates information useful to developers for debugging, not useful during operations.
6855    pub severity: i32,
6856    /// The `customData` member.
6857    #[serde(rename = "customData")]
6858    #[serde(default, skip_serializing_if = "Option::is_none")]
6859    pub custom_data: Option<crate::types::CustomData>,
6860}
6861
6862impl SetMonitoringLevelRequest {
6863    /// Creates a `SetMonitoringLevelRequest` from its required fields.
6864    #[must_use]
6865    pub fn new(severity: i32) -> Self {
6866        Self {
6867            severity,
6868            custom_data: None,
6869        }
6870    }
6871
6872    /// Sets the optional `customData` field.
6873    #[must_use]
6874    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6875        self.custom_data = Some(value);
6876        self
6877    }
6878}
6879
6880impl Validate for SetMonitoringLevelRequest {
6881    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6882        path.push_key("customData");
6883        if let Some(value) = &self.custom_data {
6884            Validate::validate_at(value, path, out);
6885        }
6886        path.pop();
6887    }
6888}
6889
6890impl Sealed for SetMonitoringLevelRequest {}
6891impl Request for SetMonitoringLevelRequest {
6892    type Action = Action;
6893    const ACTION: Action = Action::SetMonitoringLevel;
6894    const KIND: MessageKind = MessageKind::Call;
6895    const ORIGIN: Origin = Origin::Csms;
6896    type Response = SetMonitoringLevelResponse;
6897}
6898
6899impl Confirmed for SetMonitoringLevelRequest {}
6900
6901/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
6902#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6903pub struct SetMonitoringLevelResponse {
6904    /// The `status` member.
6905    pub status: GenericStatus,
6906    /// The `statusInfo` member.
6907    #[serde(rename = "statusInfo")]
6908    #[serde(default, skip_serializing_if = "Option::is_none")]
6909    pub status_info: Option<StatusInfo>,
6910    /// The `customData` member.
6911    #[serde(rename = "customData")]
6912    #[serde(default, skip_serializing_if = "Option::is_none")]
6913    pub custom_data: Option<crate::types::CustomData>,
6914}
6915
6916impl SetMonitoringLevelResponse {
6917    /// Creates a `SetMonitoringLevelResponse` from its required fields.
6918    #[must_use]
6919    pub fn new(status: GenericStatus) -> Self {
6920        Self {
6921            status,
6922            status_info: None,
6923            custom_data: None,
6924        }
6925    }
6926
6927    /// Sets the optional `statusInfo` field.
6928    #[must_use]
6929    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6930        self.status_info = Some(value);
6931        self
6932    }
6933
6934    /// Sets the optional `customData` field.
6935    #[must_use]
6936    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6937        self.custom_data = Some(value);
6938        self
6939    }
6940}
6941
6942impl Validate for SetMonitoringLevelResponse {
6943    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6944        path.push_key("status");
6945        Validate::validate_at(&self.status, path, out);
6946        path.pop();
6947        path.push_key("statusInfo");
6948        if let Some(value) = &self.status_info {
6949            Validate::validate_at(value, path, out);
6950        }
6951        path.pop();
6952        path.push_key("customData");
6953        if let Some(value) = &self.custom_data {
6954            Validate::validate_at(value, path, out);
6955        }
6956        path.pop();
6957    }
6958}
6959
6960impl Sealed for SetMonitoringLevelResponse {}
6961impl Response for SetMonitoringLevelResponse {}
6962
6963/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
6964#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6965pub struct SetNetworkProfileRequest {
6966    /// Slot in which the configuration should be stored.
6967    #[serde(rename = "configurationSlot")]
6968    pub configuration_slot: i32,
6969    /// The `connectionData` member.
6970    #[serde(rename = "connectionData")]
6971    pub connection_data: NetworkConnectionProfile,
6972    /// The `customData` member.
6973    #[serde(rename = "customData")]
6974    #[serde(default, skip_serializing_if = "Option::is_none")]
6975    pub custom_data: Option<crate::types::CustomData>,
6976}
6977
6978impl SetNetworkProfileRequest {
6979    /// Creates a `SetNetworkProfileRequest` from its required fields.
6980    #[must_use]
6981    pub fn new(configuration_slot: i32, connection_data: NetworkConnectionProfile) -> Self {
6982        Self {
6983            configuration_slot,
6984            connection_data,
6985            custom_data: None,
6986        }
6987    }
6988
6989    /// Sets the optional `customData` field.
6990    #[must_use]
6991    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6992        self.custom_data = Some(value);
6993        self
6994    }
6995}
6996
6997impl Validate for SetNetworkProfileRequest {
6998    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6999        path.push_key("connectionData");
7000        Validate::validate_at(&self.connection_data, path, out);
7001        path.pop();
7002        path.push_key("customData");
7003        if let Some(value) = &self.custom_data {
7004            Validate::validate_at(value, path, out);
7005        }
7006        path.pop();
7007    }
7008}
7009
7010impl Sealed for SetNetworkProfileRequest {}
7011impl Request for SetNetworkProfileRequest {
7012    type Action = Action;
7013    const ACTION: Action = Action::SetNetworkProfile;
7014    const KIND: MessageKind = MessageKind::Call;
7015    const ORIGIN: Origin = Origin::Csms;
7016    type Response = SetNetworkProfileResponse;
7017}
7018
7019impl Confirmed for SetNetworkProfileRequest {}
7020
7021/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
7022#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7023pub struct SetNetworkProfileResponse {
7024    /// The `status` member.
7025    pub status: SetNetworkProfileStatus,
7026    /// The `statusInfo` member.
7027    #[serde(rename = "statusInfo")]
7028    #[serde(default, skip_serializing_if = "Option::is_none")]
7029    pub status_info: Option<StatusInfo>,
7030    /// The `customData` member.
7031    #[serde(rename = "customData")]
7032    #[serde(default, skip_serializing_if = "Option::is_none")]
7033    pub custom_data: Option<crate::types::CustomData>,
7034}
7035
7036impl SetNetworkProfileResponse {
7037    /// Creates a `SetNetworkProfileResponse` from its required fields.
7038    #[must_use]
7039    pub fn new(status: SetNetworkProfileStatus) -> Self {
7040        Self {
7041            status,
7042            status_info: None,
7043            custom_data: None,
7044        }
7045    }
7046
7047    /// Sets the optional `statusInfo` field.
7048    #[must_use]
7049    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7050        self.status_info = Some(value);
7051        self
7052    }
7053
7054    /// Sets the optional `customData` field.
7055    #[must_use]
7056    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7057        self.custom_data = Some(value);
7058        self
7059    }
7060}
7061
7062impl Validate for SetNetworkProfileResponse {
7063    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7064        path.push_key("status");
7065        Validate::validate_at(&self.status, path, out);
7066        path.pop();
7067        path.push_key("statusInfo");
7068        if let Some(value) = &self.status_info {
7069            Validate::validate_at(value, path, out);
7070        }
7071        path.pop();
7072        path.push_key("customData");
7073        if let Some(value) = &self.custom_data {
7074            Validate::validate_at(value, path, out);
7075        }
7076        path.pop();
7077    }
7078}
7079
7080impl Sealed for SetNetworkProfileResponse {}
7081impl Response for SetNetworkProfileResponse {}
7082
7083/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
7084#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7085pub struct SetVariableMonitoringRequest {
7086    /// The `setMonitoringData` member.
7087    #[serde(rename = "setMonitoringData")]
7088    pub set_monitoring_data: Vec<SetMonitoringData>,
7089    /// The `customData` member.
7090    #[serde(rename = "customData")]
7091    #[serde(default, skip_serializing_if = "Option::is_none")]
7092    pub custom_data: Option<crate::types::CustomData>,
7093}
7094
7095impl SetVariableMonitoringRequest {
7096    /// Creates a `SetVariableMonitoringRequest` from its required fields.
7097    #[must_use]
7098    pub fn new(set_monitoring_data: Vec<SetMonitoringData>) -> Self {
7099        Self {
7100            set_monitoring_data,
7101            custom_data: None,
7102        }
7103    }
7104
7105    /// Sets the optional `customData` field.
7106    #[must_use]
7107    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7108        self.custom_data = Some(value);
7109        self
7110    }
7111}
7112
7113impl Validate for SetVariableMonitoringRequest {
7114    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7115        path.push_key("setMonitoringData");
7116        validate::list_len(self.set_monitoring_data.len(), Some(1), None, path, out);
7117        for (index, item) in self.set_monitoring_data.iter().enumerate() {
7118            path.push_index(index);
7119            Validate::validate_at(item, path, out);
7120            path.pop();
7121        }
7122        path.pop();
7123        path.push_key("customData");
7124        if let Some(value) = &self.custom_data {
7125            Validate::validate_at(value, path, out);
7126        }
7127        path.pop();
7128    }
7129}
7130
7131impl Sealed for SetVariableMonitoringRequest {}
7132impl Request for SetVariableMonitoringRequest {
7133    type Action = Action;
7134    const ACTION: Action = Action::SetVariableMonitoring;
7135    const KIND: MessageKind = MessageKind::Call;
7136    const ORIGIN: Origin = Origin::Csms;
7137    type Response = SetVariableMonitoringResponse;
7138}
7139
7140impl Confirmed for SetVariableMonitoringRequest {}
7141
7142/// Spec: OCPP 2.0.1 · N — Diagnostics · CSMS → Charging Station · CALL.
7143#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7144pub struct SetVariableMonitoringResponse {
7145    /// The `setMonitoringResult` member.
7146    #[serde(rename = "setMonitoringResult")]
7147    pub set_monitoring_result: Vec<SetMonitoringResult>,
7148    /// The `customData` member.
7149    #[serde(rename = "customData")]
7150    #[serde(default, skip_serializing_if = "Option::is_none")]
7151    pub custom_data: Option<crate::types::CustomData>,
7152}
7153
7154impl SetVariableMonitoringResponse {
7155    /// Creates a `SetVariableMonitoringResponse` from its required fields.
7156    #[must_use]
7157    pub fn new(set_monitoring_result: Vec<SetMonitoringResult>) -> Self {
7158        Self {
7159            set_monitoring_result,
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 SetVariableMonitoringResponse {
7173    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7174        path.push_key("setMonitoringResult");
7175        validate::list_len(self.set_monitoring_result.len(), Some(1), None, path, out);
7176        for (index, item) in self.set_monitoring_result.iter().enumerate() {
7177            path.push_index(index);
7178            Validate::validate_at(item, path, out);
7179            path.pop();
7180        }
7181        path.pop();
7182        path.push_key("customData");
7183        if let Some(value) = &self.custom_data {
7184            Validate::validate_at(value, path, out);
7185        }
7186        path.pop();
7187    }
7188}
7189
7190impl Sealed for SetVariableMonitoringResponse {}
7191impl Response for SetVariableMonitoringResponse {}
7192
7193/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
7194#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7195pub struct SetVariablesRequest {
7196    /// The `setVariableData` member.
7197    #[serde(rename = "setVariableData")]
7198    pub set_variable_data: Vec<SetVariableData>,
7199    /// The `customData` member.
7200    #[serde(rename = "customData")]
7201    #[serde(default, skip_serializing_if = "Option::is_none")]
7202    pub custom_data: Option<crate::types::CustomData>,
7203}
7204
7205impl SetVariablesRequest {
7206    /// Creates a `SetVariablesRequest` from its required fields.
7207    #[must_use]
7208    pub fn new(set_variable_data: Vec<SetVariableData>) -> Self {
7209        Self {
7210            set_variable_data,
7211            custom_data: None,
7212        }
7213    }
7214
7215    /// Sets the optional `customData` field.
7216    #[must_use]
7217    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7218        self.custom_data = Some(value);
7219        self
7220    }
7221}
7222
7223impl Validate for SetVariablesRequest {
7224    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7225        path.push_key("setVariableData");
7226        validate::list_len(self.set_variable_data.len(), Some(1), None, path, out);
7227        for (index, item) in self.set_variable_data.iter().enumerate() {
7228            path.push_index(index);
7229            Validate::validate_at(item, path, out);
7230            path.pop();
7231        }
7232        path.pop();
7233        path.push_key("customData");
7234        if let Some(value) = &self.custom_data {
7235            Validate::validate_at(value, path, out);
7236        }
7237        path.pop();
7238    }
7239}
7240
7241impl Sealed for SetVariablesRequest {}
7242impl Request for SetVariablesRequest {
7243    type Action = Action;
7244    const ACTION: Action = Action::SetVariables;
7245    const KIND: MessageKind = MessageKind::Call;
7246    const ORIGIN: Origin = Origin::Csms;
7247    type Response = SetVariablesResponse;
7248}
7249
7250impl Confirmed for SetVariablesRequest {}
7251
7252/// Spec: OCPP 2.0.1 · B — Provisioning · CSMS → Charging Station · CALL.
7253#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7254pub struct SetVariablesResponse {
7255    /// The `setVariableResult` member.
7256    #[serde(rename = "setVariableResult")]
7257    pub set_variable_result: Vec<SetVariableResult>,
7258    /// The `customData` member.
7259    #[serde(rename = "customData")]
7260    #[serde(default, skip_serializing_if = "Option::is_none")]
7261    pub custom_data: Option<crate::types::CustomData>,
7262}
7263
7264impl SetVariablesResponse {
7265    /// Creates a `SetVariablesResponse` from its required fields.
7266    #[must_use]
7267    pub fn new(set_variable_result: Vec<SetVariableResult>) -> Self {
7268        Self {
7269            set_variable_result,
7270            custom_data: None,
7271        }
7272    }
7273
7274    /// Sets the optional `customData` field.
7275    #[must_use]
7276    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7277        self.custom_data = Some(value);
7278        self
7279    }
7280}
7281
7282impl Validate for SetVariablesResponse {
7283    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7284        path.push_key("setVariableResult");
7285        validate::list_len(self.set_variable_result.len(), Some(1), None, path, out);
7286        for (index, item) in self.set_variable_result.iter().enumerate() {
7287            path.push_index(index);
7288            Validate::validate_at(item, path, out);
7289            path.pop();
7290        }
7291        path.pop();
7292        path.push_key("customData");
7293        if let Some(value) = &self.custom_data {
7294            Validate::validate_at(value, path, out);
7295        }
7296        path.pop();
7297    }
7298}
7299
7300impl Sealed for SetVariablesResponse {}
7301impl Response for SetVariablesResponse {}
7302
7303/// Spec: OCPP 2.0.1 · A — Security · Charging Station → CSMS · CALL.
7304#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7305pub struct SignCertificateRequest {
7306    /// 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.
7307    pub csr: String,
7308    /// The `certificateType` member.
7309    #[serde(rename = "certificateType")]
7310    #[serde(default, skip_serializing_if = "Option::is_none")]
7311    pub certificate_type: Option<CertificateSigningUse>,
7312    /// The `customData` member.
7313    #[serde(rename = "customData")]
7314    #[serde(default, skip_serializing_if = "Option::is_none")]
7315    pub custom_data: Option<crate::types::CustomData>,
7316}
7317
7318impl SignCertificateRequest {
7319    /// Creates a `SignCertificateRequest` from its required fields.
7320    #[must_use]
7321    pub fn new(csr: impl Into<String>) -> Self {
7322        Self {
7323            csr: csr.into(),
7324            certificate_type: None,
7325            custom_data: None,
7326        }
7327    }
7328
7329    /// Sets the optional `certificateType` field.
7330    #[must_use]
7331    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
7332        self.certificate_type = Some(value);
7333        self
7334    }
7335
7336    /// Sets the optional `customData` field.
7337    #[must_use]
7338    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7339        self.custom_data = Some(value);
7340        self
7341    }
7342}
7343
7344impl Validate for SignCertificateRequest {
7345    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7346        path.push_key("csr");
7347        validate::string(self.csr.as_str(), None, Some(5500), path, out);
7348        path.pop();
7349        path.push_key("certificateType");
7350        if let Some(value) = &self.certificate_type {
7351            Validate::validate_at(value, path, out);
7352        }
7353        path.pop();
7354        path.push_key("customData");
7355        if let Some(value) = &self.custom_data {
7356            Validate::validate_at(value, path, out);
7357        }
7358        path.pop();
7359    }
7360}
7361
7362impl Sealed for SignCertificateRequest {}
7363impl Request for SignCertificateRequest {
7364    type Action = Action;
7365    const ACTION: Action = Action::SignCertificate;
7366    const KIND: MessageKind = MessageKind::Call;
7367    const ORIGIN: Origin = Origin::ChargingStation;
7368    type Response = SignCertificateResponse;
7369}
7370
7371impl Confirmed for SignCertificateRequest {}
7372
7373/// Spec: OCPP 2.0.1 · A — Security · Charging Station → CSMS · CALL.
7374#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7375pub struct SignCertificateResponse {
7376    /// The `status` member.
7377    pub status: GenericStatus,
7378    /// The `statusInfo` member.
7379    #[serde(rename = "statusInfo")]
7380    #[serde(default, skip_serializing_if = "Option::is_none")]
7381    pub status_info: Option<StatusInfo>,
7382    /// The `customData` member.
7383    #[serde(rename = "customData")]
7384    #[serde(default, skip_serializing_if = "Option::is_none")]
7385    pub custom_data: Option<crate::types::CustomData>,
7386}
7387
7388impl SignCertificateResponse {
7389    /// Creates a `SignCertificateResponse` from its required fields.
7390    #[must_use]
7391    pub fn new(status: GenericStatus) -> Self {
7392        Self {
7393            status,
7394            status_info: None,
7395            custom_data: None,
7396        }
7397    }
7398
7399    /// Sets the optional `statusInfo` field.
7400    #[must_use]
7401    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7402        self.status_info = Some(value);
7403        self
7404    }
7405
7406    /// Sets the optional `customData` field.
7407    #[must_use]
7408    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7409        self.custom_data = Some(value);
7410        self
7411    }
7412}
7413
7414impl Validate for SignCertificateResponse {
7415    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7416        path.push_key("status");
7417        Validate::validate_at(&self.status, path, out);
7418        path.pop();
7419        path.push_key("statusInfo");
7420        if let Some(value) = &self.status_info {
7421            Validate::validate_at(value, path, out);
7422        }
7423        path.pop();
7424        path.push_key("customData");
7425        if let Some(value) = &self.custom_data {
7426            Validate::validate_at(value, path, out);
7427        }
7428        path.pop();
7429    }
7430}
7431
7432impl Sealed for SignCertificateResponse {}
7433impl Response for SignCertificateResponse {}
7434
7435/// Spec: OCPP 2.0.1 · G — Availability · Charging Station → CSMS · CALL.
7436#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7437pub struct StatusNotificationRequest {
7438    /// The time for which the status is reported. If absent time of receipt of the message will be assumed.
7439    pub timestamp: crate::types::DateTime,
7440    /// The `connectorStatus` member.
7441    #[serde(rename = "connectorStatus")]
7442    pub connector_status: ConnectorStatus,
7443    /// The id of the EVSE to which the connector belongs for which the the status is reported.
7444    #[serde(rename = "evseId")]
7445    pub evse_id: i32,
7446    /// The id of the connector within the EVSE for which the status is reported.
7447    #[serde(rename = "connectorId")]
7448    pub connector_id: i32,
7449    /// The `customData` member.
7450    #[serde(rename = "customData")]
7451    #[serde(default, skip_serializing_if = "Option::is_none")]
7452    pub custom_data: Option<crate::types::CustomData>,
7453}
7454
7455impl StatusNotificationRequest {
7456    /// Creates a `StatusNotificationRequest` from its required fields.
7457    #[must_use]
7458    pub fn new(
7459        timestamp: impl Into<crate::types::DateTime>,
7460        connector_status: ConnectorStatus,
7461        evse_id: i32,
7462        connector_id: i32,
7463    ) -> Self {
7464        Self {
7465            timestamp: timestamp.into(),
7466            connector_status,
7467            evse_id,
7468            connector_id,
7469            custom_data: None,
7470        }
7471    }
7472
7473    /// Sets the optional `customData` field.
7474    #[must_use]
7475    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7476        self.custom_data = Some(value);
7477        self
7478    }
7479}
7480
7481impl Validate for StatusNotificationRequest {
7482    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7483        path.push_key("connectorStatus");
7484        Validate::validate_at(&self.connector_status, path, out);
7485        path.pop();
7486        path.push_key("customData");
7487        if let Some(value) = &self.custom_data {
7488            Validate::validate_at(value, path, out);
7489        }
7490        path.pop();
7491    }
7492}
7493
7494impl Sealed for StatusNotificationRequest {}
7495impl Request for StatusNotificationRequest {
7496    type Action = Action;
7497    const ACTION: Action = Action::StatusNotification;
7498    const KIND: MessageKind = MessageKind::Call;
7499    const ORIGIN: Origin = Origin::ChargingStation;
7500    type Response = StatusNotificationResponse;
7501}
7502
7503impl Confirmed for StatusNotificationRequest {}
7504
7505/// Spec: OCPP 2.0.1 · G — Availability · Charging Station → CSMS · CALL.
7506#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7507pub struct StatusNotificationResponse {
7508    /// The `customData` member.
7509    #[serde(rename = "customData")]
7510    #[serde(default, skip_serializing_if = "Option::is_none")]
7511    pub custom_data: Option<crate::types::CustomData>,
7512}
7513
7514impl StatusNotificationResponse {
7515    /// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
7516    #[must_use]
7517    pub fn new() -> Self {
7518        Self::default()
7519    }
7520
7521    /// Sets the optional `customData` field.
7522    #[must_use]
7523    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7524        self.custom_data = Some(value);
7525        self
7526    }
7527}
7528
7529impl Validate for StatusNotificationResponse {
7530    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7531        path.push_key("customData");
7532        if let Some(value) = &self.custom_data {
7533            Validate::validate_at(value, path, out);
7534        }
7535        path.pop();
7536    }
7537}
7538
7539impl Sealed for StatusNotificationResponse {}
7540impl Response for StatusNotificationResponse {}
7541
7542/// Spec: OCPP 2.0.1 · E — Transactions · Charging Station → CSMS · CALL.
7543#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7544pub struct TransactionEventRequest {
7545    /// The `eventType` member.
7546    #[serde(rename = "eventType")]
7547    pub event_type: TransactionEventEnum,
7548    /// The date and time at which this transaction event occurred.
7549    pub timestamp: crate::types::DateTime,
7550    /// The `triggerReason` member.
7551    #[serde(rename = "triggerReason")]
7552    pub trigger_reason: TriggerReason,
7553    /// Incremental sequence number, helps with determining if all messages of a transaction have been received.
7554    #[serde(rename = "seqNo")]
7555    pub seq_no: i32,
7556    /// The `transactionInfo` member.
7557    #[serde(rename = "transactionInfo")]
7558    pub transaction_info: Transaction,
7559    /// The `meterValue` member.
7560    #[serde(rename = "meterValue")]
7561    #[serde(default, skip_serializing_if = "Option::is_none")]
7562    pub meter_value: Option<Vec<MeterValue>>,
7563    /// Indication that this transaction event happened when the Charging Station was offline. Default = false, meaning: the event occurred when the Charging Station was online.
7564    /// Schema default: `false`.
7565    #[serde(default, skip_serializing_if = "Option::is_none")]
7566    pub offline: Option<bool>,
7567    /// If the Charging Station is able to report the number of phases used, then it SHALL provide it. When omitted the CSMS may be able to determine the number of phases used via device management.
7568    #[serde(rename = "numberOfPhasesUsed")]
7569    #[serde(default, skip_serializing_if = "Option::is_none")]
7570    pub number_of_phases_used: Option<i32>,
7571    /// The maximum current of the connected cable in Ampere (A).
7572    #[serde(rename = "cableMaxCurrent")]
7573    #[serde(default, skip_serializing_if = "Option::is_none")]
7574    pub cable_max_current: Option<i32>,
7575    /// This contains the Id of the reservation that terminates as a result of this transaction.
7576    #[serde(rename = "reservationId")]
7577    #[serde(default, skip_serializing_if = "Option::is_none")]
7578    pub reservation_id: Option<i32>,
7579    /// The `evse` member.
7580    #[serde(default, skip_serializing_if = "Option::is_none")]
7581    pub evse: Option<EVSE>,
7582    /// The `idToken` member.
7583    #[serde(rename = "idToken")]
7584    #[serde(default, skip_serializing_if = "Option::is_none")]
7585    pub id_token: Option<IdToken>,
7586    /// The `customData` member.
7587    #[serde(rename = "customData")]
7588    #[serde(default, skip_serializing_if = "Option::is_none")]
7589    pub custom_data: Option<crate::types::CustomData>,
7590}
7591
7592impl TransactionEventRequest {
7593    /// Creates a `TransactionEventRequest` from its required fields.
7594    #[must_use]
7595    pub fn new(
7596        event_type: TransactionEventEnum,
7597        timestamp: impl Into<crate::types::DateTime>,
7598        trigger_reason: TriggerReason,
7599        seq_no: i32,
7600        transaction_info: Transaction,
7601    ) -> Self {
7602        Self {
7603            event_type,
7604            timestamp: timestamp.into(),
7605            trigger_reason,
7606            seq_no,
7607            transaction_info,
7608            meter_value: None,
7609            offline: None,
7610            number_of_phases_used: None,
7611            cable_max_current: None,
7612            reservation_id: None,
7613            evse: None,
7614            id_token: None,
7615            custom_data: None,
7616        }
7617    }
7618
7619    /// Sets the optional `meterValue` field.
7620    #[must_use]
7621    pub fn with_meter_value(mut self, value: Vec<MeterValue>) -> Self {
7622        self.meter_value = Some(value);
7623        self
7624    }
7625
7626    /// Sets the optional `offline` field.
7627    #[must_use]
7628    pub fn with_offline(mut self, value: bool) -> Self {
7629        self.offline = Some(value);
7630        self
7631    }
7632
7633    /// Sets the optional `numberOfPhasesUsed` field.
7634    #[must_use]
7635    pub fn with_number_of_phases_used(mut self, value: i32) -> Self {
7636        self.number_of_phases_used = Some(value);
7637        self
7638    }
7639
7640    /// Sets the optional `cableMaxCurrent` field.
7641    #[must_use]
7642    pub fn with_cable_max_current(mut self, value: i32) -> Self {
7643        self.cable_max_current = Some(value);
7644        self
7645    }
7646
7647    /// Sets the optional `reservationId` field.
7648    #[must_use]
7649    pub fn with_reservation_id(mut self, value: i32) -> Self {
7650        self.reservation_id = Some(value);
7651        self
7652    }
7653
7654    /// Sets the optional `evse` field.
7655    #[must_use]
7656    pub fn with_evse(mut self, value: EVSE) -> Self {
7657        self.evse = Some(value);
7658        self
7659    }
7660
7661    /// Sets the optional `idToken` field.
7662    #[must_use]
7663    pub fn with_id_token(mut self, value: IdToken) -> Self {
7664        self.id_token = Some(value);
7665        self
7666    }
7667
7668    /// Sets the optional `customData` field.
7669    #[must_use]
7670    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7671        self.custom_data = Some(value);
7672        self
7673    }
7674}
7675
7676impl Validate for TransactionEventRequest {
7677    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7678        path.push_key("eventType");
7679        Validate::validate_at(&self.event_type, path, out);
7680        path.pop();
7681        path.push_key("triggerReason");
7682        Validate::validate_at(&self.trigger_reason, path, out);
7683        path.pop();
7684        path.push_key("transactionInfo");
7685        Validate::validate_at(&self.transaction_info, path, out);
7686        path.pop();
7687        path.push_key("meterValue");
7688        if let Some(value) = &self.meter_value {
7689            validate::list_len(value.len(), Some(1), None, path, out);
7690            for (index, item) in value.iter().enumerate() {
7691                path.push_index(index);
7692                Validate::validate_at(item, path, out);
7693                path.pop();
7694            }
7695        }
7696        path.pop();
7697        path.push_key("evse");
7698        if let Some(value) = &self.evse {
7699            Validate::validate_at(value, path, out);
7700        }
7701        path.pop();
7702        path.push_key("idToken");
7703        if let Some(value) = &self.id_token {
7704            Validate::validate_at(value, path, out);
7705        }
7706        path.pop();
7707        path.push_key("customData");
7708        if let Some(value) = &self.custom_data {
7709            Validate::validate_at(value, path, out);
7710        }
7711        path.pop();
7712    }
7713}
7714
7715impl Sealed for TransactionEventRequest {}
7716impl Request for TransactionEventRequest {
7717    type Action = Action;
7718    const ACTION: Action = Action::TransactionEvent;
7719    const KIND: MessageKind = MessageKind::Call;
7720    const ORIGIN: Origin = Origin::ChargingStation;
7721    type Response = TransactionEventResponse;
7722}
7723
7724impl Confirmed for TransactionEventRequest {}
7725
7726/// Spec: OCPP 2.0.1 · E — Transactions · Charging Station → CSMS · CALL.
7727#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7728pub struct TransactionEventResponse {
7729    /// SHALL only be sent when charging has ended. Final total cost of this transaction, including taxes. In the currency configured with the Configuration Variable: &lt;&lt;configkey-currency,`Currency`&gt;&gt;. When omitted, the transaction was NOT free. To indicate a free transaction, the CSMS SHALL send 0.00.
7730    #[serde(rename = "totalCost")]
7731    #[serde(default, skip_serializing_if = "Option::is_none")]
7732    pub total_cost: Option<crate::types::Decimal>,
7733    /// 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; overrules the one in &lt;&lt;cmn_idtokeninfotype,IdTokenInfoType&gt;&gt;.
7734    #[serde(rename = "chargingPriority")]
7735    #[serde(default, skip_serializing_if = "Option::is_none")]
7736    pub charging_priority: Option<i32>,
7737    /// The `idTokenInfo` member.
7738    #[serde(rename = "idTokenInfo")]
7739    #[serde(default, skip_serializing_if = "Option::is_none")]
7740    pub id_token_info: Option<IdTokenInfo>,
7741    /// The `updatedPersonalMessage` member.
7742    #[serde(rename = "updatedPersonalMessage")]
7743    #[serde(default, skip_serializing_if = "Option::is_none")]
7744    pub updated_personal_message: Option<MessageContent>,
7745    /// The `customData` member.
7746    #[serde(rename = "customData")]
7747    #[serde(default, skip_serializing_if = "Option::is_none")]
7748    pub custom_data: Option<crate::types::CustomData>,
7749}
7750
7751impl TransactionEventResponse {
7752    /// Creates an empty `TransactionEventResponse`. Every field of this type is optional.
7753    #[must_use]
7754    pub fn new() -> Self {
7755        Self::default()
7756    }
7757
7758    /// Sets the optional `totalCost` field.
7759    #[must_use]
7760    pub fn with_total_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
7761        self.total_cost = Some(value.into());
7762        self
7763    }
7764
7765    /// Sets the optional `chargingPriority` field.
7766    #[must_use]
7767    pub fn with_charging_priority(mut self, value: i32) -> Self {
7768        self.charging_priority = Some(value);
7769        self
7770    }
7771
7772    /// Sets the optional `idTokenInfo` field.
7773    #[must_use]
7774    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
7775        self.id_token_info = Some(value);
7776        self
7777    }
7778
7779    /// Sets the optional `updatedPersonalMessage` field.
7780    #[must_use]
7781    pub fn with_updated_personal_message(mut self, value: MessageContent) -> Self {
7782        self.updated_personal_message = Some(value);
7783        self
7784    }
7785
7786    /// Sets the optional `customData` field.
7787    #[must_use]
7788    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7789        self.custom_data = Some(value);
7790        self
7791    }
7792}
7793
7794impl Validate for TransactionEventResponse {
7795    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7796        path.push_key("idTokenInfo");
7797        if let Some(value) = &self.id_token_info {
7798            Validate::validate_at(value, path, out);
7799        }
7800        path.pop();
7801        path.push_key("updatedPersonalMessage");
7802        if let Some(value) = &self.updated_personal_message {
7803            Validate::validate_at(value, path, out);
7804        }
7805        path.pop();
7806        path.push_key("customData");
7807        if let Some(value) = &self.custom_data {
7808            Validate::validate_at(value, path, out);
7809        }
7810        path.pop();
7811    }
7812}
7813
7814impl Sealed for TransactionEventResponse {}
7815impl Response for TransactionEventResponse {}
7816
7817/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
7818#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7819pub struct TriggerMessageRequest {
7820    /// The `requestedMessage` member.
7821    #[serde(rename = "requestedMessage")]
7822    pub requested_message: MessageTrigger,
7823    /// The `evse` member.
7824    #[serde(default, skip_serializing_if = "Option::is_none")]
7825    pub evse: Option<EVSE>,
7826    /// The `customData` member.
7827    #[serde(rename = "customData")]
7828    #[serde(default, skip_serializing_if = "Option::is_none")]
7829    pub custom_data: Option<crate::types::CustomData>,
7830}
7831
7832impl TriggerMessageRequest {
7833    /// Creates a `TriggerMessageRequest` from its required fields.
7834    #[must_use]
7835    pub fn new(requested_message: MessageTrigger) -> Self {
7836        Self {
7837            requested_message,
7838            evse: None,
7839            custom_data: None,
7840        }
7841    }
7842
7843    /// Sets the optional `evse` field.
7844    #[must_use]
7845    pub fn with_evse(mut self, value: EVSE) -> Self {
7846        self.evse = Some(value);
7847        self
7848    }
7849
7850    /// Sets the optional `customData` field.
7851    #[must_use]
7852    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7853        self.custom_data = Some(value);
7854        self
7855    }
7856}
7857
7858impl Validate for TriggerMessageRequest {
7859    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7860        path.push_key("requestedMessage");
7861        Validate::validate_at(&self.requested_message, path, out);
7862        path.pop();
7863        path.push_key("evse");
7864        if let Some(value) = &self.evse {
7865            Validate::validate_at(value, path, out);
7866        }
7867        path.pop();
7868        path.push_key("customData");
7869        if let Some(value) = &self.custom_data {
7870            Validate::validate_at(value, path, out);
7871        }
7872        path.pop();
7873    }
7874}
7875
7876impl Sealed for TriggerMessageRequest {}
7877impl Request for TriggerMessageRequest {
7878    type Action = Action;
7879    const ACTION: Action = Action::TriggerMessage;
7880    const KIND: MessageKind = MessageKind::Call;
7881    const ORIGIN: Origin = Origin::Csms;
7882    type Response = TriggerMessageResponse;
7883}
7884
7885impl Confirmed for TriggerMessageRequest {}
7886
7887/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
7888#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7889pub struct TriggerMessageResponse {
7890    /// The `status` member.
7891    pub status: TriggerMessageStatus,
7892    /// The `statusInfo` member.
7893    #[serde(rename = "statusInfo")]
7894    #[serde(default, skip_serializing_if = "Option::is_none")]
7895    pub status_info: Option<StatusInfo>,
7896    /// The `customData` member.
7897    #[serde(rename = "customData")]
7898    #[serde(default, skip_serializing_if = "Option::is_none")]
7899    pub custom_data: Option<crate::types::CustomData>,
7900}
7901
7902impl TriggerMessageResponse {
7903    /// Creates a `TriggerMessageResponse` from its required fields.
7904    #[must_use]
7905    pub fn new(status: TriggerMessageStatus) -> Self {
7906        Self {
7907            status,
7908            status_info: None,
7909            custom_data: None,
7910        }
7911    }
7912
7913    /// Sets the optional `statusInfo` field.
7914    #[must_use]
7915    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7916        self.status_info = Some(value);
7917        self
7918    }
7919
7920    /// Sets the optional `customData` field.
7921    #[must_use]
7922    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7923        self.custom_data = Some(value);
7924        self
7925    }
7926}
7927
7928impl Validate for TriggerMessageResponse {
7929    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7930        path.push_key("status");
7931        Validate::validate_at(&self.status, path, out);
7932        path.pop();
7933        path.push_key("statusInfo");
7934        if let Some(value) = &self.status_info {
7935            Validate::validate_at(value, path, out);
7936        }
7937        path.pop();
7938        path.push_key("customData");
7939        if let Some(value) = &self.custom_data {
7940            Validate::validate_at(value, path, out);
7941        }
7942        path.pop();
7943    }
7944}
7945
7946impl Sealed for TriggerMessageResponse {}
7947impl Response for TriggerMessageResponse {}
7948
7949/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
7950#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7951pub struct UnlockConnectorRequest {
7952    /// This contains the identifier of the EVSE for which a connector needs to be unlocked.
7953    #[serde(rename = "evseId")]
7954    pub evse_id: i32,
7955    /// This contains the identifier of the connector that needs to be unlocked.
7956    #[serde(rename = "connectorId")]
7957    pub connector_id: i32,
7958    /// The `customData` member.
7959    #[serde(rename = "customData")]
7960    #[serde(default, skip_serializing_if = "Option::is_none")]
7961    pub custom_data: Option<crate::types::CustomData>,
7962}
7963
7964impl UnlockConnectorRequest {
7965    /// Creates a `UnlockConnectorRequest` from its required fields.
7966    #[must_use]
7967    pub fn new(evse_id: i32, connector_id: i32) -> Self {
7968        Self {
7969            evse_id,
7970            connector_id,
7971            custom_data: None,
7972        }
7973    }
7974
7975    /// Sets the optional `customData` field.
7976    #[must_use]
7977    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7978        self.custom_data = Some(value);
7979        self
7980    }
7981}
7982
7983impl Validate for UnlockConnectorRequest {
7984    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7985        path.push_key("customData");
7986        if let Some(value) = &self.custom_data {
7987            Validate::validate_at(value, path, out);
7988        }
7989        path.pop();
7990    }
7991}
7992
7993impl Sealed for UnlockConnectorRequest {}
7994impl Request for UnlockConnectorRequest {
7995    type Action = Action;
7996    const ACTION: Action = Action::UnlockConnector;
7997    const KIND: MessageKind = MessageKind::Call;
7998    const ORIGIN: Origin = Origin::Csms;
7999    type Response = UnlockConnectorResponse;
8000}
8001
8002impl Confirmed for UnlockConnectorRequest {}
8003
8004/// Spec: OCPP 2.0.1 · F — Remote Control · CSMS → Charging Station · CALL.
8005#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8006pub struct UnlockConnectorResponse {
8007    /// The `status` member.
8008    pub status: UnlockStatus,
8009    /// The `statusInfo` member.
8010    #[serde(rename = "statusInfo")]
8011    #[serde(default, skip_serializing_if = "Option::is_none")]
8012    pub status_info: Option<StatusInfo>,
8013    /// The `customData` member.
8014    #[serde(rename = "customData")]
8015    #[serde(default, skip_serializing_if = "Option::is_none")]
8016    pub custom_data: Option<crate::types::CustomData>,
8017}
8018
8019impl UnlockConnectorResponse {
8020    /// Creates a `UnlockConnectorResponse` from its required fields.
8021    #[must_use]
8022    pub fn new(status: UnlockStatus) -> Self {
8023        Self {
8024            status,
8025            status_info: None,
8026            custom_data: None,
8027        }
8028    }
8029
8030    /// Sets the optional `statusInfo` field.
8031    #[must_use]
8032    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8033        self.status_info = Some(value);
8034        self
8035    }
8036
8037    /// Sets the optional `customData` field.
8038    #[must_use]
8039    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8040        self.custom_data = Some(value);
8041        self
8042    }
8043}
8044
8045impl Validate for UnlockConnectorResponse {
8046    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8047        path.push_key("status");
8048        Validate::validate_at(&self.status, path, out);
8049        path.pop();
8050        path.push_key("statusInfo");
8051        if let Some(value) = &self.status_info {
8052            Validate::validate_at(value, path, out);
8053        }
8054        path.pop();
8055        path.push_key("customData");
8056        if let Some(value) = &self.custom_data {
8057            Validate::validate_at(value, path, out);
8058        }
8059        path.pop();
8060    }
8061}
8062
8063impl Sealed for UnlockConnectorResponse {}
8064impl Response for UnlockConnectorResponse {}
8065
8066/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
8067#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8068pub struct UnpublishFirmwareRequest {
8069    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
8070    pub checksum: String,
8071    /// The `customData` member.
8072    #[serde(rename = "customData")]
8073    #[serde(default, skip_serializing_if = "Option::is_none")]
8074    pub custom_data: Option<crate::types::CustomData>,
8075}
8076
8077impl UnpublishFirmwareRequest {
8078    /// Creates a `UnpublishFirmwareRequest` from its required fields.
8079    #[must_use]
8080    pub fn new(checksum: impl Into<String>) -> Self {
8081        Self {
8082            checksum: checksum.into(),
8083            custom_data: None,
8084        }
8085    }
8086
8087    /// Sets the optional `customData` field.
8088    #[must_use]
8089    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8090        self.custom_data = Some(value);
8091        self
8092    }
8093}
8094
8095impl Validate for UnpublishFirmwareRequest {
8096    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8097        path.push_key("checksum");
8098        validate::string(self.checksum.as_str(), None, Some(32), path, out);
8099        path.pop();
8100        path.push_key("customData");
8101        if let Some(value) = &self.custom_data {
8102            Validate::validate_at(value, path, out);
8103        }
8104        path.pop();
8105    }
8106}
8107
8108impl Sealed for UnpublishFirmwareRequest {}
8109impl Request for UnpublishFirmwareRequest {
8110    type Action = Action;
8111    const ACTION: Action = Action::UnpublishFirmware;
8112    const KIND: MessageKind = MessageKind::Call;
8113    const ORIGIN: Origin = Origin::Csms;
8114    type Response = UnpublishFirmwareResponse;
8115}
8116
8117impl Confirmed for UnpublishFirmwareRequest {}
8118
8119/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
8120#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8121pub struct UnpublishFirmwareResponse {
8122    /// The `status` member.
8123    pub status: UnpublishFirmwareStatus,
8124    /// The `customData` member.
8125    #[serde(rename = "customData")]
8126    #[serde(default, skip_serializing_if = "Option::is_none")]
8127    pub custom_data: Option<crate::types::CustomData>,
8128}
8129
8130impl UnpublishFirmwareResponse {
8131    /// Creates a `UnpublishFirmwareResponse` from its required fields.
8132    #[must_use]
8133    pub fn new(status: UnpublishFirmwareStatus) -> Self {
8134        Self {
8135            status,
8136            custom_data: None,
8137        }
8138    }
8139
8140    /// Sets the optional `customData` field.
8141    #[must_use]
8142    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8143        self.custom_data = Some(value);
8144        self
8145    }
8146}
8147
8148impl Validate for UnpublishFirmwareResponse {
8149    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8150        path.push_key("status");
8151        Validate::validate_at(&self.status, path, out);
8152        path.pop();
8153        path.push_key("customData");
8154        if let Some(value) = &self.custom_data {
8155            Validate::validate_at(value, path, out);
8156        }
8157        path.pop();
8158    }
8159}
8160
8161impl Sealed for UnpublishFirmwareResponse {}
8162impl Response for UnpublishFirmwareResponse {}
8163
8164/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
8165#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8166pub struct UpdateFirmwareRequest {
8167    /// The Id of this request
8168    #[serde(rename = "requestId")]
8169    pub request_id: i32,
8170    /// The `firmware` member.
8171    pub firmware: Firmware,
8172    /// This specifies how many times Charging Station must try 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.
8173    #[serde(default, skip_serializing_if = "Option::is_none")]
8174    pub retries: Option<i32>,
8175    /// 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.
8176    #[serde(rename = "retryInterval")]
8177    #[serde(default, skip_serializing_if = "Option::is_none")]
8178    pub retry_interval: Option<i32>,
8179    /// The `customData` member.
8180    #[serde(rename = "customData")]
8181    #[serde(default, skip_serializing_if = "Option::is_none")]
8182    pub custom_data: Option<crate::types::CustomData>,
8183}
8184
8185impl UpdateFirmwareRequest {
8186    /// Creates a `UpdateFirmwareRequest` from its required fields.
8187    #[must_use]
8188    pub fn new(request_id: i32, firmware: Firmware) -> Self {
8189        Self {
8190            request_id,
8191            firmware,
8192            retries: None,
8193            retry_interval: None,
8194            custom_data: None,
8195        }
8196    }
8197
8198    /// Sets the optional `retries` field.
8199    #[must_use]
8200    pub fn with_retries(mut self, value: i32) -> Self {
8201        self.retries = Some(value);
8202        self
8203    }
8204
8205    /// Sets the optional `retryInterval` field.
8206    #[must_use]
8207    pub fn with_retry_interval(mut self, value: i32) -> Self {
8208        self.retry_interval = Some(value);
8209        self
8210    }
8211
8212    /// Sets the optional `customData` field.
8213    #[must_use]
8214    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8215        self.custom_data = Some(value);
8216        self
8217    }
8218}
8219
8220impl Validate for UpdateFirmwareRequest {
8221    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8222        path.push_key("firmware");
8223        Validate::validate_at(&self.firmware, path, out);
8224        path.pop();
8225        path.push_key("customData");
8226        if let Some(value) = &self.custom_data {
8227            Validate::validate_at(value, path, out);
8228        }
8229        path.pop();
8230    }
8231}
8232
8233impl Sealed for UpdateFirmwareRequest {}
8234impl Request for UpdateFirmwareRequest {
8235    type Action = Action;
8236    const ACTION: Action = Action::UpdateFirmware;
8237    const KIND: MessageKind = MessageKind::Call;
8238    const ORIGIN: Origin = Origin::Csms;
8239    type Response = UpdateFirmwareResponse;
8240}
8241
8242impl Confirmed for UpdateFirmwareRequest {}
8243
8244/// Spec: OCPP 2.0.1 · L — Firmware Management · CSMS → Charging Station · CALL.
8245#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8246pub struct UpdateFirmwareResponse {
8247    /// The `status` member.
8248    pub status: UpdateFirmwareStatus,
8249    /// The `statusInfo` member.
8250    #[serde(rename = "statusInfo")]
8251    #[serde(default, skip_serializing_if = "Option::is_none")]
8252    pub status_info: Option<StatusInfo>,
8253    /// The `customData` member.
8254    #[serde(rename = "customData")]
8255    #[serde(default, skip_serializing_if = "Option::is_none")]
8256    pub custom_data: Option<crate::types::CustomData>,
8257}
8258
8259impl UpdateFirmwareResponse {
8260    /// Creates a `UpdateFirmwareResponse` from its required fields.
8261    #[must_use]
8262    pub fn new(status: UpdateFirmwareStatus) -> Self {
8263        Self {
8264            status,
8265            status_info: None,
8266            custom_data: None,
8267        }
8268    }
8269
8270    /// Sets the optional `statusInfo` field.
8271    #[must_use]
8272    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8273        self.status_info = Some(value);
8274        self
8275    }
8276
8277    /// Sets the optional `customData` field.
8278    #[must_use]
8279    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8280        self.custom_data = Some(value);
8281        self
8282    }
8283}
8284
8285impl Validate for UpdateFirmwareResponse {
8286    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8287        path.push_key("status");
8288        Validate::validate_at(&self.status, path, out);
8289        path.pop();
8290        path.push_key("statusInfo");
8291        if let Some(value) = &self.status_info {
8292            Validate::validate_at(value, path, out);
8293        }
8294        path.pop();
8295        path.push_key("customData");
8296        if let Some(value) = &self.custom_data {
8297            Validate::validate_at(value, path, out);
8298        }
8299        path.pop();
8300    }
8301}
8302
8303impl Sealed for UpdateFirmwareResponse {}
8304impl Response for UpdateFirmwareResponse {}