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