Skip to main content

ocpp_kit/v2_1/
messages.rs

1// @generated by `cargo xtask codegen` from the vendored OCPP JSON schemas.
2// DO NOT EDIT — re-run the generator instead. CI fails if this file is stale.
3
4//! Request and response payloads for every OCPP 2.1 action.
5
6#![allow(unused_imports, clippy::doc_markdown, clippy::struct_excessive_bools)]
7#![allow(
8    clippy::too_many_lines,
9    clippy::too_many_arguments,
10    clippy::wildcard_imports
11)]
12#![allow(clippy::match_same_arms, clippy::fn_params_excessive_bools)]
13
14use alloc::string::String;
15use alloc::vec::Vec;
16
17use serde::{Deserialize, Serialize};
18
19use super::action::Action;
20use super::enums::*;
21use super::types::*;
22use crate::message::{Confirmed, MessageKind, Origin, Request, Response, Sealed, Unconfirmed};
23use crate::validate::{self, Validate, ValidationPath, Violations};
24
25/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct AFRRSignalRequest {
28    /// Time when signal becomes active.
29    pub timestamp: crate::types::DateTime,
30    /// Value of signal in _v2xSignalWattCurve_.
31    pub signal: i32,
32    /// The `customData` member.
33    #[serde(rename = "customData")]
34    #[serde(default, skip_serializing_if = "Option::is_none")]
35    pub custom_data: Option<crate::types::CustomData>,
36}
37
38impl AFRRSignalRequest {
39    /// Creates a `AFRRSignalRequest` from its required fields.
40    #[must_use]
41    pub fn new(timestamp: impl Into<crate::types::DateTime>, signal: i32) -> Self {
42        Self {
43            timestamp: timestamp.into(),
44            signal,
45            custom_data: None,
46        }
47    }
48
49    /// Sets the optional `customData` field.
50    #[must_use]
51    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
52        self.custom_data = Some(value);
53        self
54    }
55}
56
57impl Validate for AFRRSignalRequest {
58    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
59        path.push_key("customData");
60        if let Some(value) = &self.custom_data {
61            Validate::validate_at(value, path, out);
62        }
63        path.pop();
64    }
65}
66
67impl Sealed for AFRRSignalRequest {}
68impl Request for AFRRSignalRequest {
69    type Action = Action;
70    const ACTION: Action = Action::AFRRSignal;
71    const KIND: MessageKind = MessageKind::Call;
72    const ORIGIN: Origin = Origin::Csms;
73    type Response = AFRRSignalResponse;
74}
75
76impl Confirmed for AFRRSignalRequest {}
77
78/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
79#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
80pub struct AFRRSignalResponse {
81    /// The `status` member.
82    pub status: GenericStatus,
83    /// The `statusInfo` member.
84    #[serde(rename = "statusInfo")]
85    #[serde(default, skip_serializing_if = "Option::is_none")]
86    pub status_info: Option<StatusInfo>,
87    /// The `customData` member.
88    #[serde(rename = "customData")]
89    #[serde(default, skip_serializing_if = "Option::is_none")]
90    pub custom_data: Option<crate::types::CustomData>,
91}
92
93impl AFRRSignalResponse {
94    /// Creates a `AFRRSignalResponse` from its required fields.
95    #[must_use]
96    pub fn new(status: GenericStatus) -> Self {
97        Self {
98            status,
99            status_info: None,
100            custom_data: None,
101        }
102    }
103
104    /// Sets the optional `statusInfo` field.
105    #[must_use]
106    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
107        self.status_info = Some(value);
108        self
109    }
110
111    /// Sets the optional `customData` field.
112    #[must_use]
113    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
114        self.custom_data = Some(value);
115        self
116    }
117}
118
119impl Validate for AFRRSignalResponse {
120    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
121        path.push_key("status");
122        Validate::validate_at(&self.status, path, out);
123        path.pop();
124        path.push_key("statusInfo");
125        if let Some(value) = &self.status_info {
126            Validate::validate_at(value, path, out);
127        }
128        path.pop();
129        path.push_key("customData");
130        if let Some(value) = &self.custom_data {
131            Validate::validate_at(value, path, out);
132        }
133        path.pop();
134    }
135}
136
137impl Sealed for AFRRSignalResponse {}
138impl Response for AFRRSignalResponse {}
139
140/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
141#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
142pub struct AdjustPeriodicEventStreamRequest {
143    /// The `id` member.
144    pub id: i32,
145    /// The `params` member.
146    pub params: PeriodicEventStreamParams,
147    /// The `customData` member.
148    #[serde(rename = "customData")]
149    #[serde(default, skip_serializing_if = "Option::is_none")]
150    pub custom_data: Option<crate::types::CustomData>,
151}
152
153impl AdjustPeriodicEventStreamRequest {
154    /// Creates a `AdjustPeriodicEventStreamRequest` from its required fields.
155    #[must_use]
156    pub fn new(id: i32, params: PeriodicEventStreamParams) -> Self {
157        Self {
158            id,
159            params,
160            custom_data: None,
161        }
162    }
163
164    /// Sets the optional `customData` field.
165    #[must_use]
166    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
167        self.custom_data = Some(value);
168        self
169    }
170}
171
172impl Validate for AdjustPeriodicEventStreamRequest {
173    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
174        path.push_key("id");
175        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
176        path.pop();
177        path.push_key("params");
178        Validate::validate_at(&self.params, path, out);
179        path.pop();
180        path.push_key("customData");
181        if let Some(value) = &self.custom_data {
182            Validate::validate_at(value, path, out);
183        }
184        path.pop();
185    }
186}
187
188impl Sealed for AdjustPeriodicEventStreamRequest {}
189impl Request for AdjustPeriodicEventStreamRequest {
190    type Action = Action;
191    const ACTION: Action = Action::AdjustPeriodicEventStream;
192    const KIND: MessageKind = MessageKind::Call;
193    const ORIGIN: Origin = Origin::Csms;
194    type Response = AdjustPeriodicEventStreamResponse;
195}
196
197impl Confirmed for AdjustPeriodicEventStreamRequest {}
198
199/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
200#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
201pub struct AdjustPeriodicEventStreamResponse {
202    /// The `status` member.
203    pub status: GenericStatus,
204    /// The `statusInfo` member.
205    #[serde(rename = "statusInfo")]
206    #[serde(default, skip_serializing_if = "Option::is_none")]
207    pub status_info: Option<StatusInfo>,
208    /// The `customData` member.
209    #[serde(rename = "customData")]
210    #[serde(default, skip_serializing_if = "Option::is_none")]
211    pub custom_data: Option<crate::types::CustomData>,
212}
213
214impl AdjustPeriodicEventStreamResponse {
215    /// Creates a `AdjustPeriodicEventStreamResponse` from its required fields.
216    #[must_use]
217    pub fn new(status: GenericStatus) -> Self {
218        Self {
219            status,
220            status_info: None,
221            custom_data: None,
222        }
223    }
224
225    /// Sets the optional `statusInfo` field.
226    #[must_use]
227    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
228        self.status_info = Some(value);
229        self
230    }
231
232    /// Sets the optional `customData` field.
233    #[must_use]
234    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
235        self.custom_data = Some(value);
236        self
237    }
238}
239
240impl Validate for AdjustPeriodicEventStreamResponse {
241    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
242        path.push_key("status");
243        Validate::validate_at(&self.status, path, out);
244        path.pop();
245        path.push_key("statusInfo");
246        if let Some(value) = &self.status_info {
247            Validate::validate_at(value, path, out);
248        }
249        path.pop();
250        path.push_key("customData");
251        if let Some(value) = &self.custom_data {
252            Validate::validate_at(value, path, out);
253        }
254        path.pop();
255    }
256}
257
258impl Sealed for AdjustPeriodicEventStreamResponse {}
259impl Response for AdjustPeriodicEventStreamResponse {}
260
261/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
262#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
263pub struct AuthorizeRequest {
264    /// The `idToken` member.
265    #[serde(rename = "idToken")]
266    pub id_token: IdToken,
267    /// *(2.1)* The X.509 certificate chain presented by EV and encoded in PEM format. Order of certificates in chain is from leaf up to (but excluding) root certificate. +
268    /// Only needed in case of central contract validation when Charging Station cannot validate the contract certificate.
269    #[serde(default, skip_serializing_if = "Option::is_none")]
270    pub certificate: Option<String>,
271    /// The `iso15118CertificateHashData` member.
272    #[serde(rename = "iso15118CertificateHashData")]
273    #[serde(default, skip_serializing_if = "Option::is_none")]
274    pub iso15118_certificate_hash_data: Option<Vec<OCSPRequestData>>,
275    /// The `customData` member.
276    #[serde(rename = "customData")]
277    #[serde(default, skip_serializing_if = "Option::is_none")]
278    pub custom_data: Option<crate::types::CustomData>,
279}
280
281impl AuthorizeRequest {
282    /// Creates a `AuthorizeRequest` from its required fields.
283    #[must_use]
284    pub fn new(id_token: IdToken) -> Self {
285        Self {
286            id_token,
287            certificate: None,
288            iso15118_certificate_hash_data: None,
289            custom_data: None,
290        }
291    }
292
293    /// Sets the optional `certificate` field.
294    #[must_use]
295    pub fn with_certificate(mut self, value: impl Into<String>) -> Self {
296        self.certificate = Some(value.into());
297        self
298    }
299
300    /// Sets the optional `iso15118CertificateHashData` field.
301    #[must_use]
302    pub fn with_iso15118_certificate_hash_data(mut self, value: Vec<OCSPRequestData>) -> Self {
303        self.iso15118_certificate_hash_data = Some(value);
304        self
305    }
306
307    /// Sets the optional `customData` field.
308    #[must_use]
309    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
310        self.custom_data = Some(value);
311        self
312    }
313}
314
315impl Validate for AuthorizeRequest {
316    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
317        path.push_key("idToken");
318        Validate::validate_at(&self.id_token, path, out);
319        path.pop();
320        path.push_key("certificate");
321        if let Some(value) = &self.certificate {
322            validate::string(value.as_str(), None, Some(10000), path, out);
323        }
324        path.pop();
325        path.push_key("iso15118CertificateHashData");
326        if let Some(value) = &self.iso15118_certificate_hash_data {
327            validate::list_len(value.len(), Some(1), Some(4), path, out);
328            for (index, item) in value.iter().enumerate() {
329                path.push_index(index);
330                Validate::validate_at(item, path, out);
331                path.pop();
332            }
333        }
334        path.pop();
335        path.push_key("customData");
336        if let Some(value) = &self.custom_data {
337            Validate::validate_at(value, path, out);
338        }
339        path.pop();
340    }
341}
342
343impl Sealed for AuthorizeRequest {}
344impl Request for AuthorizeRequest {
345    type Action = Action;
346    const ACTION: Action = Action::Authorize;
347    const KIND: MessageKind = MessageKind::Call;
348    const ORIGIN: Origin = Origin::ChargingStation;
349    type Response = AuthorizeResponse;
350}
351
352impl Confirmed for AuthorizeRequest {}
353
354/// Spec: OCPP 2.1 · C — Authorization · Charging Station → CSMS · CALL.
355#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
356pub struct AuthorizeResponse {
357    /// The `idTokenInfo` member.
358    #[serde(rename = "idTokenInfo")]
359    pub id_token_info: IdTokenInfo,
360    /// The `certificateStatus` member.
361    #[serde(rename = "certificateStatus")]
362    #[serde(default, skip_serializing_if = "Option::is_none")]
363    pub certificate_status: Option<AuthorizeCertificateStatus>,
364    /// *(2.1)* List of allowed energy transfer modes the EV can choose from. If omitted this defaults to charging only.
365    #[serde(rename = "allowedEnergyTransfer")]
366    #[serde(default, skip_serializing_if = "Option::is_none")]
367    pub allowed_energy_transfer: Option<Vec<EnergyTransferMode>>,
368    /// The `tariff` member.
369    #[serde(default, skip_serializing_if = "Option::is_none")]
370    pub tariff: Option<Tariff>,
371    /// The `customData` member.
372    #[serde(rename = "customData")]
373    #[serde(default, skip_serializing_if = "Option::is_none")]
374    pub custom_data: Option<crate::types::CustomData>,
375}
376
377impl AuthorizeResponse {
378    /// Creates a `AuthorizeResponse` from its required fields.
379    #[must_use]
380    pub fn new(id_token_info: IdTokenInfo) -> Self {
381        Self {
382            id_token_info,
383            certificate_status: None,
384            allowed_energy_transfer: None,
385            tariff: None,
386            custom_data: None,
387        }
388    }
389
390    /// Sets the optional `certificateStatus` field.
391    #[must_use]
392    pub fn with_certificate_status(mut self, value: AuthorizeCertificateStatus) -> Self {
393        self.certificate_status = Some(value);
394        self
395    }
396
397    /// Sets the optional `allowedEnergyTransfer` field.
398    #[must_use]
399    pub fn with_allowed_energy_transfer(mut self, value: Vec<EnergyTransferMode>) -> Self {
400        self.allowed_energy_transfer = Some(value);
401        self
402    }
403
404    /// Sets the optional `tariff` field.
405    #[must_use]
406    pub fn with_tariff(mut self, value: Tariff) -> Self {
407        self.tariff = Some(value);
408        self
409    }
410
411    /// Sets the optional `customData` field.
412    #[must_use]
413    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
414        self.custom_data = Some(value);
415        self
416    }
417}
418
419impl Validate for AuthorizeResponse {
420    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
421        path.push_key("idTokenInfo");
422        Validate::validate_at(&self.id_token_info, path, out);
423        path.pop();
424        path.push_key("certificateStatus");
425        if let Some(value) = &self.certificate_status {
426            Validate::validate_at(value, path, out);
427        }
428        path.pop();
429        path.push_key("allowedEnergyTransfer");
430        if let Some(value) = &self.allowed_energy_transfer {
431            validate::list_len(value.len(), Some(1), None, path, out);
432            for (index, item) in value.iter().enumerate() {
433                path.push_index(index);
434                Validate::validate_at(item, path, out);
435                path.pop();
436            }
437        }
438        path.pop();
439        path.push_key("tariff");
440        if let Some(value) = &self.tariff {
441            Validate::validate_at(value, path, out);
442        }
443        path.pop();
444        path.push_key("customData");
445        if let Some(value) = &self.custom_data {
446            Validate::validate_at(value, path, out);
447        }
448        path.pop();
449    }
450}
451
452impl Sealed for AuthorizeResponse {}
453impl Response for AuthorizeResponse {}
454
455/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
456#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
457pub struct BatterySwapRequest {
458    /// The `batteryData` member.
459    #[serde(rename = "batteryData")]
460    pub battery_data: Vec<BatteryData>,
461    /// The `eventType` member.
462    #[serde(rename = "eventType")]
463    pub event_type: BatterySwapEvent,
464    /// The `idToken` member.
465    #[serde(rename = "idToken")]
466    pub id_token: IdToken,
467    /// RequestId to correlate BatteryIn/Out events and optional RequestBatterySwapRequest.
468    #[serde(rename = "requestId")]
469    pub request_id: i32,
470    /// The `customData` member.
471    #[serde(rename = "customData")]
472    #[serde(default, skip_serializing_if = "Option::is_none")]
473    pub custom_data: Option<crate::types::CustomData>,
474}
475
476impl BatterySwapRequest {
477    /// Creates a `BatterySwapRequest` from its required fields.
478    #[must_use]
479    pub fn new(
480        battery_data: Vec<BatteryData>,
481        event_type: BatterySwapEvent,
482        id_token: IdToken,
483        request_id: i32,
484    ) -> Self {
485        Self {
486            battery_data,
487            event_type,
488            id_token,
489            request_id,
490            custom_data: None,
491        }
492    }
493
494    /// Sets the optional `customData` field.
495    #[must_use]
496    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
497        self.custom_data = Some(value);
498        self
499    }
500}
501
502impl Validate for BatterySwapRequest {
503    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
504        path.push_key("batteryData");
505        validate::list_len(self.battery_data.len(), Some(1), None, path, out);
506        for (index, item) in self.battery_data.iter().enumerate() {
507            path.push_index(index);
508            Validate::validate_at(item, path, out);
509            path.pop();
510        }
511        path.pop();
512        path.push_key("eventType");
513        Validate::validate_at(&self.event_type, path, out);
514        path.pop();
515        path.push_key("idToken");
516        Validate::validate_at(&self.id_token, path, out);
517        path.pop();
518        path.push_key("customData");
519        if let Some(value) = &self.custom_data {
520            Validate::validate_at(value, path, out);
521        }
522        path.pop();
523    }
524}
525
526impl Sealed for BatterySwapRequest {}
527impl Request for BatterySwapRequest {
528    type Action = Action;
529    const ACTION: Action = Action::BatterySwap;
530    const KIND: MessageKind = MessageKind::Call;
531    const ORIGIN: Origin = Origin::ChargingStation;
532    type Response = BatterySwapResponse;
533}
534
535impl Confirmed for BatterySwapRequest {}
536
537/// This is an empty response that just acknowledges receipt of the request. (The request cannot be rejected).
538///
539/// Spec: OCPP 2.1 · S — Battery Swapping · Charging Station → CSMS · CALL.
540#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
541pub struct BatterySwapResponse {
542    /// The `customData` member.
543    #[serde(rename = "customData")]
544    #[serde(default, skip_serializing_if = "Option::is_none")]
545    pub custom_data: Option<crate::types::CustomData>,
546}
547
548impl BatterySwapResponse {
549    /// Creates an empty `BatterySwapResponse`. Every field of this type is optional.
550    #[must_use]
551    pub fn new() -> Self {
552        Self::default()
553    }
554
555    /// Sets the optional `customData` field.
556    #[must_use]
557    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
558        self.custom_data = Some(value);
559        self
560    }
561}
562
563impl Validate for BatterySwapResponse {
564    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
565        path.push_key("customData");
566        if let Some(value) = &self.custom_data {
567            Validate::validate_at(value, path, out);
568        }
569        path.pop();
570    }
571}
572
573impl Sealed for BatterySwapResponse {}
574impl Response for BatterySwapResponse {}
575
576/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
577#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
578pub struct BootNotificationRequest {
579    /// The `chargingStation` member.
580    #[serde(rename = "chargingStation")]
581    pub charging_station: ChargingStation,
582    /// The `reason` member.
583    pub reason: BootReason,
584    /// The `customData` member.
585    #[serde(rename = "customData")]
586    #[serde(default, skip_serializing_if = "Option::is_none")]
587    pub custom_data: Option<crate::types::CustomData>,
588}
589
590impl BootNotificationRequest {
591    /// Creates a `BootNotificationRequest` from its required fields.
592    #[must_use]
593    pub fn new(charging_station: ChargingStation, reason: BootReason) -> Self {
594        Self {
595            charging_station,
596            reason,
597            custom_data: None,
598        }
599    }
600
601    /// Sets the optional `customData` field.
602    #[must_use]
603    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
604        self.custom_data = Some(value);
605        self
606    }
607}
608
609impl Validate for BootNotificationRequest {
610    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
611        path.push_key("chargingStation");
612        Validate::validate_at(&self.charging_station, path, out);
613        path.pop();
614        path.push_key("reason");
615        Validate::validate_at(&self.reason, path, out);
616        path.pop();
617        path.push_key("customData");
618        if let Some(value) = &self.custom_data {
619            Validate::validate_at(value, path, out);
620        }
621        path.pop();
622    }
623}
624
625impl Sealed for BootNotificationRequest {}
626impl Request for BootNotificationRequest {
627    type Action = Action;
628    const ACTION: Action = Action::BootNotification;
629    const KIND: MessageKind = MessageKind::Call;
630    const ORIGIN: Origin = Origin::ChargingStation;
631    type Response = BootNotificationResponse;
632}
633
634impl Confirmed for BootNotificationRequest {}
635
636/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
637#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
638pub struct BootNotificationResponse {
639    /// This contains the CSMS’s current time.
640    #[serde(rename = "currentTime")]
641    pub current_time: crate::types::DateTime,
642    /// 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.
643    pub interval: i32,
644    /// The `status` member.
645    pub status: RegistrationStatus,
646    /// The `statusInfo` member.
647    #[serde(rename = "statusInfo")]
648    #[serde(default, skip_serializing_if = "Option::is_none")]
649    pub status_info: Option<StatusInfo>,
650    /// The `customData` member.
651    #[serde(rename = "customData")]
652    #[serde(default, skip_serializing_if = "Option::is_none")]
653    pub custom_data: Option<crate::types::CustomData>,
654}
655
656impl BootNotificationResponse {
657    /// Creates a `BootNotificationResponse` from its required fields.
658    #[must_use]
659    pub fn new(
660        current_time: impl Into<crate::types::DateTime>,
661        interval: i32,
662        status: RegistrationStatus,
663    ) -> Self {
664        Self {
665            current_time: current_time.into(),
666            interval,
667            status,
668            status_info: None,
669            custom_data: None,
670        }
671    }
672
673    /// Sets the optional `statusInfo` field.
674    #[must_use]
675    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
676        self.status_info = Some(value);
677        self
678    }
679
680    /// Sets the optional `customData` field.
681    #[must_use]
682    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
683        self.custom_data = Some(value);
684        self
685    }
686}
687
688impl Validate for BootNotificationResponse {
689    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
690        path.push_key("status");
691        Validate::validate_at(&self.status, path, out);
692        path.pop();
693        path.push_key("statusInfo");
694        if let Some(value) = &self.status_info {
695            Validate::validate_at(value, path, out);
696        }
697        path.pop();
698        path.push_key("customData");
699        if let Some(value) = &self.custom_data {
700            Validate::validate_at(value, path, out);
701        }
702        path.pop();
703    }
704}
705
706impl Sealed for BootNotificationResponse {}
707impl Response for BootNotificationResponse {}
708
709/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
710#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
711pub struct CancelReservationRequest {
712    /// Id of the reservation to cancel.
713    #[serde(rename = "reservationId")]
714    pub reservation_id: i32,
715    /// The `customData` member.
716    #[serde(rename = "customData")]
717    #[serde(default, skip_serializing_if = "Option::is_none")]
718    pub custom_data: Option<crate::types::CustomData>,
719}
720
721impl CancelReservationRequest {
722    /// Creates a `CancelReservationRequest` from its required fields.
723    #[must_use]
724    pub fn new(reservation_id: i32) -> Self {
725        Self {
726            reservation_id,
727            custom_data: None,
728        }
729    }
730
731    /// Sets the optional `customData` field.
732    #[must_use]
733    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
734        self.custom_data = Some(value);
735        self
736    }
737}
738
739impl Validate for CancelReservationRequest {
740    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
741        path.push_key("reservationId");
742        validate::int_range(i64::from(self.reservation_id), Some(0.0), None, path, out);
743        path.pop();
744        path.push_key("customData");
745        if let Some(value) = &self.custom_data {
746            Validate::validate_at(value, path, out);
747        }
748        path.pop();
749    }
750}
751
752impl Sealed for CancelReservationRequest {}
753impl Request for CancelReservationRequest {
754    type Action = Action;
755    const ACTION: Action = Action::CancelReservation;
756    const KIND: MessageKind = MessageKind::Call;
757    const ORIGIN: Origin = Origin::Csms;
758    type Response = CancelReservationResponse;
759}
760
761impl Confirmed for CancelReservationRequest {}
762
763/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
764#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
765pub struct CancelReservationResponse {
766    /// The `status` member.
767    pub status: CancelReservationStatus,
768    /// The `statusInfo` member.
769    #[serde(rename = "statusInfo")]
770    #[serde(default, skip_serializing_if = "Option::is_none")]
771    pub status_info: Option<StatusInfo>,
772    /// The `customData` member.
773    #[serde(rename = "customData")]
774    #[serde(default, skip_serializing_if = "Option::is_none")]
775    pub custom_data: Option<crate::types::CustomData>,
776}
777
778impl CancelReservationResponse {
779    /// Creates a `CancelReservationResponse` from its required fields.
780    #[must_use]
781    pub fn new(status: CancelReservationStatus) -> Self {
782        Self {
783            status,
784            status_info: None,
785            custom_data: None,
786        }
787    }
788
789    /// Sets the optional `statusInfo` field.
790    #[must_use]
791    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
792        self.status_info = Some(value);
793        self
794    }
795
796    /// Sets the optional `customData` field.
797    #[must_use]
798    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
799        self.custom_data = Some(value);
800        self
801    }
802}
803
804impl Validate for CancelReservationResponse {
805    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
806        path.push_key("status");
807        Validate::validate_at(&self.status, path, out);
808        path.pop();
809        path.push_key("statusInfo");
810        if let Some(value) = &self.status_info {
811            Validate::validate_at(value, path, out);
812        }
813        path.pop();
814        path.push_key("customData");
815        if let Some(value) = &self.custom_data {
816            Validate::validate_at(value, path, out);
817        }
818        path.pop();
819    }
820}
821
822impl Sealed for CancelReservationResponse {}
823impl Response for CancelReservationResponse {}
824
825/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
826#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
827pub struct CertificateSignedRequest {
828    /// The signed PEM encoded X.509 certificate. This SHALL also contain the necessary sub CA certificates, when applicable. The order of the bundle follows the certificate chain, starting from the leaf certificate.
829    ///
830    /// The Configuration Variable &lt;&lt;configkey-max-certificate-chain-size,MaxCertificateChainSize&gt;&gt; can be used to limit the maximum size of this field.
831    #[serde(rename = "certificateChain")]
832    pub certificate_chain: String,
833    /// The `certificateType` member.
834    #[serde(rename = "certificateType")]
835    #[serde(default, skip_serializing_if = "Option::is_none")]
836    pub certificate_type: Option<CertificateSigningUse>,
837    /// *(2.1)* RequestId to correlate this message with the SignCertificateRequest.
838    #[serde(rename = "requestId")]
839    #[serde(default, skip_serializing_if = "Option::is_none")]
840    pub request_id: Option<i32>,
841    /// The `customData` member.
842    #[serde(rename = "customData")]
843    #[serde(default, skip_serializing_if = "Option::is_none")]
844    pub custom_data: Option<crate::types::CustomData>,
845}
846
847impl CertificateSignedRequest {
848    /// Creates a `CertificateSignedRequest` from its required fields.
849    #[must_use]
850    pub fn new(certificate_chain: impl Into<String>) -> Self {
851        Self {
852            certificate_chain: certificate_chain.into(),
853            certificate_type: None,
854            request_id: None,
855            custom_data: None,
856        }
857    }
858
859    /// Sets the optional `certificateType` field.
860    #[must_use]
861    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
862        self.certificate_type = Some(value);
863        self
864    }
865
866    /// Sets the optional `requestId` field.
867    #[must_use]
868    pub fn with_request_id(mut self, value: i32) -> Self {
869        self.request_id = Some(value);
870        self
871    }
872
873    /// Sets the optional `customData` field.
874    #[must_use]
875    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
876        self.custom_data = Some(value);
877        self
878    }
879}
880
881impl Validate for CertificateSignedRequest {
882    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
883        path.push_key("certificateChain");
884        validate::string(
885            self.certificate_chain.as_str(),
886            None,
887            Some(10000),
888            path,
889            out,
890        );
891        path.pop();
892        path.push_key("certificateType");
893        if let Some(value) = &self.certificate_type {
894            Validate::validate_at(value, path, out);
895        }
896        path.pop();
897        path.push_key("customData");
898        if let Some(value) = &self.custom_data {
899            Validate::validate_at(value, path, out);
900        }
901        path.pop();
902    }
903}
904
905impl Sealed for CertificateSignedRequest {}
906impl Request for CertificateSignedRequest {
907    type Action = Action;
908    const ACTION: Action = Action::CertificateSigned;
909    const KIND: MessageKind = MessageKind::Call;
910    const ORIGIN: Origin = Origin::Csms;
911    type Response = CertificateSignedResponse;
912}
913
914impl Confirmed for CertificateSignedRequest {}
915
916/// Spec: OCPP 2.1 · A — Security · CSMS → Charging Station · CALL.
917#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
918pub struct CertificateSignedResponse {
919    /// The `status` member.
920    pub status: CertificateSignedStatus,
921    /// The `statusInfo` member.
922    #[serde(rename = "statusInfo")]
923    #[serde(default, skip_serializing_if = "Option::is_none")]
924    pub status_info: Option<StatusInfo>,
925    /// The `customData` member.
926    #[serde(rename = "customData")]
927    #[serde(default, skip_serializing_if = "Option::is_none")]
928    pub custom_data: Option<crate::types::CustomData>,
929}
930
931impl CertificateSignedResponse {
932    /// Creates a `CertificateSignedResponse` from its required fields.
933    #[must_use]
934    pub fn new(status: CertificateSignedStatus) -> Self {
935        Self {
936            status,
937            status_info: None,
938            custom_data: None,
939        }
940    }
941
942    /// Sets the optional `statusInfo` field.
943    #[must_use]
944    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
945        self.status_info = Some(value);
946        self
947    }
948
949    /// Sets the optional `customData` field.
950    #[must_use]
951    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
952        self.custom_data = Some(value);
953        self
954    }
955}
956
957impl Validate for CertificateSignedResponse {
958    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
959        path.push_key("status");
960        Validate::validate_at(&self.status, path, out);
961        path.pop();
962        path.push_key("statusInfo");
963        if let Some(value) = &self.status_info {
964            Validate::validate_at(value, path, out);
965        }
966        path.pop();
967        path.push_key("customData");
968        if let Some(value) = &self.custom_data {
969            Validate::validate_at(value, path, out);
970        }
971        path.pop();
972    }
973}
974
975impl Sealed for CertificateSignedResponse {}
976impl Response for CertificateSignedResponse {}
977
978/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
979#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
980pub struct ChangeAvailabilityRequest {
981    /// The `operationalStatus` member.
982    #[serde(rename = "operationalStatus")]
983    pub operational_status: OperationalStatus,
984    /// The `evse` member.
985    #[serde(default, skip_serializing_if = "Option::is_none")]
986    pub evse: Option<EVSE>,
987    /// The `customData` member.
988    #[serde(rename = "customData")]
989    #[serde(default, skip_serializing_if = "Option::is_none")]
990    pub custom_data: Option<crate::types::CustomData>,
991}
992
993impl ChangeAvailabilityRequest {
994    /// Creates a `ChangeAvailabilityRequest` from its required fields.
995    #[must_use]
996    pub fn new(operational_status: OperationalStatus) -> Self {
997        Self {
998            operational_status,
999            evse: None,
1000            custom_data: None,
1001        }
1002    }
1003
1004    /// Sets the optional `evse` field.
1005    #[must_use]
1006    pub fn with_evse(mut self, value: EVSE) -> Self {
1007        self.evse = Some(value);
1008        self
1009    }
1010
1011    /// Sets the optional `customData` field.
1012    #[must_use]
1013    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1014        self.custom_data = Some(value);
1015        self
1016    }
1017}
1018
1019impl Validate for ChangeAvailabilityRequest {
1020    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1021        path.push_key("operationalStatus");
1022        Validate::validate_at(&self.operational_status, path, out);
1023        path.pop();
1024        path.push_key("evse");
1025        if let Some(value) = &self.evse {
1026            Validate::validate_at(value, path, out);
1027        }
1028        path.pop();
1029        path.push_key("customData");
1030        if let Some(value) = &self.custom_data {
1031            Validate::validate_at(value, path, out);
1032        }
1033        path.pop();
1034    }
1035}
1036
1037impl Sealed for ChangeAvailabilityRequest {}
1038impl Request for ChangeAvailabilityRequest {
1039    type Action = Action;
1040    const ACTION: Action = Action::ChangeAvailability;
1041    const KIND: MessageKind = MessageKind::Call;
1042    const ORIGIN: Origin = Origin::Csms;
1043    type Response = ChangeAvailabilityResponse;
1044}
1045
1046impl Confirmed for ChangeAvailabilityRequest {}
1047
1048/// Spec: OCPP 2.1 · G — Availability · CSMS → Charging Station · CALL.
1049#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1050pub struct ChangeAvailabilityResponse {
1051    /// The `status` member.
1052    pub status: ChangeAvailabilityStatus,
1053    /// The `statusInfo` member.
1054    #[serde(rename = "statusInfo")]
1055    #[serde(default, skip_serializing_if = "Option::is_none")]
1056    pub status_info: Option<StatusInfo>,
1057    /// The `customData` member.
1058    #[serde(rename = "customData")]
1059    #[serde(default, skip_serializing_if = "Option::is_none")]
1060    pub custom_data: Option<crate::types::CustomData>,
1061}
1062
1063impl ChangeAvailabilityResponse {
1064    /// Creates a `ChangeAvailabilityResponse` from its required fields.
1065    #[must_use]
1066    pub fn new(status: ChangeAvailabilityStatus) -> Self {
1067        Self {
1068            status,
1069            status_info: None,
1070            custom_data: None,
1071        }
1072    }
1073
1074    /// Sets the optional `statusInfo` field.
1075    #[must_use]
1076    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1077        self.status_info = Some(value);
1078        self
1079    }
1080
1081    /// Sets the optional `customData` field.
1082    #[must_use]
1083    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1084        self.custom_data = Some(value);
1085        self
1086    }
1087}
1088
1089impl Validate for ChangeAvailabilityResponse {
1090    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1091        path.push_key("status");
1092        Validate::validate_at(&self.status, path, out);
1093        path.pop();
1094        path.push_key("statusInfo");
1095        if let Some(value) = &self.status_info {
1096            Validate::validate_at(value, path, out);
1097        }
1098        path.pop();
1099        path.push_key("customData");
1100        if let Some(value) = &self.custom_data {
1101            Validate::validate_at(value, path, out);
1102        }
1103        path.pop();
1104    }
1105}
1106
1107impl Sealed for ChangeAvailabilityResponse {}
1108impl Response for ChangeAvailabilityResponse {}
1109
1110/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1111#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1112pub struct ChangeTransactionTariffRequest {
1113    /// The `tariff` member.
1114    pub tariff: Tariff,
1115    /// Transaction id for new tariff.
1116    #[serde(rename = "transactionId")]
1117    pub transaction_id: String,
1118    /// The `customData` member.
1119    #[serde(rename = "customData")]
1120    #[serde(default, skip_serializing_if = "Option::is_none")]
1121    pub custom_data: Option<crate::types::CustomData>,
1122}
1123
1124impl ChangeTransactionTariffRequest {
1125    /// Creates a `ChangeTransactionTariffRequest` from its required fields.
1126    #[must_use]
1127    pub fn new(tariff: Tariff, transaction_id: impl Into<String>) -> Self {
1128        Self {
1129            tariff,
1130            transaction_id: transaction_id.into(),
1131            custom_data: None,
1132        }
1133    }
1134
1135    /// Sets the optional `customData` field.
1136    #[must_use]
1137    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1138        self.custom_data = Some(value);
1139        self
1140    }
1141}
1142
1143impl Validate for ChangeTransactionTariffRequest {
1144    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1145        path.push_key("tariff");
1146        Validate::validate_at(&self.tariff, path, out);
1147        path.pop();
1148        path.push_key("transactionId");
1149        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
1150        path.pop();
1151        path.push_key("customData");
1152        if let Some(value) = &self.custom_data {
1153            Validate::validate_at(value, path, out);
1154        }
1155        path.pop();
1156    }
1157}
1158
1159impl Sealed for ChangeTransactionTariffRequest {}
1160impl Request for ChangeTransactionTariffRequest {
1161    type Action = Action;
1162    const ACTION: Action = Action::ChangeTransactionTariff;
1163    const KIND: MessageKind = MessageKind::Call;
1164    const ORIGIN: Origin = Origin::Csms;
1165    type Response = ChangeTransactionTariffResponse;
1166}
1167
1168impl Confirmed for ChangeTransactionTariffRequest {}
1169
1170/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1171#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1172pub struct ChangeTransactionTariffResponse {
1173    /// The `status` member.
1174    pub status: TariffChangeStatus,
1175    /// The `statusInfo` member.
1176    #[serde(rename = "statusInfo")]
1177    #[serde(default, skip_serializing_if = "Option::is_none")]
1178    pub status_info: Option<StatusInfo>,
1179    /// The `customData` member.
1180    #[serde(rename = "customData")]
1181    #[serde(default, skip_serializing_if = "Option::is_none")]
1182    pub custom_data: Option<crate::types::CustomData>,
1183}
1184
1185impl ChangeTransactionTariffResponse {
1186    /// Creates a `ChangeTransactionTariffResponse` from its required fields.
1187    #[must_use]
1188    pub fn new(status: TariffChangeStatus) -> Self {
1189        Self {
1190            status,
1191            status_info: None,
1192            custom_data: None,
1193        }
1194    }
1195
1196    /// Sets the optional `statusInfo` field.
1197    #[must_use]
1198    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1199        self.status_info = Some(value);
1200        self
1201    }
1202
1203    /// Sets the optional `customData` field.
1204    #[must_use]
1205    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1206        self.custom_data = Some(value);
1207        self
1208    }
1209}
1210
1211impl Validate for ChangeTransactionTariffResponse {
1212    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1213        path.push_key("status");
1214        Validate::validate_at(&self.status, path, out);
1215        path.pop();
1216        path.push_key("statusInfo");
1217        if let Some(value) = &self.status_info {
1218            Validate::validate_at(value, path, out);
1219        }
1220        path.pop();
1221        path.push_key("customData");
1222        if let Some(value) = &self.custom_data {
1223            Validate::validate_at(value, path, out);
1224        }
1225        path.pop();
1226    }
1227}
1228
1229impl Sealed for ChangeTransactionTariffResponse {}
1230impl Response for ChangeTransactionTariffResponse {}
1231
1232/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
1233#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1234pub struct ClearCacheRequest {
1235    /// The `customData` member.
1236    #[serde(rename = "customData")]
1237    #[serde(default, skip_serializing_if = "Option::is_none")]
1238    pub custom_data: Option<crate::types::CustomData>,
1239}
1240
1241impl ClearCacheRequest {
1242    /// Creates an empty `ClearCacheRequest`. Every field of this type is optional.
1243    #[must_use]
1244    pub fn new() -> Self {
1245        Self::default()
1246    }
1247
1248    /// Sets the optional `customData` field.
1249    #[must_use]
1250    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1251        self.custom_data = Some(value);
1252        self
1253    }
1254}
1255
1256impl Validate for ClearCacheRequest {
1257    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1258        path.push_key("customData");
1259        if let Some(value) = &self.custom_data {
1260            Validate::validate_at(value, path, out);
1261        }
1262        path.pop();
1263    }
1264}
1265
1266impl Sealed for ClearCacheRequest {}
1267impl Request for ClearCacheRequest {
1268    type Action = Action;
1269    const ACTION: Action = Action::ClearCache;
1270    const KIND: MessageKind = MessageKind::Call;
1271    const ORIGIN: Origin = Origin::Csms;
1272    type Response = ClearCacheResponse;
1273}
1274
1275impl Confirmed for ClearCacheRequest {}
1276
1277/// Spec: OCPP 2.1 · C — Authorization · CSMS → Charging Station · CALL.
1278#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1279pub struct ClearCacheResponse {
1280    /// The `status` member.
1281    pub status: ClearCacheStatus,
1282    /// The `statusInfo` member.
1283    #[serde(rename = "statusInfo")]
1284    #[serde(default, skip_serializing_if = "Option::is_none")]
1285    pub status_info: Option<StatusInfo>,
1286    /// The `customData` member.
1287    #[serde(rename = "customData")]
1288    #[serde(default, skip_serializing_if = "Option::is_none")]
1289    pub custom_data: Option<crate::types::CustomData>,
1290}
1291
1292impl ClearCacheResponse {
1293    /// Creates a `ClearCacheResponse` from its required fields.
1294    #[must_use]
1295    pub fn new(status: ClearCacheStatus) -> Self {
1296        Self {
1297            status,
1298            status_info: None,
1299            custom_data: None,
1300        }
1301    }
1302
1303    /// Sets the optional `statusInfo` field.
1304    #[must_use]
1305    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1306        self.status_info = Some(value);
1307        self
1308    }
1309
1310    /// Sets the optional `customData` field.
1311    #[must_use]
1312    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1313        self.custom_data = Some(value);
1314        self
1315    }
1316}
1317
1318impl Validate for ClearCacheResponse {
1319    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1320        path.push_key("status");
1321        Validate::validate_at(&self.status, path, out);
1322        path.pop();
1323        path.push_key("statusInfo");
1324        if let Some(value) = &self.status_info {
1325            Validate::validate_at(value, path, out);
1326        }
1327        path.pop();
1328        path.push_key("customData");
1329        if let Some(value) = &self.custom_data {
1330            Validate::validate_at(value, path, out);
1331        }
1332        path.pop();
1333    }
1334}
1335
1336impl Sealed for ClearCacheResponse {}
1337impl Response for ClearCacheResponse {}
1338
1339/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
1340#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1341pub struct ClearChargingProfileRequest {
1342    /// The Id of the charging profile to clear.
1343    #[serde(rename = "chargingProfileId")]
1344    #[serde(default, skip_serializing_if = "Option::is_none")]
1345    pub charging_profile_id: Option<i32>,
1346    /// The `chargingProfileCriteria` member.
1347    #[serde(rename = "chargingProfileCriteria")]
1348    #[serde(default, skip_serializing_if = "Option::is_none")]
1349    pub charging_profile_criteria: Option<ClearChargingProfile>,
1350    /// The `customData` member.
1351    #[serde(rename = "customData")]
1352    #[serde(default, skip_serializing_if = "Option::is_none")]
1353    pub custom_data: Option<crate::types::CustomData>,
1354}
1355
1356impl ClearChargingProfileRequest {
1357    /// Creates an empty `ClearChargingProfileRequest`. Every field of this type is optional.
1358    #[must_use]
1359    pub fn new() -> Self {
1360        Self::default()
1361    }
1362
1363    /// Sets the optional `chargingProfileId` field.
1364    #[must_use]
1365    pub fn with_charging_profile_id(mut self, value: i32) -> Self {
1366        self.charging_profile_id = Some(value);
1367        self
1368    }
1369
1370    /// Sets the optional `chargingProfileCriteria` field.
1371    #[must_use]
1372    pub fn with_charging_profile_criteria(mut self, value: ClearChargingProfile) -> Self {
1373        self.charging_profile_criteria = Some(value);
1374        self
1375    }
1376
1377    /// Sets the optional `customData` field.
1378    #[must_use]
1379    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1380        self.custom_data = Some(value);
1381        self
1382    }
1383}
1384
1385impl Validate for ClearChargingProfileRequest {
1386    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1387        path.push_key("chargingProfileCriteria");
1388        if let Some(value) = &self.charging_profile_criteria {
1389            Validate::validate_at(value, path, out);
1390        }
1391        path.pop();
1392        path.push_key("customData");
1393        if let Some(value) = &self.custom_data {
1394            Validate::validate_at(value, path, out);
1395        }
1396        path.pop();
1397    }
1398}
1399
1400impl Sealed for ClearChargingProfileRequest {}
1401impl Request for ClearChargingProfileRequest {
1402    type Action = Action;
1403    const ACTION: Action = Action::ClearChargingProfile;
1404    const KIND: MessageKind = MessageKind::Call;
1405    const ORIGIN: Origin = Origin::Csms;
1406    type Response = ClearChargingProfileResponse;
1407}
1408
1409impl Confirmed for ClearChargingProfileRequest {}
1410
1411/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
1412#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1413pub struct ClearChargingProfileResponse {
1414    /// The `status` member.
1415    pub status: ClearChargingProfileStatus,
1416    /// The `statusInfo` member.
1417    #[serde(rename = "statusInfo")]
1418    #[serde(default, skip_serializing_if = "Option::is_none")]
1419    pub status_info: Option<StatusInfo>,
1420    /// The `customData` member.
1421    #[serde(rename = "customData")]
1422    #[serde(default, skip_serializing_if = "Option::is_none")]
1423    pub custom_data: Option<crate::types::CustomData>,
1424}
1425
1426impl ClearChargingProfileResponse {
1427    /// Creates a `ClearChargingProfileResponse` from its required fields.
1428    #[must_use]
1429    pub fn new(status: ClearChargingProfileStatus) -> Self {
1430        Self {
1431            status,
1432            status_info: None,
1433            custom_data: None,
1434        }
1435    }
1436
1437    /// Sets the optional `statusInfo` field.
1438    #[must_use]
1439    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1440        self.status_info = Some(value);
1441        self
1442    }
1443
1444    /// Sets the optional `customData` field.
1445    #[must_use]
1446    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1447        self.custom_data = Some(value);
1448        self
1449    }
1450}
1451
1452impl Validate for ClearChargingProfileResponse {
1453    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1454        path.push_key("status");
1455        Validate::validate_at(&self.status, path, out);
1456        path.pop();
1457        path.push_key("statusInfo");
1458        if let Some(value) = &self.status_info {
1459            Validate::validate_at(value, path, out);
1460        }
1461        path.pop();
1462        path.push_key("customData");
1463        if let Some(value) = &self.custom_data {
1464            Validate::validate_at(value, path, out);
1465        }
1466        path.pop();
1467    }
1468}
1469
1470impl Sealed for ClearChargingProfileResponse {}
1471impl Response for ClearChargingProfileResponse {}
1472
1473/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
1474#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1475pub struct ClearDERControlRequest {
1476    /// True: clearing default DER controls. False: clearing scheduled controls.
1477    #[serde(rename = "isDefault")]
1478    pub is_default: bool,
1479    /// The `controlType` member.
1480    #[serde(rename = "controlType")]
1481    #[serde(default, skip_serializing_if = "Option::is_none")]
1482    pub control_type: Option<DERControl>,
1483    /// Id of control setting to clear. When omitted all settings for _controlType_ are cleared.
1484    #[serde(rename = "controlId")]
1485    #[serde(default, skip_serializing_if = "Option::is_none")]
1486    pub control_id: Option<String>,
1487    /// The `customData` member.
1488    #[serde(rename = "customData")]
1489    #[serde(default, skip_serializing_if = "Option::is_none")]
1490    pub custom_data: Option<crate::types::CustomData>,
1491}
1492
1493impl ClearDERControlRequest {
1494    /// Creates a `ClearDERControlRequest` from its required fields.
1495    #[must_use]
1496    pub fn new(is_default: bool) -> Self {
1497        Self {
1498            is_default,
1499            control_type: None,
1500            control_id: None,
1501            custom_data: None,
1502        }
1503    }
1504
1505    /// Sets the optional `controlType` field.
1506    #[must_use]
1507    pub fn with_control_type(mut self, value: DERControl) -> Self {
1508        self.control_type = Some(value);
1509        self
1510    }
1511
1512    /// Sets the optional `controlId` field.
1513    #[must_use]
1514    pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
1515        self.control_id = Some(value.into());
1516        self
1517    }
1518
1519    /// Sets the optional `customData` field.
1520    #[must_use]
1521    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1522        self.custom_data = Some(value);
1523        self
1524    }
1525}
1526
1527impl Validate for ClearDERControlRequest {
1528    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1529        path.push_key("controlType");
1530        if let Some(value) = &self.control_type {
1531            Validate::validate_at(value, path, out);
1532        }
1533        path.pop();
1534        path.push_key("controlId");
1535        if let Some(value) = &self.control_id {
1536            validate::string(value.as_str(), None, Some(36), path, out);
1537        }
1538        path.pop();
1539        path.push_key("customData");
1540        if let Some(value) = &self.custom_data {
1541            Validate::validate_at(value, path, out);
1542        }
1543        path.pop();
1544    }
1545}
1546
1547impl Sealed for ClearDERControlRequest {}
1548impl Request for ClearDERControlRequest {
1549    type Action = Action;
1550    const ACTION: Action = Action::ClearDERControl;
1551    const KIND: MessageKind = MessageKind::Call;
1552    const ORIGIN: Origin = Origin::Csms;
1553    type Response = ClearDERControlResponse;
1554}
1555
1556impl Confirmed for ClearDERControlRequest {}
1557
1558/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
1559#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1560pub struct ClearDERControlResponse {
1561    /// The `status` member.
1562    pub status: DERControlStatus,
1563    /// The `statusInfo` member.
1564    #[serde(rename = "statusInfo")]
1565    #[serde(default, skip_serializing_if = "Option::is_none")]
1566    pub status_info: Option<StatusInfo>,
1567    /// The `customData` member.
1568    #[serde(rename = "customData")]
1569    #[serde(default, skip_serializing_if = "Option::is_none")]
1570    pub custom_data: Option<crate::types::CustomData>,
1571}
1572
1573impl ClearDERControlResponse {
1574    /// Creates a `ClearDERControlResponse` from its required fields.
1575    #[must_use]
1576    pub fn new(status: DERControlStatus) -> Self {
1577        Self {
1578            status,
1579            status_info: None,
1580            custom_data: None,
1581        }
1582    }
1583
1584    /// Sets the optional `statusInfo` field.
1585    #[must_use]
1586    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1587        self.status_info = Some(value);
1588        self
1589    }
1590
1591    /// Sets the optional `customData` field.
1592    #[must_use]
1593    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1594        self.custom_data = Some(value);
1595        self
1596    }
1597}
1598
1599impl Validate for ClearDERControlResponse {
1600    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1601        path.push_key("status");
1602        Validate::validate_at(&self.status, path, out);
1603        path.pop();
1604        path.push_key("statusInfo");
1605        if let Some(value) = &self.status_info {
1606            Validate::validate_at(value, path, out);
1607        }
1608        path.pop();
1609        path.push_key("customData");
1610        if let Some(value) = &self.custom_data {
1611            Validate::validate_at(value, path, out);
1612        }
1613        path.pop();
1614    }
1615}
1616
1617impl Sealed for ClearDERControlResponse {}
1618impl Response for ClearDERControlResponse {}
1619
1620/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
1621#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1622pub struct ClearDisplayMessageRequest {
1623    /// Id of the message that SHALL be removed from the Charging Station.
1624    pub id: i32,
1625    /// The `customData` member.
1626    #[serde(rename = "customData")]
1627    #[serde(default, skip_serializing_if = "Option::is_none")]
1628    pub custom_data: Option<crate::types::CustomData>,
1629}
1630
1631impl ClearDisplayMessageRequest {
1632    /// Creates a `ClearDisplayMessageRequest` from its required fields.
1633    #[must_use]
1634    pub fn new(id: i32) -> Self {
1635        Self {
1636            id,
1637            custom_data: None,
1638        }
1639    }
1640
1641    /// Sets the optional `customData` field.
1642    #[must_use]
1643    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1644        self.custom_data = Some(value);
1645        self
1646    }
1647}
1648
1649impl Validate for ClearDisplayMessageRequest {
1650    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1651        path.push_key("id");
1652        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
1653        path.pop();
1654        path.push_key("customData");
1655        if let Some(value) = &self.custom_data {
1656            Validate::validate_at(value, path, out);
1657        }
1658        path.pop();
1659    }
1660}
1661
1662impl Sealed for ClearDisplayMessageRequest {}
1663impl Request for ClearDisplayMessageRequest {
1664    type Action = Action;
1665    const ACTION: Action = Action::ClearDisplayMessage;
1666    const KIND: MessageKind = MessageKind::Call;
1667    const ORIGIN: Origin = Origin::Csms;
1668    type Response = ClearDisplayMessageResponse;
1669}
1670
1671impl Confirmed for ClearDisplayMessageRequest {}
1672
1673/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
1674#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1675pub struct ClearDisplayMessageResponse {
1676    /// The `status` member.
1677    pub status: ClearMessageStatus,
1678    /// The `statusInfo` member.
1679    #[serde(rename = "statusInfo")]
1680    #[serde(default, skip_serializing_if = "Option::is_none")]
1681    pub status_info: Option<StatusInfo>,
1682    /// The `customData` member.
1683    #[serde(rename = "customData")]
1684    #[serde(default, skip_serializing_if = "Option::is_none")]
1685    pub custom_data: Option<crate::types::CustomData>,
1686}
1687
1688impl ClearDisplayMessageResponse {
1689    /// Creates a `ClearDisplayMessageResponse` from its required fields.
1690    #[must_use]
1691    pub fn new(status: ClearMessageStatus) -> Self {
1692        Self {
1693            status,
1694            status_info: None,
1695            custom_data: None,
1696        }
1697    }
1698
1699    /// Sets the optional `statusInfo` field.
1700    #[must_use]
1701    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
1702        self.status_info = Some(value);
1703        self
1704    }
1705
1706    /// Sets the optional `customData` field.
1707    #[must_use]
1708    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1709        self.custom_data = Some(value);
1710        self
1711    }
1712}
1713
1714impl Validate for ClearDisplayMessageResponse {
1715    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1716        path.push_key("status");
1717        Validate::validate_at(&self.status, path, out);
1718        path.pop();
1719        path.push_key("statusInfo");
1720        if let Some(value) = &self.status_info {
1721            Validate::validate_at(value, path, out);
1722        }
1723        path.pop();
1724        path.push_key("customData");
1725        if let Some(value) = &self.custom_data {
1726            Validate::validate_at(value, path, out);
1727        }
1728        path.pop();
1729    }
1730}
1731
1732impl Sealed for ClearDisplayMessageResponse {}
1733impl Response for ClearDisplayMessageResponse {}
1734
1735/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1736#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1737pub struct ClearTariffsRequest {
1738    /// List of tariff Ids to clear. When absent clears all tariffs at _evseId_.
1739    #[serde(rename = "tariffIds")]
1740    #[serde(default, skip_serializing_if = "Option::is_none")]
1741    pub tariff_ids: Option<Vec<String>>,
1742    /// When present only clear tariffs matching _tariffIds_ at EVSE _evseId_.
1743    #[serde(rename = "evseId")]
1744    #[serde(default, skip_serializing_if = "Option::is_none")]
1745    pub evse_id: Option<i32>,
1746    /// The `customData` member.
1747    #[serde(rename = "customData")]
1748    #[serde(default, skip_serializing_if = "Option::is_none")]
1749    pub custom_data: Option<crate::types::CustomData>,
1750}
1751
1752impl ClearTariffsRequest {
1753    /// Creates an empty `ClearTariffsRequest`. Every field of this type is optional.
1754    #[must_use]
1755    pub fn new() -> Self {
1756        Self::default()
1757    }
1758
1759    /// Sets the optional `tariffIds` field.
1760    #[must_use]
1761    pub fn with_tariff_ids(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1762        self.tariff_ids = Some(value.into_iter().map(Into::into).collect());
1763        self
1764    }
1765
1766    /// Sets the optional `evseId` field.
1767    #[must_use]
1768    pub fn with_evse_id(mut self, value: i32) -> Self {
1769        self.evse_id = Some(value);
1770        self
1771    }
1772
1773    /// Sets the optional `customData` field.
1774    #[must_use]
1775    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1776        self.custom_data = Some(value);
1777        self
1778    }
1779}
1780
1781impl Validate for ClearTariffsRequest {
1782    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1783        path.push_key("tariffIds");
1784        if let Some(value) = &self.tariff_ids {
1785            validate::list_len(value.len(), Some(1), None, path, out);
1786            for (index, item) in value.iter().enumerate() {
1787                path.push_index(index);
1788                validate::string(item.as_str(), None, Some(60), path, out);
1789                path.pop();
1790            }
1791        }
1792        path.pop();
1793        path.push_key("evseId");
1794        if let Some(value) = &self.evse_id {
1795            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
1796        }
1797        path.pop();
1798        path.push_key("customData");
1799        if let Some(value) = &self.custom_data {
1800            Validate::validate_at(value, path, out);
1801        }
1802        path.pop();
1803    }
1804}
1805
1806impl Sealed for ClearTariffsRequest {}
1807impl Request for ClearTariffsRequest {
1808    type Action = Action;
1809    const ACTION: Action = Action::ClearTariffs;
1810    const KIND: MessageKind = MessageKind::Call;
1811    const ORIGIN: Origin = Origin::Csms;
1812    type Response = ClearTariffsResponse;
1813}
1814
1815impl Confirmed for ClearTariffsRequest {}
1816
1817/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
1818#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1819pub struct ClearTariffsResponse {
1820    /// The `clearTariffsResult` member.
1821    #[serde(rename = "clearTariffsResult")]
1822    pub clear_tariffs_result: Vec<ClearTariffsResult>,
1823    /// The `customData` member.
1824    #[serde(rename = "customData")]
1825    #[serde(default, skip_serializing_if = "Option::is_none")]
1826    pub custom_data: Option<crate::types::CustomData>,
1827}
1828
1829impl ClearTariffsResponse {
1830    /// Creates a `ClearTariffsResponse` from its required fields.
1831    #[must_use]
1832    pub fn new(clear_tariffs_result: Vec<ClearTariffsResult>) -> Self {
1833        Self {
1834            clear_tariffs_result,
1835            custom_data: None,
1836        }
1837    }
1838
1839    /// Sets the optional `customData` field.
1840    #[must_use]
1841    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1842        self.custom_data = Some(value);
1843        self
1844    }
1845}
1846
1847impl Validate for ClearTariffsResponse {
1848    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1849        path.push_key("clearTariffsResult");
1850        validate::list_len(self.clear_tariffs_result.len(), Some(1), None, path, out);
1851        for (index, item) in self.clear_tariffs_result.iter().enumerate() {
1852            path.push_index(index);
1853            Validate::validate_at(item, path, out);
1854            path.pop();
1855        }
1856        path.pop();
1857        path.push_key("customData");
1858        if let Some(value) = &self.custom_data {
1859            Validate::validate_at(value, path, out);
1860        }
1861        path.pop();
1862    }
1863}
1864
1865impl Sealed for ClearTariffsResponse {}
1866impl Response for ClearTariffsResponse {}
1867
1868/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1869#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1870pub struct ClearVariableMonitoringRequest {
1871    /// List of the monitors to be cleared, identified by there Id.
1872    pub id: Vec<i32>,
1873    /// The `customData` member.
1874    #[serde(rename = "customData")]
1875    #[serde(default, skip_serializing_if = "Option::is_none")]
1876    pub custom_data: Option<crate::types::CustomData>,
1877}
1878
1879impl ClearVariableMonitoringRequest {
1880    /// Creates a `ClearVariableMonitoringRequest` from its required fields.
1881    #[must_use]
1882    pub fn new(id: Vec<i32>) -> Self {
1883        Self {
1884            id,
1885            custom_data: None,
1886        }
1887    }
1888
1889    /// Sets the optional `customData` field.
1890    #[must_use]
1891    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1892        self.custom_data = Some(value);
1893        self
1894    }
1895}
1896
1897impl Validate for ClearVariableMonitoringRequest {
1898    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1899        path.push_key("id");
1900        validate::list_len(self.id.len(), Some(1), None, path, out);
1901        for (index, item) in self.id.iter().enumerate() {
1902            path.push_index(index);
1903            validate::int_range(i64::from(*item), Some(0.0), None, path, out);
1904            path.pop();
1905        }
1906        path.pop();
1907        path.push_key("customData");
1908        if let Some(value) = &self.custom_data {
1909            Validate::validate_at(value, path, out);
1910        }
1911        path.pop();
1912    }
1913}
1914
1915impl Sealed for ClearVariableMonitoringRequest {}
1916impl Request for ClearVariableMonitoringRequest {
1917    type Action = Action;
1918    const ACTION: Action = Action::ClearVariableMonitoring;
1919    const KIND: MessageKind = MessageKind::Call;
1920    const ORIGIN: Origin = Origin::Csms;
1921    type Response = ClearVariableMonitoringResponse;
1922}
1923
1924impl Confirmed for ClearVariableMonitoringRequest {}
1925
1926/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
1927#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1928pub struct ClearVariableMonitoringResponse {
1929    /// The `clearMonitoringResult` member.
1930    #[serde(rename = "clearMonitoringResult")]
1931    pub clear_monitoring_result: Vec<ClearMonitoringResult>,
1932    /// The `customData` member.
1933    #[serde(rename = "customData")]
1934    #[serde(default, skip_serializing_if = "Option::is_none")]
1935    pub custom_data: Option<crate::types::CustomData>,
1936}
1937
1938impl ClearVariableMonitoringResponse {
1939    /// Creates a `ClearVariableMonitoringResponse` from its required fields.
1940    #[must_use]
1941    pub fn new(clear_monitoring_result: Vec<ClearMonitoringResult>) -> Self {
1942        Self {
1943            clear_monitoring_result,
1944            custom_data: None,
1945        }
1946    }
1947
1948    /// Sets the optional `customData` field.
1949    #[must_use]
1950    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
1951        self.custom_data = Some(value);
1952        self
1953    }
1954}
1955
1956impl Validate for ClearVariableMonitoringResponse {
1957    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1958        path.push_key("clearMonitoringResult");
1959        validate::list_len(self.clear_monitoring_result.len(), Some(1), None, path, out);
1960        for (index, item) in self.clear_monitoring_result.iter().enumerate() {
1961            path.push_index(index);
1962            Validate::validate_at(item, path, out);
1963            path.pop();
1964        }
1965        path.pop();
1966        path.push_key("customData");
1967        if let Some(value) = &self.custom_data {
1968            Validate::validate_at(value, path, out);
1969        }
1970        path.pop();
1971    }
1972}
1973
1974impl Sealed for ClearVariableMonitoringResponse {}
1975impl Response for ClearVariableMonitoringResponse {}
1976
1977/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
1978#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1979pub struct ClearedChargingLimitRequest {
1980    /// Source of the charging limit. Allowed values defined in Appendix as ChargingLimitSourceEnumStringType.
1981    #[serde(rename = "chargingLimitSource")]
1982    pub charging_limit_source: String,
1983    /// EVSE Identifier.
1984    #[serde(rename = "evseId")]
1985    #[serde(default, skip_serializing_if = "Option::is_none")]
1986    pub evse_id: Option<i32>,
1987    /// The `customData` member.
1988    #[serde(rename = "customData")]
1989    #[serde(default, skip_serializing_if = "Option::is_none")]
1990    pub custom_data: Option<crate::types::CustomData>,
1991}
1992
1993impl ClearedChargingLimitRequest {
1994    /// Creates a `ClearedChargingLimitRequest` from its required fields.
1995    #[must_use]
1996    pub fn new(charging_limit_source: impl Into<String>) -> Self {
1997        Self {
1998            charging_limit_source: charging_limit_source.into(),
1999            evse_id: None,
2000            custom_data: None,
2001        }
2002    }
2003
2004    /// Sets the optional `evseId` field.
2005    #[must_use]
2006    pub fn with_evse_id(mut self, value: i32) -> Self {
2007        self.evse_id = Some(value);
2008        self
2009    }
2010
2011    /// Sets the optional `customData` field.
2012    #[must_use]
2013    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2014        self.custom_data = Some(value);
2015        self
2016    }
2017}
2018
2019impl Validate for ClearedChargingLimitRequest {
2020    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2021        path.push_key("chargingLimitSource");
2022        validate::string(
2023            self.charging_limit_source.as_str(),
2024            None,
2025            Some(20),
2026            path,
2027            out,
2028        );
2029        path.pop();
2030        path.push_key("evseId");
2031        if let Some(value) = &self.evse_id {
2032            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
2033        }
2034        path.pop();
2035        path.push_key("customData");
2036        if let Some(value) = &self.custom_data {
2037            Validate::validate_at(value, path, out);
2038        }
2039        path.pop();
2040    }
2041}
2042
2043impl Sealed for ClearedChargingLimitRequest {}
2044impl Request for ClearedChargingLimitRequest {
2045    type Action = Action;
2046    const ACTION: Action = Action::ClearedChargingLimit;
2047    const KIND: MessageKind = MessageKind::Call;
2048    const ORIGIN: Origin = Origin::ChargingStation;
2049    type Response = ClearedChargingLimitResponse;
2050}
2051
2052impl Confirmed for ClearedChargingLimitRequest {}
2053
2054/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
2055#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2056pub struct ClearedChargingLimitResponse {
2057    /// The `customData` member.
2058    #[serde(rename = "customData")]
2059    #[serde(default, skip_serializing_if = "Option::is_none")]
2060    pub custom_data: Option<crate::types::CustomData>,
2061}
2062
2063impl ClearedChargingLimitResponse {
2064    /// Creates an empty `ClearedChargingLimitResponse`. Every field of this type is optional.
2065    #[must_use]
2066    pub fn new() -> Self {
2067        Self::default()
2068    }
2069
2070    /// Sets the optional `customData` field.
2071    #[must_use]
2072    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2073        self.custom_data = Some(value);
2074        self
2075    }
2076}
2077
2078impl Validate for ClearedChargingLimitResponse {
2079    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2080        path.push_key("customData");
2081        if let Some(value) = &self.custom_data {
2082            Validate::validate_at(value, path, out);
2083        }
2084        path.pop();
2085    }
2086}
2087
2088impl Sealed for ClearedChargingLimitResponse {}
2089impl Response for ClearedChargingLimitResponse {}
2090
2091/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
2092#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2093pub struct ClosePeriodicEventStreamRequest {
2094    /// Id of stream to close.
2095    pub id: i32,
2096    /// The `customData` member.
2097    #[serde(rename = "customData")]
2098    #[serde(default, skip_serializing_if = "Option::is_none")]
2099    pub custom_data: Option<crate::types::CustomData>,
2100}
2101
2102impl ClosePeriodicEventStreamRequest {
2103    /// Creates a `ClosePeriodicEventStreamRequest` from its required fields.
2104    #[must_use]
2105    pub fn new(id: i32) -> Self {
2106        Self {
2107            id,
2108            custom_data: None,
2109        }
2110    }
2111
2112    /// Sets the optional `customData` field.
2113    #[must_use]
2114    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2115        self.custom_data = Some(value);
2116        self
2117    }
2118}
2119
2120impl Validate for ClosePeriodicEventStreamRequest {
2121    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2122        path.push_key("id");
2123        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
2124        path.pop();
2125        path.push_key("customData");
2126        if let Some(value) = &self.custom_data {
2127            Validate::validate_at(value, path, out);
2128        }
2129        path.pop();
2130    }
2131}
2132
2133impl Sealed for ClosePeriodicEventStreamRequest {}
2134impl Request for ClosePeriodicEventStreamRequest {
2135    type Action = Action;
2136    const ACTION: Action = Action::ClosePeriodicEventStream;
2137    const KIND: MessageKind = MessageKind::Call;
2138    const ORIGIN: Origin = Origin::ChargingStation;
2139    type Response = ClosePeriodicEventStreamResponse;
2140}
2141
2142impl Confirmed for ClosePeriodicEventStreamRequest {}
2143
2144/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
2145#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2146pub struct ClosePeriodicEventStreamResponse {
2147    /// The `customData` member.
2148    #[serde(rename = "customData")]
2149    #[serde(default, skip_serializing_if = "Option::is_none")]
2150    pub custom_data: Option<crate::types::CustomData>,
2151}
2152
2153impl ClosePeriodicEventStreamResponse {
2154    /// Creates an empty `ClosePeriodicEventStreamResponse`. Every field of this type is optional.
2155    #[must_use]
2156    pub fn new() -> Self {
2157        Self::default()
2158    }
2159
2160    /// Sets the optional `customData` field.
2161    #[must_use]
2162    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2163        self.custom_data = Some(value);
2164        self
2165    }
2166}
2167
2168impl Validate for ClosePeriodicEventStreamResponse {
2169    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2170        path.push_key("customData");
2171        if let Some(value) = &self.custom_data {
2172            Validate::validate_at(value, path, out);
2173        }
2174        path.pop();
2175    }
2176}
2177
2178impl Sealed for ClosePeriodicEventStreamResponse {}
2179impl Response for ClosePeriodicEventStreamResponse {}
2180
2181/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
2182#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2183pub struct CostUpdatedRequest {
2184    /// 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;\]
2185    #[serde(rename = "totalCost")]
2186    pub total_cost: crate::types::Decimal,
2187    /// Transaction Id of the transaction the current cost are asked for.
2188    #[serde(rename = "transactionId")]
2189    pub transaction_id: String,
2190    /// The `customData` member.
2191    #[serde(rename = "customData")]
2192    #[serde(default, skip_serializing_if = "Option::is_none")]
2193    pub custom_data: Option<crate::types::CustomData>,
2194}
2195
2196impl CostUpdatedRequest {
2197    /// Creates a `CostUpdatedRequest` from its required fields.
2198    #[must_use]
2199    pub fn new(
2200        total_cost: impl Into<crate::types::Decimal>,
2201        transaction_id: impl Into<String>,
2202    ) -> Self {
2203        Self {
2204            total_cost: total_cost.into(),
2205            transaction_id: transaction_id.into(),
2206            custom_data: None,
2207        }
2208    }
2209
2210    /// Sets the optional `customData` field.
2211    #[must_use]
2212    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2213        self.custom_data = Some(value);
2214        self
2215    }
2216}
2217
2218impl Validate for CostUpdatedRequest {
2219    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2220        path.push_key("transactionId");
2221        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
2222        path.pop();
2223        path.push_key("customData");
2224        if let Some(value) = &self.custom_data {
2225            Validate::validate_at(value, path, out);
2226        }
2227        path.pop();
2228    }
2229}
2230
2231impl Sealed for CostUpdatedRequest {}
2232impl Request for CostUpdatedRequest {
2233    type Action = Action;
2234    const ACTION: Action = Action::CostUpdated;
2235    const KIND: MessageKind = MessageKind::Call;
2236    const ORIGIN: Origin = Origin::Csms;
2237    type Response = CostUpdatedResponse;
2238}
2239
2240impl Confirmed for CostUpdatedRequest {}
2241
2242/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
2243#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2244pub struct CostUpdatedResponse {
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 CostUpdatedResponse {
2252    /// Creates an empty `CostUpdatedResponse`. Every field of this type is optional.
2253    #[must_use]
2254    pub fn new() -> Self {
2255        Self::default()
2256    }
2257
2258    /// Sets the optional `customData` field.
2259    #[must_use]
2260    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2261        self.custom_data = Some(value);
2262        self
2263    }
2264}
2265
2266impl Validate for CostUpdatedResponse {
2267    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2268        path.push_key("customData");
2269        if let Some(value) = &self.custom_data {
2270            Validate::validate_at(value, path, out);
2271        }
2272        path.pop();
2273    }
2274}
2275
2276impl Sealed for CostUpdatedResponse {}
2277impl Response for CostUpdatedResponse {}
2278
2279/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
2280#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2281pub struct CustomerInformationRequest {
2282    /// The Id of the request.
2283    #[serde(rename = "requestId")]
2284    pub request_id: i32,
2285    /// Flag indicating whether the Charging Station should return NotifyCustomerInformationRequest messages containing information about the customer referred to.
2286    pub report: bool,
2287    /// Flag indicating whether the Charging Station should clear all information about the customer referred to.
2288    pub clear: bool,
2289    /// The `customerCertificate` member.
2290    #[serde(rename = "customerCertificate")]
2291    #[serde(default, skip_serializing_if = "Option::is_none")]
2292    pub customer_certificate: Option<CertificateHashData>,
2293    /// The `idToken` member.
2294    #[serde(rename = "idToken")]
2295    #[serde(default, skip_serializing_if = "Option::is_none")]
2296    pub id_token: Option<IdToken>,
2297    /// A (e.g. vendor specific) identifier of the customer this request refers to. This field contains a custom identifier other than IdToken and Certificate.
2298    /// One of the possible identifiers (customerIdentifier, customerIdToken or customerCertificate) should be in the request message.
2299    #[serde(rename = "customerIdentifier")]
2300    #[serde(default, skip_serializing_if = "Option::is_none")]
2301    pub customer_identifier: Option<String>,
2302    /// The `customData` member.
2303    #[serde(rename = "customData")]
2304    #[serde(default, skip_serializing_if = "Option::is_none")]
2305    pub custom_data: Option<crate::types::CustomData>,
2306}
2307
2308impl CustomerInformationRequest {
2309    /// Creates a `CustomerInformationRequest` from its required fields.
2310    #[must_use]
2311    pub fn new(request_id: i32, report: bool, clear: bool) -> Self {
2312        Self {
2313            request_id,
2314            report,
2315            clear,
2316            customer_certificate: None,
2317            id_token: None,
2318            customer_identifier: None,
2319            custom_data: None,
2320        }
2321    }
2322
2323    /// Sets the optional `customerCertificate` field.
2324    #[must_use]
2325    pub fn with_customer_certificate(mut self, value: CertificateHashData) -> Self {
2326        self.customer_certificate = Some(value);
2327        self
2328    }
2329
2330    /// Sets the optional `idToken` field.
2331    #[must_use]
2332    pub fn with_id_token(mut self, value: IdToken) -> Self {
2333        self.id_token = Some(value);
2334        self
2335    }
2336
2337    /// Sets the optional `customerIdentifier` field.
2338    #[must_use]
2339    pub fn with_customer_identifier(mut self, value: impl Into<String>) -> Self {
2340        self.customer_identifier = Some(value.into());
2341        self
2342    }
2343
2344    /// Sets the optional `customData` field.
2345    #[must_use]
2346    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2347        self.custom_data = Some(value);
2348        self
2349    }
2350}
2351
2352impl Validate for CustomerInformationRequest {
2353    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2354        path.push_key("requestId");
2355        validate::int_range(i64::from(self.request_id), Some(0.0), None, path, out);
2356        path.pop();
2357        path.push_key("customerCertificate");
2358        if let Some(value) = &self.customer_certificate {
2359            Validate::validate_at(value, path, out);
2360        }
2361        path.pop();
2362        path.push_key("idToken");
2363        if let Some(value) = &self.id_token {
2364            Validate::validate_at(value, path, out);
2365        }
2366        path.pop();
2367        path.push_key("customerIdentifier");
2368        if let Some(value) = &self.customer_identifier {
2369            validate::string(value.as_str(), None, Some(64), path, out);
2370        }
2371        path.pop();
2372        path.push_key("customData");
2373        if let Some(value) = &self.custom_data {
2374            Validate::validate_at(value, path, out);
2375        }
2376        path.pop();
2377    }
2378}
2379
2380impl Sealed for CustomerInformationRequest {}
2381impl Request for CustomerInformationRequest {
2382    type Action = Action;
2383    const ACTION: Action = Action::CustomerInformation;
2384    const KIND: MessageKind = MessageKind::Call;
2385    const ORIGIN: Origin = Origin::Csms;
2386    type Response = CustomerInformationResponse;
2387}
2388
2389impl Confirmed for CustomerInformationRequest {}
2390
2391/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
2392#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2393pub struct CustomerInformationResponse {
2394    /// The `status` member.
2395    pub status: CustomerInformationStatus,
2396    /// The `statusInfo` member.
2397    #[serde(rename = "statusInfo")]
2398    #[serde(default, skip_serializing_if = "Option::is_none")]
2399    pub status_info: Option<StatusInfo>,
2400    /// The `customData` member.
2401    #[serde(rename = "customData")]
2402    #[serde(default, skip_serializing_if = "Option::is_none")]
2403    pub custom_data: Option<crate::types::CustomData>,
2404}
2405
2406impl CustomerInformationResponse {
2407    /// Creates a `CustomerInformationResponse` from its required fields.
2408    #[must_use]
2409    pub fn new(status: CustomerInformationStatus) -> Self {
2410        Self {
2411            status,
2412            status_info: None,
2413            custom_data: None,
2414        }
2415    }
2416
2417    /// Sets the optional `statusInfo` field.
2418    #[must_use]
2419    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2420        self.status_info = Some(value);
2421        self
2422    }
2423
2424    /// Sets the optional `customData` field.
2425    #[must_use]
2426    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2427        self.custom_data = Some(value);
2428        self
2429    }
2430}
2431
2432impl Validate for CustomerInformationResponse {
2433    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2434        path.push_key("status");
2435        Validate::validate_at(&self.status, path, out);
2436        path.pop();
2437        path.push_key("statusInfo");
2438        if let Some(value) = &self.status_info {
2439            Validate::validate_at(value, path, out);
2440        }
2441        path.pop();
2442        path.push_key("customData");
2443        if let Some(value) = &self.custom_data {
2444            Validate::validate_at(value, path, out);
2445        }
2446        path.pop();
2447    }
2448}
2449
2450impl Sealed for CustomerInformationResponse {}
2451impl Response for CustomerInformationResponse {}
2452
2453/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
2454#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2455pub struct DataTransferRequest {
2456    /// This identifies the Vendor specific implementation
2457    #[serde(rename = "vendorId")]
2458    pub vendor_id: String,
2459    /// May be used to indicate a specific message or implementation.
2460    #[serde(rename = "messageId")]
2461    #[serde(default, skip_serializing_if = "Option::is_none")]
2462    pub message_id: Option<String>,
2463    /// Data without specified length or format. This needs to be decided by both parties (Open to implementation).
2464    #[serde(default, skip_serializing_if = "Option::is_none")]
2465    pub data: Option<serde_json::Value>,
2466    /// The `customData` member.
2467    #[serde(rename = "customData")]
2468    #[serde(default, skip_serializing_if = "Option::is_none")]
2469    pub custom_data: Option<crate::types::CustomData>,
2470}
2471
2472impl DataTransferRequest {
2473    /// Creates a `DataTransferRequest` from its required fields.
2474    #[must_use]
2475    pub fn new(vendor_id: impl Into<String>) -> Self {
2476        Self {
2477            vendor_id: vendor_id.into(),
2478            message_id: None,
2479            data: None,
2480            custom_data: None,
2481        }
2482    }
2483
2484    /// Sets the optional `messageId` field.
2485    #[must_use]
2486    pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
2487        self.message_id = Some(value.into());
2488        self
2489    }
2490
2491    /// Sets the optional `data` field.
2492    #[must_use]
2493    pub fn with_data(mut self, value: serde_json::Value) -> Self {
2494        self.data = Some(value);
2495        self
2496    }
2497
2498    /// Sets the optional `customData` field.
2499    #[must_use]
2500    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2501        self.custom_data = Some(value);
2502        self
2503    }
2504}
2505
2506impl Validate for DataTransferRequest {
2507    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2508        path.push_key("vendorId");
2509        validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
2510        path.pop();
2511        path.push_key("messageId");
2512        if let Some(value) = &self.message_id {
2513            validate::string(value.as_str(), None, Some(50), path, out);
2514        }
2515        path.pop();
2516        path.push_key("customData");
2517        if let Some(value) = &self.custom_data {
2518            Validate::validate_at(value, path, out);
2519        }
2520        path.pop();
2521    }
2522}
2523
2524impl Sealed for DataTransferRequest {}
2525impl Request for DataTransferRequest {
2526    type Action = Action;
2527    const ACTION: Action = Action::DataTransfer;
2528    const KIND: MessageKind = MessageKind::Call;
2529    const ORIGIN: Origin = Origin::Both;
2530    type Response = DataTransferResponse;
2531}
2532
2533impl Confirmed for DataTransferRequest {}
2534
2535/// Spec: OCPP 2.1 · P — Data Transfer · either direction · CALL.
2536#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2537pub struct DataTransferResponse {
2538    /// The `status` member.
2539    pub status: DataTransferStatus,
2540    /// The `statusInfo` member.
2541    #[serde(rename = "statusInfo")]
2542    #[serde(default, skip_serializing_if = "Option::is_none")]
2543    pub status_info: Option<StatusInfo>,
2544    /// Data without specified length or format, in response to request.
2545    #[serde(default, skip_serializing_if = "Option::is_none")]
2546    pub data: Option<serde_json::Value>,
2547    /// The `customData` member.
2548    #[serde(rename = "customData")]
2549    #[serde(default, skip_serializing_if = "Option::is_none")]
2550    pub custom_data: Option<crate::types::CustomData>,
2551}
2552
2553impl DataTransferResponse {
2554    /// Creates a `DataTransferResponse` from its required fields.
2555    #[must_use]
2556    pub fn new(status: DataTransferStatus) -> Self {
2557        Self {
2558            status,
2559            status_info: None,
2560            data: None,
2561            custom_data: None,
2562        }
2563    }
2564
2565    /// Sets the optional `statusInfo` field.
2566    #[must_use]
2567    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2568        self.status_info = Some(value);
2569        self
2570    }
2571
2572    /// Sets the optional `data` field.
2573    #[must_use]
2574    pub fn with_data(mut self, value: serde_json::Value) -> Self {
2575        self.data = Some(value);
2576        self
2577    }
2578
2579    /// Sets the optional `customData` field.
2580    #[must_use]
2581    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2582        self.custom_data = Some(value);
2583        self
2584    }
2585}
2586
2587impl Validate for DataTransferResponse {
2588    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2589        path.push_key("status");
2590        Validate::validate_at(&self.status, path, out);
2591        path.pop();
2592        path.push_key("statusInfo");
2593        if let Some(value) = &self.status_info {
2594            Validate::validate_at(value, path, out);
2595        }
2596        path.pop();
2597        path.push_key("customData");
2598        if let Some(value) = &self.custom_data {
2599            Validate::validate_at(value, path, out);
2600        }
2601        path.pop();
2602    }
2603}
2604
2605impl Sealed for DataTransferResponse {}
2606impl Response for DataTransferResponse {}
2607
2608/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2609#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2610pub struct DeleteCertificateRequest {
2611    /// The `certificateHashData` member.
2612    #[serde(rename = "certificateHashData")]
2613    pub certificate_hash_data: CertificateHashData,
2614    /// The `customData` member.
2615    #[serde(rename = "customData")]
2616    #[serde(default, skip_serializing_if = "Option::is_none")]
2617    pub custom_data: Option<crate::types::CustomData>,
2618}
2619
2620impl DeleteCertificateRequest {
2621    /// Creates a `DeleteCertificateRequest` from its required fields.
2622    #[must_use]
2623    pub fn new(certificate_hash_data: CertificateHashData) -> Self {
2624        Self {
2625            certificate_hash_data,
2626            custom_data: None,
2627        }
2628    }
2629
2630    /// Sets the optional `customData` field.
2631    #[must_use]
2632    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2633        self.custom_data = Some(value);
2634        self
2635    }
2636}
2637
2638impl Validate for DeleteCertificateRequest {
2639    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2640        path.push_key("certificateHashData");
2641        Validate::validate_at(&self.certificate_hash_data, path, out);
2642        path.pop();
2643        path.push_key("customData");
2644        if let Some(value) = &self.custom_data {
2645            Validate::validate_at(value, path, out);
2646        }
2647        path.pop();
2648    }
2649}
2650
2651impl Sealed for DeleteCertificateRequest {}
2652impl Request for DeleteCertificateRequest {
2653    type Action = Action;
2654    const ACTION: Action = Action::DeleteCertificate;
2655    const KIND: MessageKind = MessageKind::Call;
2656    const ORIGIN: Origin = Origin::Csms;
2657    type Response = DeleteCertificateResponse;
2658}
2659
2660impl Confirmed for DeleteCertificateRequest {}
2661
2662/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
2663#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2664pub struct DeleteCertificateResponse {
2665    /// The `status` member.
2666    pub status: DeleteCertificateStatus,
2667    /// The `statusInfo` member.
2668    #[serde(rename = "statusInfo")]
2669    #[serde(default, skip_serializing_if = "Option::is_none")]
2670    pub status_info: Option<StatusInfo>,
2671    /// The `customData` member.
2672    #[serde(rename = "customData")]
2673    #[serde(default, skip_serializing_if = "Option::is_none")]
2674    pub custom_data: Option<crate::types::CustomData>,
2675}
2676
2677impl DeleteCertificateResponse {
2678    /// Creates a `DeleteCertificateResponse` from its required fields.
2679    #[must_use]
2680    pub fn new(status: DeleteCertificateStatus) -> Self {
2681        Self {
2682            status,
2683            status_info: None,
2684            custom_data: None,
2685        }
2686    }
2687
2688    /// Sets the optional `statusInfo` field.
2689    #[must_use]
2690    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2691        self.status_info = Some(value);
2692        self
2693    }
2694
2695    /// Sets the optional `customData` field.
2696    #[must_use]
2697    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2698        self.custom_data = Some(value);
2699        self
2700    }
2701}
2702
2703impl Validate for DeleteCertificateResponse {
2704    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2705        path.push_key("status");
2706        Validate::validate_at(&self.status, path, out);
2707        path.pop();
2708        path.push_key("statusInfo");
2709        if let Some(value) = &self.status_info {
2710            Validate::validate_at(value, path, out);
2711        }
2712        path.pop();
2713        path.push_key("customData");
2714        if let Some(value) = &self.custom_data {
2715            Validate::validate_at(value, path, out);
2716        }
2717        path.pop();
2718    }
2719}
2720
2721impl Sealed for DeleteCertificateResponse {}
2722impl Response for DeleteCertificateResponse {}
2723
2724/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
2725#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2726pub struct FirmwareStatusNotificationRequest {
2727    /// The `status` member.
2728    pub status: FirmwareStatus,
2729    /// The request id that was provided in the
2730    /// UpdateFirmwareRequest that started this firmware update.
2731    /// This field is mandatory, unless the message was triggered by a TriggerMessageRequest AND there is no firmware update ongoing.
2732    #[serde(rename = "requestId")]
2733    #[serde(default, skip_serializing_if = "Option::is_none")]
2734    pub request_id: Option<i32>,
2735    /// The `statusInfo` member.
2736    #[serde(rename = "statusInfo")]
2737    #[serde(default, skip_serializing_if = "Option::is_none")]
2738    pub status_info: Option<StatusInfo>,
2739    /// The `customData` member.
2740    #[serde(rename = "customData")]
2741    #[serde(default, skip_serializing_if = "Option::is_none")]
2742    pub custom_data: Option<crate::types::CustomData>,
2743}
2744
2745impl FirmwareStatusNotificationRequest {
2746    /// Creates a `FirmwareStatusNotificationRequest` from its required fields.
2747    #[must_use]
2748    pub fn new(status: FirmwareStatus) -> Self {
2749        Self {
2750            status,
2751            request_id: None,
2752            status_info: None,
2753            custom_data: None,
2754        }
2755    }
2756
2757    /// Sets the optional `requestId` field.
2758    #[must_use]
2759    pub fn with_request_id(mut self, value: i32) -> Self {
2760        self.request_id = Some(value);
2761        self
2762    }
2763
2764    /// Sets the optional `statusInfo` field.
2765    #[must_use]
2766    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
2767        self.status_info = Some(value);
2768        self
2769    }
2770
2771    /// Sets the optional `customData` field.
2772    #[must_use]
2773    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2774        self.custom_data = Some(value);
2775        self
2776    }
2777}
2778
2779impl Validate for FirmwareStatusNotificationRequest {
2780    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2781        path.push_key("status");
2782        Validate::validate_at(&self.status, path, out);
2783        path.pop();
2784        path.push_key("statusInfo");
2785        if let Some(value) = &self.status_info {
2786            Validate::validate_at(value, path, out);
2787        }
2788        path.pop();
2789        path.push_key("customData");
2790        if let Some(value) = &self.custom_data {
2791            Validate::validate_at(value, path, out);
2792        }
2793        path.pop();
2794    }
2795}
2796
2797impl Sealed for FirmwareStatusNotificationRequest {}
2798impl Request for FirmwareStatusNotificationRequest {
2799    type Action = Action;
2800    const ACTION: Action = Action::FirmwareStatusNotification;
2801    const KIND: MessageKind = MessageKind::Call;
2802    const ORIGIN: Origin = Origin::ChargingStation;
2803    type Response = FirmwareStatusNotificationResponse;
2804}
2805
2806impl Confirmed for FirmwareStatusNotificationRequest {}
2807
2808/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
2809#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2810pub struct FirmwareStatusNotificationResponse {
2811    /// The `customData` member.
2812    #[serde(rename = "customData")]
2813    #[serde(default, skip_serializing_if = "Option::is_none")]
2814    pub custom_data: Option<crate::types::CustomData>,
2815}
2816
2817impl FirmwareStatusNotificationResponse {
2818    /// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
2819    #[must_use]
2820    pub fn new() -> Self {
2821        Self::default()
2822    }
2823
2824    /// Sets the optional `customData` field.
2825    #[must_use]
2826    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2827        self.custom_data = Some(value);
2828        self
2829    }
2830}
2831
2832impl Validate for FirmwareStatusNotificationResponse {
2833    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2834        path.push_key("customData");
2835        if let Some(value) = &self.custom_data {
2836            Validate::validate_at(value, path, out);
2837        }
2838        path.pop();
2839    }
2840}
2841
2842impl Sealed for FirmwareStatusNotificationResponse {}
2843impl Response for FirmwareStatusNotificationResponse {}
2844
2845/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2846#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2847pub struct Get15118EVCertificateRequest {
2848    /// Schema version currently used for the 15118 session between EV and Charging Station. Needed for parsing of the EXI stream by the CSMS.
2849    #[serde(rename = "iso15118SchemaVersion")]
2850    pub iso15118_schema_version: String,
2851    /// The `action` member.
2852    pub action: CertificateAction,
2853    /// *(2.1)* Raw CertificateInstallationReq request from EV, Base64 encoded. +
2854    /// Extended to support ISO 15118-20 certificates. The minimum supported length is 11000. If a longer _exiRequest_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateRequest.exiRequest" \].
2855    #[serde(rename = "exiRequest")]
2856    pub exi_request: String,
2857    /// *(2.1)* Absent during ISO 15118-2 session. Required during ISO 15118-20 session. +
2858    /// Maximum number of contracts that EV wants to install.
2859    #[serde(rename = "maximumContractCertificateChains")]
2860    #[serde(default, skip_serializing_if = "Option::is_none")]
2861    pub maximum_contract_certificate_chains: Option<i32>,
2862    /// *(2.1)*  Absent during ISO 15118-2 session. Optional during ISO 15118-20 session. List of EMAIDs for which contract certificates must be requested first, in case there are more certificates than allowed by _maximumContractCertificateChains_.
2863    #[serde(rename = "prioritizedEMAIDs")]
2864    #[serde(default, skip_serializing_if = "Option::is_none")]
2865    pub prioritized_emai_ds: Option<Vec<String>>,
2866    /// The `customData` member.
2867    #[serde(rename = "customData")]
2868    #[serde(default, skip_serializing_if = "Option::is_none")]
2869    pub custom_data: Option<crate::types::CustomData>,
2870}
2871
2872impl Get15118EVCertificateRequest {
2873    /// Creates a `Get15118EVCertificateRequest` from its required fields.
2874    #[must_use]
2875    pub fn new(
2876        iso15118_schema_version: impl Into<String>,
2877        action: CertificateAction,
2878        exi_request: impl Into<String>,
2879    ) -> Self {
2880        Self {
2881            iso15118_schema_version: iso15118_schema_version.into(),
2882            action,
2883            exi_request: exi_request.into(),
2884            maximum_contract_certificate_chains: None,
2885            prioritized_emai_ds: None,
2886            custom_data: None,
2887        }
2888    }
2889
2890    /// Sets the optional `maximumContractCertificateChains` field.
2891    #[must_use]
2892    pub fn with_maximum_contract_certificate_chains(mut self, value: i32) -> Self {
2893        self.maximum_contract_certificate_chains = Some(value);
2894        self
2895    }
2896
2897    /// Sets the optional `prioritizedEMAIDs` field.
2898    #[must_use]
2899    pub fn with_prioritized_emai_ds(
2900        mut self,
2901        value: impl IntoIterator<Item = impl Into<String>>,
2902    ) -> Self {
2903        self.prioritized_emai_ds = Some(value.into_iter().map(Into::into).collect());
2904        self
2905    }
2906
2907    /// Sets the optional `customData` field.
2908    #[must_use]
2909    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
2910        self.custom_data = Some(value);
2911        self
2912    }
2913}
2914
2915impl Validate for Get15118EVCertificateRequest {
2916    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2917        path.push_key("iso15118SchemaVersion");
2918        validate::string(
2919            self.iso15118_schema_version.as_str(),
2920            None,
2921            Some(50),
2922            path,
2923            out,
2924        );
2925        path.pop();
2926        path.push_key("action");
2927        Validate::validate_at(&self.action, path, out);
2928        path.pop();
2929        path.push_key("exiRequest");
2930        validate::string(self.exi_request.as_str(), None, Some(11000), path, out);
2931        path.pop();
2932        path.push_key("maximumContractCertificateChains");
2933        if let Some(value) = &self.maximum_contract_certificate_chains {
2934            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
2935        }
2936        path.pop();
2937        path.push_key("prioritizedEMAIDs");
2938        if let Some(value) = &self.prioritized_emai_ds {
2939            validate::list_len(value.len(), Some(1), Some(8), path, out);
2940            for (index, item) in value.iter().enumerate() {
2941                path.push_index(index);
2942                validate::string(item.as_str(), None, Some(255), path, out);
2943                path.pop();
2944            }
2945        }
2946        path.pop();
2947        path.push_key("customData");
2948        if let Some(value) = &self.custom_data {
2949            Validate::validate_at(value, path, out);
2950        }
2951        path.pop();
2952    }
2953}
2954
2955impl Sealed for Get15118EVCertificateRequest {}
2956impl Request for Get15118EVCertificateRequest {
2957    type Action = Action;
2958    const ACTION: Action = Action::Get15118EVCertificate;
2959    const KIND: MessageKind = MessageKind::Call;
2960    const ORIGIN: Origin = Origin::ChargingStation;
2961    type Response = Get15118EVCertificateResponse;
2962}
2963
2964impl Confirmed for Get15118EVCertificateRequest {}
2965
2966/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
2967#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2968pub struct Get15118EVCertificateResponse {
2969    /// The `status` member.
2970    pub status: Iso15118EVCertificateStatus,
2971    /// *(2/1)* Raw CertificateInstallationRes response for the EV, Base64 encoded. +
2972    /// Extended to support ISO 15118-20 certificates. The minimum supported length is 17000. If a longer _exiResponse_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "Get15118EVCertificateResponse.exiResponse" \].
2973    #[serde(rename = "exiResponse")]
2974    pub exi_response: String,
2975    /// The `statusInfo` member.
2976    #[serde(rename = "statusInfo")]
2977    #[serde(default, skip_serializing_if = "Option::is_none")]
2978    pub status_info: Option<StatusInfo>,
2979    /// *(2.1)* Number of contracts that can be retrieved with additional requests.
2980    #[serde(rename = "remainingContracts")]
2981    #[serde(default, skip_serializing_if = "Option::is_none")]
2982    pub remaining_contracts: Option<i32>,
2983    /// The `customData` member.
2984    #[serde(rename = "customData")]
2985    #[serde(default, skip_serializing_if = "Option::is_none")]
2986    pub custom_data: Option<crate::types::CustomData>,
2987}
2988
2989impl Get15118EVCertificateResponse {
2990    /// Creates a `Get15118EVCertificateResponse` from its required fields.
2991    #[must_use]
2992    pub fn new(status: Iso15118EVCertificateStatus, exi_response: impl Into<String>) -> Self {
2993        Self {
2994            status,
2995            exi_response: exi_response.into(),
2996            status_info: None,
2997            remaining_contracts: None,
2998            custom_data: None,
2999        }
3000    }
3001
3002    /// Sets the optional `statusInfo` field.
3003    #[must_use]
3004    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3005        self.status_info = Some(value);
3006        self
3007    }
3008
3009    /// Sets the optional `remainingContracts` field.
3010    #[must_use]
3011    pub fn with_remaining_contracts(mut self, value: i32) -> Self {
3012        self.remaining_contracts = Some(value);
3013        self
3014    }
3015
3016    /// Sets the optional `customData` field.
3017    #[must_use]
3018    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3019        self.custom_data = Some(value);
3020        self
3021    }
3022}
3023
3024impl Validate for Get15118EVCertificateResponse {
3025    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3026        path.push_key("status");
3027        Validate::validate_at(&self.status, path, out);
3028        path.pop();
3029        path.push_key("exiResponse");
3030        validate::string(self.exi_response.as_str(), None, Some(17000), path, out);
3031        path.pop();
3032        path.push_key("statusInfo");
3033        if let Some(value) = &self.status_info {
3034            Validate::validate_at(value, path, out);
3035        }
3036        path.pop();
3037        path.push_key("remainingContracts");
3038        if let Some(value) = &self.remaining_contracts {
3039            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
3040        }
3041        path.pop();
3042        path.push_key("customData");
3043        if let Some(value) = &self.custom_data {
3044            Validate::validate_at(value, path, out);
3045        }
3046        path.pop();
3047    }
3048}
3049
3050impl Sealed for Get15118EVCertificateResponse {}
3051impl Response for Get15118EVCertificateResponse {}
3052
3053/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
3054#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3055pub struct GetBaseReportRequest {
3056    /// The Id of the request.
3057    #[serde(rename = "requestId")]
3058    pub request_id: i32,
3059    /// The `reportBase` member.
3060    #[serde(rename = "reportBase")]
3061    pub report_base: ReportBase,
3062    /// The `customData` member.
3063    #[serde(rename = "customData")]
3064    #[serde(default, skip_serializing_if = "Option::is_none")]
3065    pub custom_data: Option<crate::types::CustomData>,
3066}
3067
3068impl GetBaseReportRequest {
3069    /// Creates a `GetBaseReportRequest` from its required fields.
3070    #[must_use]
3071    pub fn new(request_id: i32, report_base: ReportBase) -> Self {
3072        Self {
3073            request_id,
3074            report_base,
3075            custom_data: None,
3076        }
3077    }
3078
3079    /// Sets the optional `customData` field.
3080    #[must_use]
3081    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3082        self.custom_data = Some(value);
3083        self
3084    }
3085}
3086
3087impl Validate for GetBaseReportRequest {
3088    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3089        path.push_key("reportBase");
3090        Validate::validate_at(&self.report_base, path, out);
3091        path.pop();
3092        path.push_key("customData");
3093        if let Some(value) = &self.custom_data {
3094            Validate::validate_at(value, path, out);
3095        }
3096        path.pop();
3097    }
3098}
3099
3100impl Sealed for GetBaseReportRequest {}
3101impl Request for GetBaseReportRequest {
3102    type Action = Action;
3103    const ACTION: Action = Action::GetBaseReport;
3104    const KIND: MessageKind = MessageKind::Call;
3105    const ORIGIN: Origin = Origin::Csms;
3106    type Response = GetBaseReportResponse;
3107}
3108
3109impl Confirmed for GetBaseReportRequest {}
3110
3111/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
3112#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3113pub struct GetBaseReportResponse {
3114    /// The `status` member.
3115    pub status: GenericDeviceModelStatus,
3116    /// The `statusInfo` member.
3117    #[serde(rename = "statusInfo")]
3118    #[serde(default, skip_serializing_if = "Option::is_none")]
3119    pub status_info: Option<StatusInfo>,
3120    /// The `customData` member.
3121    #[serde(rename = "customData")]
3122    #[serde(default, skip_serializing_if = "Option::is_none")]
3123    pub custom_data: Option<crate::types::CustomData>,
3124}
3125
3126impl GetBaseReportResponse {
3127    /// Creates a `GetBaseReportResponse` from its required fields.
3128    #[must_use]
3129    pub fn new(status: GenericDeviceModelStatus) -> Self {
3130        Self {
3131            status,
3132            status_info: None,
3133            custom_data: None,
3134        }
3135    }
3136
3137    /// Sets the optional `statusInfo` field.
3138    #[must_use]
3139    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3140        self.status_info = Some(value);
3141        self
3142    }
3143
3144    /// Sets the optional `customData` field.
3145    #[must_use]
3146    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3147        self.custom_data = Some(value);
3148        self
3149    }
3150}
3151
3152impl Validate for GetBaseReportResponse {
3153    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3154        path.push_key("status");
3155        Validate::validate_at(&self.status, path, out);
3156        path.pop();
3157        path.push_key("statusInfo");
3158        if let Some(value) = &self.status_info {
3159            Validate::validate_at(value, path, out);
3160        }
3161        path.pop();
3162        path.push_key("customData");
3163        if let Some(value) = &self.custom_data {
3164            Validate::validate_at(value, path, out);
3165        }
3166        path.pop();
3167    }
3168}
3169
3170impl Sealed for GetBaseReportResponse {}
3171impl Response for GetBaseReportResponse {}
3172
3173/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3174#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3175pub struct GetCertificateChainStatusRequest {
3176    /// The `certificateStatusRequests` member.
3177    #[serde(rename = "certificateStatusRequests")]
3178    pub certificate_status_requests: Vec<CertificateStatusRequestInfo>,
3179    /// The `customData` member.
3180    #[serde(rename = "customData")]
3181    #[serde(default, skip_serializing_if = "Option::is_none")]
3182    pub custom_data: Option<crate::types::CustomData>,
3183}
3184
3185impl GetCertificateChainStatusRequest {
3186    /// Creates a `GetCertificateChainStatusRequest` from its required fields.
3187    #[must_use]
3188    pub fn new(certificate_status_requests: Vec<CertificateStatusRequestInfo>) -> Self {
3189        Self {
3190            certificate_status_requests,
3191            custom_data: None,
3192        }
3193    }
3194
3195    /// Sets the optional `customData` field.
3196    #[must_use]
3197    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3198        self.custom_data = Some(value);
3199        self
3200    }
3201}
3202
3203impl Validate for GetCertificateChainStatusRequest {
3204    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3205        path.push_key("certificateStatusRequests");
3206        validate::list_len(
3207            self.certificate_status_requests.len(),
3208            Some(1),
3209            Some(4),
3210            path,
3211            out,
3212        );
3213        for (index, item) in self.certificate_status_requests.iter().enumerate() {
3214            path.push_index(index);
3215            Validate::validate_at(item, path, out);
3216            path.pop();
3217        }
3218        path.pop();
3219        path.push_key("customData");
3220        if let Some(value) = &self.custom_data {
3221            Validate::validate_at(value, path, out);
3222        }
3223        path.pop();
3224    }
3225}
3226
3227impl Sealed for GetCertificateChainStatusRequest {}
3228impl Request for GetCertificateChainStatusRequest {
3229    type Action = Action;
3230    const ACTION: Action = Action::GetCertificateChainStatus;
3231    const KIND: MessageKind = MessageKind::Call;
3232    const ORIGIN: Origin = Origin::ChargingStation;
3233    type Response = GetCertificateChainStatusResponse;
3234}
3235
3236impl Confirmed for GetCertificateChainStatusRequest {}
3237
3238/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3239#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3240pub struct GetCertificateChainStatusResponse {
3241    /// The `certificateStatus` member.
3242    #[serde(rename = "certificateStatus")]
3243    pub certificate_status: Vec<CertificateStatus>,
3244    /// The `customData` member.
3245    #[serde(rename = "customData")]
3246    #[serde(default, skip_serializing_if = "Option::is_none")]
3247    pub custom_data: Option<crate::types::CustomData>,
3248}
3249
3250impl GetCertificateChainStatusResponse {
3251    /// Creates a `GetCertificateChainStatusResponse` from its required fields.
3252    #[must_use]
3253    pub fn new(certificate_status: Vec<CertificateStatus>) -> Self {
3254        Self {
3255            certificate_status,
3256            custom_data: None,
3257        }
3258    }
3259
3260    /// Sets the optional `customData` field.
3261    #[must_use]
3262    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3263        self.custom_data = Some(value);
3264        self
3265    }
3266}
3267
3268impl Validate for GetCertificateChainStatusResponse {
3269    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3270        path.push_key("certificateStatus");
3271        validate::list_len(self.certificate_status.len(), Some(1), Some(4), path, out);
3272        for (index, item) in self.certificate_status.iter().enumerate() {
3273            path.push_index(index);
3274            Validate::validate_at(item, path, out);
3275            path.pop();
3276        }
3277        path.pop();
3278        path.push_key("customData");
3279        if let Some(value) = &self.custom_data {
3280            Validate::validate_at(value, path, out);
3281        }
3282        path.pop();
3283    }
3284}
3285
3286impl Sealed for GetCertificateChainStatusResponse {}
3287impl Response for GetCertificateChainStatusResponse {}
3288
3289/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3290#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3291pub struct GetCertificateStatusRequest {
3292    /// The `ocspRequestData` member.
3293    #[serde(rename = "ocspRequestData")]
3294    pub ocsp_request_data: OCSPRequestData,
3295    /// The `customData` member.
3296    #[serde(rename = "customData")]
3297    #[serde(default, skip_serializing_if = "Option::is_none")]
3298    pub custom_data: Option<crate::types::CustomData>,
3299}
3300
3301impl GetCertificateStatusRequest {
3302    /// Creates a `GetCertificateStatusRequest` from its required fields.
3303    #[must_use]
3304    pub fn new(ocsp_request_data: OCSPRequestData) -> Self {
3305        Self {
3306            ocsp_request_data,
3307            custom_data: None,
3308        }
3309    }
3310
3311    /// Sets the optional `customData` field.
3312    #[must_use]
3313    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3314        self.custom_data = Some(value);
3315        self
3316    }
3317}
3318
3319impl Validate for GetCertificateStatusRequest {
3320    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3321        path.push_key("ocspRequestData");
3322        Validate::validate_at(&self.ocsp_request_data, path, out);
3323        path.pop();
3324        path.push_key("customData");
3325        if let Some(value) = &self.custom_data {
3326            Validate::validate_at(value, path, out);
3327        }
3328        path.pop();
3329    }
3330}
3331
3332impl Sealed for GetCertificateStatusRequest {}
3333impl Request for GetCertificateStatusRequest {
3334    type Action = Action;
3335    const ACTION: Action = Action::GetCertificateStatus;
3336    const KIND: MessageKind = MessageKind::Call;
3337    const ORIGIN: Origin = Origin::ChargingStation;
3338    type Response = GetCertificateStatusResponse;
3339}
3340
3341impl Confirmed for GetCertificateStatusRequest {}
3342
3343/// Spec: OCPP 2.1 · M — Certificate Management · Charging Station → CSMS · CALL.
3344#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3345pub struct GetCertificateStatusResponse {
3346    /// The `status` member.
3347    pub status: GetCertificateStatusEnum,
3348    /// The `statusInfo` member.
3349    #[serde(rename = "statusInfo")]
3350    #[serde(default, skip_serializing_if = "Option::is_none")]
3351    pub status_info: Option<StatusInfo>,
3352    /// *(2.1)* OCSPResponse class as defined in &lt;&lt;ref-ocpp_security_24, IETF RFC 6960&gt;&gt;. DER encoded (as defined in &lt;&lt;ref-ocpp_security_24, IETF RFC 6960&gt;&gt;), and then base64 encoded. MAY only be omitted when status is not Accepted. +
3353    /// The minimum supported length is 18000. If a longer _ocspResult_ is supported, then the supported length must be communicated in variable OCPPCommCtrlr.FieldLength\[ "GetCertificateStatusResponse.ocspResult" \].
3354    #[serde(rename = "ocspResult")]
3355    #[serde(default, skip_serializing_if = "Option::is_none")]
3356    pub ocsp_result: Option<String>,
3357    /// The `customData` member.
3358    #[serde(rename = "customData")]
3359    #[serde(default, skip_serializing_if = "Option::is_none")]
3360    pub custom_data: Option<crate::types::CustomData>,
3361}
3362
3363impl GetCertificateStatusResponse {
3364    /// Creates a `GetCertificateStatusResponse` from its required fields.
3365    #[must_use]
3366    pub fn new(status: GetCertificateStatusEnum) -> Self {
3367        Self {
3368            status,
3369            status_info: None,
3370            ocsp_result: None,
3371            custom_data: None,
3372        }
3373    }
3374
3375    /// Sets the optional `statusInfo` field.
3376    #[must_use]
3377    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3378        self.status_info = Some(value);
3379        self
3380    }
3381
3382    /// Sets the optional `ocspResult` field.
3383    #[must_use]
3384    pub fn with_ocsp_result(mut self, value: impl Into<String>) -> Self {
3385        self.ocsp_result = Some(value.into());
3386        self
3387    }
3388
3389    /// Sets the optional `customData` field.
3390    #[must_use]
3391    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3392        self.custom_data = Some(value);
3393        self
3394    }
3395}
3396
3397impl Validate for GetCertificateStatusResponse {
3398    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3399        path.push_key("status");
3400        Validate::validate_at(&self.status, path, out);
3401        path.pop();
3402        path.push_key("statusInfo");
3403        if let Some(value) = &self.status_info {
3404            Validate::validate_at(value, path, out);
3405        }
3406        path.pop();
3407        path.push_key("ocspResult");
3408        if let Some(value) = &self.ocsp_result {
3409            validate::string(value.as_str(), None, Some(18000), path, out);
3410        }
3411        path.pop();
3412        path.push_key("customData");
3413        if let Some(value) = &self.custom_data {
3414            Validate::validate_at(value, path, out);
3415        }
3416        path.pop();
3417    }
3418}
3419
3420impl Sealed for GetCertificateStatusResponse {}
3421impl Response for GetCertificateStatusResponse {}
3422
3423/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3424#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3425pub struct GetChargingProfilesRequest {
3426    /// Reference identification that is to be used by the Charging Station in the &lt;&lt;reportchargingprofilesrequest, ReportChargingProfilesRequest&gt;&gt; when provided.
3427    #[serde(rename = "requestId")]
3428    pub request_id: i32,
3429    /// The `chargingProfile` member.
3430    #[serde(rename = "chargingProfile")]
3431    pub charging_profile: ChargingProfileCriterion,
3432    /// 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. +
3433    /// Reported charging profiles SHALL match the criteria in field _chargingProfile_.
3434    #[serde(rename = "evseId")]
3435    #[serde(default, skip_serializing_if = "Option::is_none")]
3436    pub evse_id: Option<i32>,
3437    /// The `customData` member.
3438    #[serde(rename = "customData")]
3439    #[serde(default, skip_serializing_if = "Option::is_none")]
3440    pub custom_data: Option<crate::types::CustomData>,
3441}
3442
3443impl GetChargingProfilesRequest {
3444    /// Creates a `GetChargingProfilesRequest` from its required fields.
3445    #[must_use]
3446    pub fn new(request_id: i32, charging_profile: ChargingProfileCriterion) -> Self {
3447        Self {
3448            request_id,
3449            charging_profile,
3450            evse_id: None,
3451            custom_data: None,
3452        }
3453    }
3454
3455    /// Sets the optional `evseId` field.
3456    #[must_use]
3457    pub fn with_evse_id(mut self, value: i32) -> Self {
3458        self.evse_id = Some(value);
3459        self
3460    }
3461
3462    /// Sets the optional `customData` field.
3463    #[must_use]
3464    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3465        self.custom_data = Some(value);
3466        self
3467    }
3468}
3469
3470impl Validate for GetChargingProfilesRequest {
3471    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3472        path.push_key("chargingProfile");
3473        Validate::validate_at(&self.charging_profile, path, out);
3474        path.pop();
3475        path.push_key("evseId");
3476        if let Some(value) = &self.evse_id {
3477            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
3478        }
3479        path.pop();
3480        path.push_key("customData");
3481        if let Some(value) = &self.custom_data {
3482            Validate::validate_at(value, path, out);
3483        }
3484        path.pop();
3485    }
3486}
3487
3488impl Sealed for GetChargingProfilesRequest {}
3489impl Request for GetChargingProfilesRequest {
3490    type Action = Action;
3491    const ACTION: Action = Action::GetChargingProfiles;
3492    const KIND: MessageKind = MessageKind::Call;
3493    const ORIGIN: Origin = Origin::Csms;
3494    type Response = GetChargingProfilesResponse;
3495}
3496
3497impl Confirmed for GetChargingProfilesRequest {}
3498
3499/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3500#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3501pub struct GetChargingProfilesResponse {
3502    /// The `status` member.
3503    pub status: GetChargingProfileStatus,
3504    /// The `statusInfo` member.
3505    #[serde(rename = "statusInfo")]
3506    #[serde(default, skip_serializing_if = "Option::is_none")]
3507    pub status_info: Option<StatusInfo>,
3508    /// The `customData` member.
3509    #[serde(rename = "customData")]
3510    #[serde(default, skip_serializing_if = "Option::is_none")]
3511    pub custom_data: Option<crate::types::CustomData>,
3512}
3513
3514impl GetChargingProfilesResponse {
3515    /// Creates a `GetChargingProfilesResponse` from its required fields.
3516    #[must_use]
3517    pub fn new(status: GetChargingProfileStatus) -> Self {
3518        Self {
3519            status,
3520            status_info: None,
3521            custom_data: None,
3522        }
3523    }
3524
3525    /// Sets the optional `statusInfo` field.
3526    #[must_use]
3527    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3528        self.status_info = Some(value);
3529        self
3530    }
3531
3532    /// Sets the optional `customData` field.
3533    #[must_use]
3534    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3535        self.custom_data = Some(value);
3536        self
3537    }
3538}
3539
3540impl Validate for GetChargingProfilesResponse {
3541    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3542        path.push_key("status");
3543        Validate::validate_at(&self.status, path, out);
3544        path.pop();
3545        path.push_key("statusInfo");
3546        if let Some(value) = &self.status_info {
3547            Validate::validate_at(value, path, out);
3548        }
3549        path.pop();
3550        path.push_key("customData");
3551        if let Some(value) = &self.custom_data {
3552            Validate::validate_at(value, path, out);
3553        }
3554        path.pop();
3555    }
3556}
3557
3558impl Sealed for GetChargingProfilesResponse {}
3559impl Response for GetChargingProfilesResponse {}
3560
3561/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3562#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3563pub struct GetCompositeScheduleRequest {
3564    /// Length of the requested schedule in seconds.
3565    pub duration: i32,
3566    /// 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.
3567    #[serde(rename = "evseId")]
3568    pub evse_id: i32,
3569    /// The `chargingRateUnit` member.
3570    #[serde(rename = "chargingRateUnit")]
3571    #[serde(default, skip_serializing_if = "Option::is_none")]
3572    pub charging_rate_unit: Option<ChargingRateUnit>,
3573    /// The `customData` member.
3574    #[serde(rename = "customData")]
3575    #[serde(default, skip_serializing_if = "Option::is_none")]
3576    pub custom_data: Option<crate::types::CustomData>,
3577}
3578
3579impl GetCompositeScheduleRequest {
3580    /// Creates a `GetCompositeScheduleRequest` from its required fields.
3581    #[must_use]
3582    pub fn new(duration: i32, evse_id: i32) -> Self {
3583        Self {
3584            duration,
3585            evse_id,
3586            charging_rate_unit: None,
3587            custom_data: None,
3588        }
3589    }
3590
3591    /// Sets the optional `chargingRateUnit` field.
3592    #[must_use]
3593    pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
3594        self.charging_rate_unit = Some(value);
3595        self
3596    }
3597
3598    /// Sets the optional `customData` field.
3599    #[must_use]
3600    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3601        self.custom_data = Some(value);
3602        self
3603    }
3604}
3605
3606impl Validate for GetCompositeScheduleRequest {
3607    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3608        path.push_key("evseId");
3609        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
3610        path.pop();
3611        path.push_key("chargingRateUnit");
3612        if let Some(value) = &self.charging_rate_unit {
3613            Validate::validate_at(value, path, out);
3614        }
3615        path.pop();
3616        path.push_key("customData");
3617        if let Some(value) = &self.custom_data {
3618            Validate::validate_at(value, path, out);
3619        }
3620        path.pop();
3621    }
3622}
3623
3624impl Sealed for GetCompositeScheduleRequest {}
3625impl Request for GetCompositeScheduleRequest {
3626    type Action = Action;
3627    const ACTION: Action = Action::GetCompositeSchedule;
3628    const KIND: MessageKind = MessageKind::Call;
3629    const ORIGIN: Origin = Origin::Csms;
3630    type Response = GetCompositeScheduleResponse;
3631}
3632
3633impl Confirmed for GetCompositeScheduleRequest {}
3634
3635/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
3636#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3637pub struct GetCompositeScheduleResponse {
3638    /// The `status` member.
3639    pub status: GenericStatus,
3640    /// The `statusInfo` member.
3641    #[serde(rename = "statusInfo")]
3642    #[serde(default, skip_serializing_if = "Option::is_none")]
3643    pub status_info: Option<StatusInfo>,
3644    /// The `schedule` member.
3645    #[serde(default, skip_serializing_if = "Option::is_none")]
3646    pub schedule: Option<CompositeSchedule>,
3647    /// The `customData` member.
3648    #[serde(rename = "customData")]
3649    #[serde(default, skip_serializing_if = "Option::is_none")]
3650    pub custom_data: Option<crate::types::CustomData>,
3651}
3652
3653impl GetCompositeScheduleResponse {
3654    /// Creates a `GetCompositeScheduleResponse` from its required fields.
3655    #[must_use]
3656    pub fn new(status: GenericStatus) -> Self {
3657        Self {
3658            status,
3659            status_info: None,
3660            schedule: None,
3661            custom_data: None,
3662        }
3663    }
3664
3665    /// Sets the optional `statusInfo` field.
3666    #[must_use]
3667    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3668        self.status_info = Some(value);
3669        self
3670    }
3671
3672    /// Sets the optional `schedule` field.
3673    #[must_use]
3674    pub fn with_schedule(mut self, value: CompositeSchedule) -> Self {
3675        self.schedule = Some(value);
3676        self
3677    }
3678
3679    /// Sets the optional `customData` field.
3680    #[must_use]
3681    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3682        self.custom_data = Some(value);
3683        self
3684    }
3685}
3686
3687impl Validate for GetCompositeScheduleResponse {
3688    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3689        path.push_key("status");
3690        Validate::validate_at(&self.status, path, out);
3691        path.pop();
3692        path.push_key("statusInfo");
3693        if let Some(value) = &self.status_info {
3694            Validate::validate_at(value, path, out);
3695        }
3696        path.pop();
3697        path.push_key("schedule");
3698        if let Some(value) = &self.schedule {
3699            Validate::validate_at(value, path, out);
3700        }
3701        path.pop();
3702        path.push_key("customData");
3703        if let Some(value) = &self.custom_data {
3704            Validate::validate_at(value, path, out);
3705        }
3706        path.pop();
3707    }
3708}
3709
3710impl Sealed for GetCompositeScheduleResponse {}
3711impl Response for GetCompositeScheduleResponse {}
3712
3713/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
3714#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3715pub struct GetDERControlRequest {
3716    /// RequestId to be used in ReportDERControlRequest.
3717    #[serde(rename = "requestId")]
3718    pub request_id: i32,
3719    /// True: get a default DER control. False: get a scheduled control.
3720    #[serde(rename = "isDefault")]
3721    #[serde(default, skip_serializing_if = "Option::is_none")]
3722    pub is_default: Option<bool>,
3723    /// The `controlType` member.
3724    #[serde(rename = "controlType")]
3725    #[serde(default, skip_serializing_if = "Option::is_none")]
3726    pub control_type: Option<DERControl>,
3727    /// Id of setting to get. When omitted all settings for _controlType_ are retrieved.
3728    #[serde(rename = "controlId")]
3729    #[serde(default, skip_serializing_if = "Option::is_none")]
3730    pub control_id: Option<String>,
3731    /// The `customData` member.
3732    #[serde(rename = "customData")]
3733    #[serde(default, skip_serializing_if = "Option::is_none")]
3734    pub custom_data: Option<crate::types::CustomData>,
3735}
3736
3737impl GetDERControlRequest {
3738    /// Creates a `GetDERControlRequest` from its required fields.
3739    #[must_use]
3740    pub fn new(request_id: i32) -> Self {
3741        Self {
3742            request_id,
3743            is_default: None,
3744            control_type: None,
3745            control_id: None,
3746            custom_data: None,
3747        }
3748    }
3749
3750    /// Sets the optional `isDefault` field.
3751    #[must_use]
3752    pub fn with_is_default(mut self, value: bool) -> Self {
3753        self.is_default = Some(value);
3754        self
3755    }
3756
3757    /// Sets the optional `controlType` field.
3758    #[must_use]
3759    pub fn with_control_type(mut self, value: DERControl) -> Self {
3760        self.control_type = Some(value);
3761        self
3762    }
3763
3764    /// Sets the optional `controlId` field.
3765    #[must_use]
3766    pub fn with_control_id(mut self, value: impl Into<String>) -> Self {
3767        self.control_id = Some(value.into());
3768        self
3769    }
3770
3771    /// Sets the optional `customData` field.
3772    #[must_use]
3773    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3774        self.custom_data = Some(value);
3775        self
3776    }
3777}
3778
3779impl Validate for GetDERControlRequest {
3780    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3781        path.push_key("controlType");
3782        if let Some(value) = &self.control_type {
3783            Validate::validate_at(value, path, out);
3784        }
3785        path.pop();
3786        path.push_key("controlId");
3787        if let Some(value) = &self.control_id {
3788            validate::string(value.as_str(), None, Some(36), path, out);
3789        }
3790        path.pop();
3791        path.push_key("customData");
3792        if let Some(value) = &self.custom_data {
3793            Validate::validate_at(value, path, out);
3794        }
3795        path.pop();
3796    }
3797}
3798
3799impl Sealed for GetDERControlRequest {}
3800impl Request for GetDERControlRequest {
3801    type Action = Action;
3802    const ACTION: Action = Action::GetDERControl;
3803    const KIND: MessageKind = MessageKind::Call;
3804    const ORIGIN: Origin = Origin::Csms;
3805    type Response = GetDERControlResponse;
3806}
3807
3808impl Confirmed for GetDERControlRequest {}
3809
3810/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
3811#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3812pub struct GetDERControlResponse {
3813    /// The `status` member.
3814    pub status: DERControlStatus,
3815    /// The `statusInfo` member.
3816    #[serde(rename = "statusInfo")]
3817    #[serde(default, skip_serializing_if = "Option::is_none")]
3818    pub status_info: Option<StatusInfo>,
3819    /// The `customData` member.
3820    #[serde(rename = "customData")]
3821    #[serde(default, skip_serializing_if = "Option::is_none")]
3822    pub custom_data: Option<crate::types::CustomData>,
3823}
3824
3825impl GetDERControlResponse {
3826    /// Creates a `GetDERControlResponse` from its required fields.
3827    #[must_use]
3828    pub fn new(status: DERControlStatus) -> Self {
3829        Self {
3830            status,
3831            status_info: None,
3832            custom_data: None,
3833        }
3834    }
3835
3836    /// Sets the optional `statusInfo` field.
3837    #[must_use]
3838    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
3839        self.status_info = Some(value);
3840        self
3841    }
3842
3843    /// Sets the optional `customData` field.
3844    #[must_use]
3845    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3846        self.custom_data = Some(value);
3847        self
3848    }
3849}
3850
3851impl Validate for GetDERControlResponse {
3852    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3853        path.push_key("status");
3854        Validate::validate_at(&self.status, path, out);
3855        path.pop();
3856        path.push_key("statusInfo");
3857        if let Some(value) = &self.status_info {
3858            Validate::validate_at(value, path, out);
3859        }
3860        path.pop();
3861        path.push_key("customData");
3862        if let Some(value) = &self.custom_data {
3863            Validate::validate_at(value, path, out);
3864        }
3865        path.pop();
3866    }
3867}
3868
3869impl Sealed for GetDERControlResponse {}
3870impl Response for GetDERControlResponse {}
3871
3872/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
3873#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3874pub struct GetDisplayMessagesRequest {
3875    /// The Id of this request.
3876    #[serde(rename = "requestId")]
3877    pub request_id: i32,
3878    /// 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;
3879    #[serde(default, skip_serializing_if = "Option::is_none")]
3880    pub id: Option<Vec<i32>>,
3881    /// The `priority` member.
3882    #[serde(default, skip_serializing_if = "Option::is_none")]
3883    pub priority: Option<MessagePriority>,
3884    /// The `state` member.
3885    #[serde(default, skip_serializing_if = "Option::is_none")]
3886    pub state: Option<MessageState>,
3887    /// The `customData` member.
3888    #[serde(rename = "customData")]
3889    #[serde(default, skip_serializing_if = "Option::is_none")]
3890    pub custom_data: Option<crate::types::CustomData>,
3891}
3892
3893impl GetDisplayMessagesRequest {
3894    /// Creates a `GetDisplayMessagesRequest` from its required fields.
3895    #[must_use]
3896    pub fn new(request_id: i32) -> Self {
3897        Self {
3898            request_id,
3899            id: None,
3900            priority: None,
3901            state: None,
3902            custom_data: None,
3903        }
3904    }
3905
3906    /// Sets the optional `id` field.
3907    #[must_use]
3908    pub fn with_id(mut self, value: Vec<i32>) -> Self {
3909        self.id = Some(value);
3910        self
3911    }
3912
3913    /// Sets the optional `priority` field.
3914    #[must_use]
3915    pub fn with_priority(mut self, value: MessagePriority) -> Self {
3916        self.priority = Some(value);
3917        self
3918    }
3919
3920    /// Sets the optional `state` field.
3921    #[must_use]
3922    pub fn with_state(mut self, value: MessageState) -> Self {
3923        self.state = Some(value);
3924        self
3925    }
3926
3927    /// Sets the optional `customData` field.
3928    #[must_use]
3929    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
3930        self.custom_data = Some(value);
3931        self
3932    }
3933}
3934
3935impl Validate for GetDisplayMessagesRequest {
3936    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3937        path.push_key("id");
3938        if let Some(value) = &self.id {
3939            validate::list_len(value.len(), Some(1), None, path, out);
3940            for (index, item) in value.iter().enumerate() {
3941                path.push_index(index);
3942                validate::int_range(i64::from(*item), Some(0.0), None, path, out);
3943                path.pop();
3944            }
3945        }
3946        path.pop();
3947        path.push_key("priority");
3948        if let Some(value) = &self.priority {
3949            Validate::validate_at(value, path, out);
3950        }
3951        path.pop();
3952        path.push_key("state");
3953        if let Some(value) = &self.state {
3954            Validate::validate_at(value, path, out);
3955        }
3956        path.pop();
3957        path.push_key("customData");
3958        if let Some(value) = &self.custom_data {
3959            Validate::validate_at(value, path, out);
3960        }
3961        path.pop();
3962    }
3963}
3964
3965impl Sealed for GetDisplayMessagesRequest {}
3966impl Request for GetDisplayMessagesRequest {
3967    type Action = Action;
3968    const ACTION: Action = Action::GetDisplayMessages;
3969    const KIND: MessageKind = MessageKind::Call;
3970    const ORIGIN: Origin = Origin::Csms;
3971    type Response = GetDisplayMessagesResponse;
3972}
3973
3974impl Confirmed for GetDisplayMessagesRequest {}
3975
3976/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
3977#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3978pub struct GetDisplayMessagesResponse {
3979    /// The `status` member.
3980    pub status: GetDisplayMessagesStatus,
3981    /// The `statusInfo` member.
3982    #[serde(rename = "statusInfo")]
3983    #[serde(default, skip_serializing_if = "Option::is_none")]
3984    pub status_info: Option<StatusInfo>,
3985    /// The `customData` member.
3986    #[serde(rename = "customData")]
3987    #[serde(default, skip_serializing_if = "Option::is_none")]
3988    pub custom_data: Option<crate::types::CustomData>,
3989}
3990
3991impl GetDisplayMessagesResponse {
3992    /// Creates a `GetDisplayMessagesResponse` from its required fields.
3993    #[must_use]
3994    pub fn new(status: GetDisplayMessagesStatus) -> Self {
3995        Self {
3996            status,
3997            status_info: None,
3998            custom_data: None,
3999        }
4000    }
4001
4002    /// Sets the optional `statusInfo` field.
4003    #[must_use]
4004    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4005        self.status_info = Some(value);
4006        self
4007    }
4008
4009    /// Sets the optional `customData` field.
4010    #[must_use]
4011    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4012        self.custom_data = Some(value);
4013        self
4014    }
4015}
4016
4017impl Validate for GetDisplayMessagesResponse {
4018    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4019        path.push_key("status");
4020        Validate::validate_at(&self.status, path, out);
4021        path.pop();
4022        path.push_key("statusInfo");
4023        if let Some(value) = &self.status_info {
4024            Validate::validate_at(value, path, out);
4025        }
4026        path.pop();
4027        path.push_key("customData");
4028        if let Some(value) = &self.custom_data {
4029            Validate::validate_at(value, path, out);
4030        }
4031        path.pop();
4032    }
4033}
4034
4035impl Sealed for GetDisplayMessagesResponse {}
4036impl Response for GetDisplayMessagesResponse {}
4037
4038/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
4039#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4040pub struct GetInstalledCertificateIdsRequest {
4041    /// Indicates the type of certificates requested. When omitted, all certificate types are requested.
4042    #[serde(rename = "certificateType")]
4043    #[serde(default, skip_serializing_if = "Option::is_none")]
4044    pub certificate_type: Option<Vec<GetCertificateIdUse>>,
4045    /// The `customData` member.
4046    #[serde(rename = "customData")]
4047    #[serde(default, skip_serializing_if = "Option::is_none")]
4048    pub custom_data: Option<crate::types::CustomData>,
4049}
4050
4051impl GetInstalledCertificateIdsRequest {
4052    /// Creates an empty `GetInstalledCertificateIdsRequest`. Every field of this type is optional.
4053    #[must_use]
4054    pub fn new() -> Self {
4055        Self::default()
4056    }
4057
4058    /// Sets the optional `certificateType` field.
4059    #[must_use]
4060    pub fn with_certificate_type(mut self, value: Vec<GetCertificateIdUse>) -> Self {
4061        self.certificate_type = Some(value);
4062        self
4063    }
4064
4065    /// Sets the optional `customData` field.
4066    #[must_use]
4067    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4068        self.custom_data = Some(value);
4069        self
4070    }
4071}
4072
4073impl Validate for GetInstalledCertificateIdsRequest {
4074    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4075        path.push_key("certificateType");
4076        if let Some(value) = &self.certificate_type {
4077            validate::list_len(value.len(), Some(1), None, path, out);
4078            for (index, item) in value.iter().enumerate() {
4079                path.push_index(index);
4080                Validate::validate_at(item, path, out);
4081                path.pop();
4082            }
4083        }
4084        path.pop();
4085        path.push_key("customData");
4086        if let Some(value) = &self.custom_data {
4087            Validate::validate_at(value, path, out);
4088        }
4089        path.pop();
4090    }
4091}
4092
4093impl Sealed for GetInstalledCertificateIdsRequest {}
4094impl Request for GetInstalledCertificateIdsRequest {
4095    type Action = Action;
4096    const ACTION: Action = Action::GetInstalledCertificateIds;
4097    const KIND: MessageKind = MessageKind::Call;
4098    const ORIGIN: Origin = Origin::Csms;
4099    type Response = GetInstalledCertificateIdsResponse;
4100}
4101
4102impl Confirmed for GetInstalledCertificateIdsRequest {}
4103
4104/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
4105#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4106pub struct GetInstalledCertificateIdsResponse {
4107    /// The `status` member.
4108    pub status: GetInstalledCertificateStatus,
4109    /// The `statusInfo` member.
4110    #[serde(rename = "statusInfo")]
4111    #[serde(default, skip_serializing_if = "Option::is_none")]
4112    pub status_info: Option<StatusInfo>,
4113    /// The `certificateHashDataChain` member.
4114    #[serde(rename = "certificateHashDataChain")]
4115    #[serde(default, skip_serializing_if = "Option::is_none")]
4116    pub certificate_hash_data_chain: Option<Vec<CertificateHashDataChain>>,
4117    /// The `customData` member.
4118    #[serde(rename = "customData")]
4119    #[serde(default, skip_serializing_if = "Option::is_none")]
4120    pub custom_data: Option<crate::types::CustomData>,
4121}
4122
4123impl GetInstalledCertificateIdsResponse {
4124    /// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
4125    #[must_use]
4126    pub fn new(status: GetInstalledCertificateStatus) -> Self {
4127        Self {
4128            status,
4129            status_info: None,
4130            certificate_hash_data_chain: None,
4131            custom_data: None,
4132        }
4133    }
4134
4135    /// Sets the optional `statusInfo` field.
4136    #[must_use]
4137    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4138        self.status_info = Some(value);
4139        self
4140    }
4141
4142    /// Sets the optional `certificateHashDataChain` field.
4143    #[must_use]
4144    pub fn with_certificate_hash_data_chain(
4145        mut self,
4146        value: Vec<CertificateHashDataChain>,
4147    ) -> Self {
4148        self.certificate_hash_data_chain = Some(value);
4149        self
4150    }
4151
4152    /// Sets the optional `customData` field.
4153    #[must_use]
4154    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4155        self.custom_data = Some(value);
4156        self
4157    }
4158}
4159
4160impl Validate for GetInstalledCertificateIdsResponse {
4161    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4162        path.push_key("status");
4163        Validate::validate_at(&self.status, path, out);
4164        path.pop();
4165        path.push_key("statusInfo");
4166        if let Some(value) = &self.status_info {
4167            Validate::validate_at(value, path, out);
4168        }
4169        path.pop();
4170        path.push_key("certificateHashDataChain");
4171        if let Some(value) = &self.certificate_hash_data_chain {
4172            validate::list_len(value.len(), Some(1), None, path, out);
4173            for (index, item) in value.iter().enumerate() {
4174                path.push_index(index);
4175                Validate::validate_at(item, path, out);
4176                path.pop();
4177            }
4178        }
4179        path.pop();
4180        path.push_key("customData");
4181        if let Some(value) = &self.custom_data {
4182            Validate::validate_at(value, path, out);
4183        }
4184        path.pop();
4185    }
4186}
4187
4188impl Sealed for GetInstalledCertificateIdsResponse {}
4189impl Response for GetInstalledCertificateIdsResponse {}
4190
4191/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
4192#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4193pub struct GetLocalListVersionRequest {
4194    /// The `customData` member.
4195    #[serde(rename = "customData")]
4196    #[serde(default, skip_serializing_if = "Option::is_none")]
4197    pub custom_data: Option<crate::types::CustomData>,
4198}
4199
4200impl GetLocalListVersionRequest {
4201    /// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
4202    #[must_use]
4203    pub fn new() -> Self {
4204        Self::default()
4205    }
4206
4207    /// Sets the optional `customData` field.
4208    #[must_use]
4209    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4210        self.custom_data = Some(value);
4211        self
4212    }
4213}
4214
4215impl Validate for GetLocalListVersionRequest {
4216    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4217        path.push_key("customData");
4218        if let Some(value) = &self.custom_data {
4219            Validate::validate_at(value, path, out);
4220        }
4221        path.pop();
4222    }
4223}
4224
4225impl Sealed for GetLocalListVersionRequest {}
4226impl Request for GetLocalListVersionRequest {
4227    type Action = Action;
4228    const ACTION: Action = Action::GetLocalListVersion;
4229    const KIND: MessageKind = MessageKind::Call;
4230    const ORIGIN: Origin = Origin::Csms;
4231    type Response = GetLocalListVersionResponse;
4232}
4233
4234impl Confirmed for GetLocalListVersionRequest {}
4235
4236/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
4237#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4238pub struct GetLocalListVersionResponse {
4239    /// This contains the current version number of the local authorization list in the Charging Station.
4240    #[serde(rename = "versionNumber")]
4241    pub version_number: i32,
4242    /// The `customData` member.
4243    #[serde(rename = "customData")]
4244    #[serde(default, skip_serializing_if = "Option::is_none")]
4245    pub custom_data: Option<crate::types::CustomData>,
4246}
4247
4248impl GetLocalListVersionResponse {
4249    /// Creates a `GetLocalListVersionResponse` from its required fields.
4250    #[must_use]
4251    pub fn new(version_number: i32) -> Self {
4252        Self {
4253            version_number,
4254            custom_data: None,
4255        }
4256    }
4257
4258    /// Sets the optional `customData` field.
4259    #[must_use]
4260    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4261        self.custom_data = Some(value);
4262        self
4263    }
4264}
4265
4266impl Validate for GetLocalListVersionResponse {
4267    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4268        path.push_key("customData");
4269        if let Some(value) = &self.custom_data {
4270            Validate::validate_at(value, path, out);
4271        }
4272        path.pop();
4273    }
4274}
4275
4276impl Sealed for GetLocalListVersionResponse {}
4277impl Response for GetLocalListVersionResponse {}
4278
4279/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4280#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4281pub struct GetLogRequest {
4282    /// The `log` member.
4283    pub log: LogParameters,
4284    /// The `logType` member.
4285    #[serde(rename = "logType")]
4286    pub log_type: Log,
4287    /// The Id of this request
4288    #[serde(rename = "requestId")]
4289    pub request_id: i32,
4290    /// This specifies how many times the Charging Station must retry to upload the log before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry. If the value is 0, it means: no retries.
4291    #[serde(default, skip_serializing_if = "Option::is_none")]
4292    pub retries: Option<i32>,
4293    /// 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.
4294    #[serde(rename = "retryInterval")]
4295    #[serde(default, skip_serializing_if = "Option::is_none")]
4296    pub retry_interval: Option<i32>,
4297    /// The `customData` member.
4298    #[serde(rename = "customData")]
4299    #[serde(default, skip_serializing_if = "Option::is_none")]
4300    pub custom_data: Option<crate::types::CustomData>,
4301}
4302
4303impl GetLogRequest {
4304    /// Creates a `GetLogRequest` from its required fields.
4305    #[must_use]
4306    pub fn new(log: LogParameters, log_type: Log, request_id: i32) -> Self {
4307        Self {
4308            log,
4309            log_type,
4310            request_id,
4311            retries: None,
4312            retry_interval: None,
4313            custom_data: None,
4314        }
4315    }
4316
4317    /// Sets the optional `retries` field.
4318    #[must_use]
4319    pub fn with_retries(mut self, value: i32) -> Self {
4320        self.retries = Some(value);
4321        self
4322    }
4323
4324    /// Sets the optional `retryInterval` field.
4325    #[must_use]
4326    pub fn with_retry_interval(mut self, value: i32) -> Self {
4327        self.retry_interval = Some(value);
4328        self
4329    }
4330
4331    /// Sets the optional `customData` field.
4332    #[must_use]
4333    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4334        self.custom_data = Some(value);
4335        self
4336    }
4337}
4338
4339impl Validate for GetLogRequest {
4340    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4341        path.push_key("log");
4342        Validate::validate_at(&self.log, path, out);
4343        path.pop();
4344        path.push_key("logType");
4345        Validate::validate_at(&self.log_type, path, out);
4346        path.pop();
4347        path.push_key("retries");
4348        if let Some(value) = &self.retries {
4349            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
4350        }
4351        path.pop();
4352        path.push_key("customData");
4353        if let Some(value) = &self.custom_data {
4354            Validate::validate_at(value, path, out);
4355        }
4356        path.pop();
4357    }
4358}
4359
4360impl Sealed for GetLogRequest {}
4361impl Request for GetLogRequest {
4362    type Action = Action;
4363    const ACTION: Action = Action::GetLog;
4364    const KIND: MessageKind = MessageKind::Call;
4365    const ORIGIN: Origin = Origin::Csms;
4366    type Response = GetLogResponse;
4367}
4368
4369impl Confirmed for GetLogRequest {}
4370
4371/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4372#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4373pub struct GetLogResponse {
4374    /// The `status` member.
4375    pub status: LogStatus,
4376    /// The `statusInfo` member.
4377    #[serde(rename = "statusInfo")]
4378    #[serde(default, skip_serializing_if = "Option::is_none")]
4379    pub status_info: Option<StatusInfo>,
4380    /// This contains the name of the log file that will be uploaded. This field is not present when no logging information is available.
4381    #[serde(default, skip_serializing_if = "Option::is_none")]
4382    pub filename: Option<String>,
4383    /// The `customData` member.
4384    #[serde(rename = "customData")]
4385    #[serde(default, skip_serializing_if = "Option::is_none")]
4386    pub custom_data: Option<crate::types::CustomData>,
4387}
4388
4389impl GetLogResponse {
4390    /// Creates a `GetLogResponse` from its required fields.
4391    #[must_use]
4392    pub fn new(status: LogStatus) -> Self {
4393        Self {
4394            status,
4395            status_info: None,
4396            filename: None,
4397            custom_data: None,
4398        }
4399    }
4400
4401    /// Sets the optional `statusInfo` field.
4402    #[must_use]
4403    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4404        self.status_info = Some(value);
4405        self
4406    }
4407
4408    /// Sets the optional `filename` field.
4409    #[must_use]
4410    pub fn with_filename(mut self, value: impl Into<String>) -> Self {
4411        self.filename = Some(value.into());
4412        self
4413    }
4414
4415    /// Sets the optional `customData` field.
4416    #[must_use]
4417    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4418        self.custom_data = Some(value);
4419        self
4420    }
4421}
4422
4423impl Validate for GetLogResponse {
4424    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4425        path.push_key("status");
4426        Validate::validate_at(&self.status, path, out);
4427        path.pop();
4428        path.push_key("statusInfo");
4429        if let Some(value) = &self.status_info {
4430            Validate::validate_at(value, path, out);
4431        }
4432        path.pop();
4433        path.push_key("filename");
4434        if let Some(value) = &self.filename {
4435            validate::string(value.as_str(), None, Some(255), path, out);
4436        }
4437        path.pop();
4438        path.push_key("customData");
4439        if let Some(value) = &self.custom_data {
4440            Validate::validate_at(value, path, out);
4441        }
4442        path.pop();
4443    }
4444}
4445
4446impl Sealed for GetLogResponse {}
4447impl Response for GetLogResponse {}
4448
4449/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4450#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4451pub struct GetMonitoringReportRequest {
4452    /// The Id of the request.
4453    #[serde(rename = "requestId")]
4454    pub request_id: i32,
4455    /// The `componentVariable` member.
4456    #[serde(rename = "componentVariable")]
4457    #[serde(default, skip_serializing_if = "Option::is_none")]
4458    pub component_variable: Option<Vec<ComponentVariable>>,
4459    /// This field contains criteria for components for which a monitoring report is requested
4460    #[serde(rename = "monitoringCriteria")]
4461    #[serde(default, skip_serializing_if = "Option::is_none")]
4462    pub monitoring_criteria: Option<Vec<MonitoringCriterion>>,
4463    /// The `customData` member.
4464    #[serde(rename = "customData")]
4465    #[serde(default, skip_serializing_if = "Option::is_none")]
4466    pub custom_data: Option<crate::types::CustomData>,
4467}
4468
4469impl GetMonitoringReportRequest {
4470    /// Creates a `GetMonitoringReportRequest` from its required fields.
4471    #[must_use]
4472    pub fn new(request_id: i32) -> Self {
4473        Self {
4474            request_id,
4475            component_variable: None,
4476            monitoring_criteria: None,
4477            custom_data: None,
4478        }
4479    }
4480
4481    /// Sets the optional `componentVariable` field.
4482    #[must_use]
4483    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
4484        self.component_variable = Some(value);
4485        self
4486    }
4487
4488    /// Sets the optional `monitoringCriteria` field.
4489    #[must_use]
4490    pub fn with_monitoring_criteria(mut self, value: Vec<MonitoringCriterion>) -> Self {
4491        self.monitoring_criteria = Some(value);
4492        self
4493    }
4494
4495    /// Sets the optional `customData` field.
4496    #[must_use]
4497    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4498        self.custom_data = Some(value);
4499        self
4500    }
4501}
4502
4503impl Validate for GetMonitoringReportRequest {
4504    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4505        path.push_key("componentVariable");
4506        if let Some(value) = &self.component_variable {
4507            validate::list_len(value.len(), Some(1), None, path, out);
4508            for (index, item) in value.iter().enumerate() {
4509                path.push_index(index);
4510                Validate::validate_at(item, path, out);
4511                path.pop();
4512            }
4513        }
4514        path.pop();
4515        path.push_key("monitoringCriteria");
4516        if let Some(value) = &self.monitoring_criteria {
4517            validate::list_len(value.len(), Some(1), Some(3), path, out);
4518            for (index, item) in value.iter().enumerate() {
4519                path.push_index(index);
4520                Validate::validate_at(item, path, out);
4521                path.pop();
4522            }
4523        }
4524        path.pop();
4525        path.push_key("customData");
4526        if let Some(value) = &self.custom_data {
4527            Validate::validate_at(value, path, out);
4528        }
4529        path.pop();
4530    }
4531}
4532
4533impl Sealed for GetMonitoringReportRequest {}
4534impl Request for GetMonitoringReportRequest {
4535    type Action = Action;
4536    const ACTION: Action = Action::GetMonitoringReport;
4537    const KIND: MessageKind = MessageKind::Call;
4538    const ORIGIN: Origin = Origin::Csms;
4539    type Response = GetMonitoringReportResponse;
4540}
4541
4542impl Confirmed for GetMonitoringReportRequest {}
4543
4544/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4545#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4546pub struct GetMonitoringReportResponse {
4547    /// The `status` member.
4548    pub status: GenericDeviceModelStatus,
4549    /// The `statusInfo` member.
4550    #[serde(rename = "statusInfo")]
4551    #[serde(default, skip_serializing_if = "Option::is_none")]
4552    pub status_info: Option<StatusInfo>,
4553    /// The `customData` member.
4554    #[serde(rename = "customData")]
4555    #[serde(default, skip_serializing_if = "Option::is_none")]
4556    pub custom_data: Option<crate::types::CustomData>,
4557}
4558
4559impl GetMonitoringReportResponse {
4560    /// Creates a `GetMonitoringReportResponse` from its required fields.
4561    #[must_use]
4562    pub fn new(status: GenericDeviceModelStatus) -> Self {
4563        Self {
4564            status,
4565            status_info: None,
4566            custom_data: None,
4567        }
4568    }
4569
4570    /// Sets the optional `statusInfo` field.
4571    #[must_use]
4572    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4573        self.status_info = Some(value);
4574        self
4575    }
4576
4577    /// Sets the optional `customData` field.
4578    #[must_use]
4579    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4580        self.custom_data = Some(value);
4581        self
4582    }
4583}
4584
4585impl Validate for GetMonitoringReportResponse {
4586    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4587        path.push_key("status");
4588        Validate::validate_at(&self.status, path, out);
4589        path.pop();
4590        path.push_key("statusInfo");
4591        if let Some(value) = &self.status_info {
4592            Validate::validate_at(value, path, out);
4593        }
4594        path.pop();
4595        path.push_key("customData");
4596        if let Some(value) = &self.custom_data {
4597            Validate::validate_at(value, path, out);
4598        }
4599        path.pop();
4600    }
4601}
4602
4603impl Sealed for GetMonitoringReportResponse {}
4604impl Response for GetMonitoringReportResponse {}
4605
4606/// This message is empty. It has no fields.
4607///
4608/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4609#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4610pub struct GetPeriodicEventStreamRequest {
4611    /// The `customData` member.
4612    #[serde(rename = "customData")]
4613    #[serde(default, skip_serializing_if = "Option::is_none")]
4614    pub custom_data: Option<crate::types::CustomData>,
4615}
4616
4617impl GetPeriodicEventStreamRequest {
4618    /// Creates an empty `GetPeriodicEventStreamRequest`. Every field of this type is optional.
4619    #[must_use]
4620    pub fn new() -> Self {
4621        Self::default()
4622    }
4623
4624    /// Sets the optional `customData` field.
4625    #[must_use]
4626    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4627        self.custom_data = Some(value);
4628        self
4629    }
4630}
4631
4632impl Validate for GetPeriodicEventStreamRequest {
4633    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4634        path.push_key("customData");
4635        if let Some(value) = &self.custom_data {
4636            Validate::validate_at(value, path, out);
4637        }
4638        path.pop();
4639    }
4640}
4641
4642impl Sealed for GetPeriodicEventStreamRequest {}
4643impl Request for GetPeriodicEventStreamRequest {
4644    type Action = Action;
4645    const ACTION: Action = Action::GetPeriodicEventStream;
4646    const KIND: MessageKind = MessageKind::Call;
4647    const ORIGIN: Origin = Origin::Csms;
4648    type Response = GetPeriodicEventStreamResponse;
4649}
4650
4651impl Confirmed for GetPeriodicEventStreamRequest {}
4652
4653/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
4654#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
4655pub struct GetPeriodicEventStreamResponse {
4656    /// The `constantStreamData` member.
4657    #[serde(rename = "constantStreamData")]
4658    #[serde(default, skip_serializing_if = "Option::is_none")]
4659    pub constant_stream_data: Option<Vec<ConstantStreamData>>,
4660    /// The `customData` member.
4661    #[serde(rename = "customData")]
4662    #[serde(default, skip_serializing_if = "Option::is_none")]
4663    pub custom_data: Option<crate::types::CustomData>,
4664}
4665
4666impl GetPeriodicEventStreamResponse {
4667    /// Creates an empty `GetPeriodicEventStreamResponse`. Every field of this type is optional.
4668    #[must_use]
4669    pub fn new() -> Self {
4670        Self::default()
4671    }
4672
4673    /// Sets the optional `constantStreamData` field.
4674    #[must_use]
4675    pub fn with_constant_stream_data(mut self, value: Vec<ConstantStreamData>) -> Self {
4676        self.constant_stream_data = Some(value);
4677        self
4678    }
4679
4680    /// Sets the optional `customData` field.
4681    #[must_use]
4682    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4683        self.custom_data = Some(value);
4684        self
4685    }
4686}
4687
4688impl Validate for GetPeriodicEventStreamResponse {
4689    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4690        path.push_key("constantStreamData");
4691        if let Some(value) = &self.constant_stream_data {
4692            validate::list_len(value.len(), Some(1), None, path, out);
4693            for (index, item) in value.iter().enumerate() {
4694                path.push_index(index);
4695                Validate::validate_at(item, path, out);
4696                path.pop();
4697            }
4698        }
4699        path.pop();
4700        path.push_key("customData");
4701        if let Some(value) = &self.custom_data {
4702            Validate::validate_at(value, path, out);
4703        }
4704        path.pop();
4705    }
4706}
4707
4708impl Sealed for GetPeriodicEventStreamResponse {}
4709impl Response for GetPeriodicEventStreamResponse {}
4710
4711/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
4712#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4713pub struct GetReportRequest {
4714    /// The Id of the request.
4715    #[serde(rename = "requestId")]
4716    pub request_id: i32,
4717    /// The `componentVariable` member.
4718    #[serde(rename = "componentVariable")]
4719    #[serde(default, skip_serializing_if = "Option::is_none")]
4720    pub component_variable: Option<Vec<ComponentVariable>>,
4721    /// This field contains criteria for components for which a report is requested
4722    #[serde(rename = "componentCriteria")]
4723    #[serde(default, skip_serializing_if = "Option::is_none")]
4724    pub component_criteria: Option<Vec<ComponentCriterion>>,
4725    /// The `customData` member.
4726    #[serde(rename = "customData")]
4727    #[serde(default, skip_serializing_if = "Option::is_none")]
4728    pub custom_data: Option<crate::types::CustomData>,
4729}
4730
4731impl GetReportRequest {
4732    /// Creates a `GetReportRequest` from its required fields.
4733    #[must_use]
4734    pub fn new(request_id: i32) -> Self {
4735        Self {
4736            request_id,
4737            component_variable: None,
4738            component_criteria: None,
4739            custom_data: None,
4740        }
4741    }
4742
4743    /// Sets the optional `componentVariable` field.
4744    #[must_use]
4745    pub fn with_component_variable(mut self, value: Vec<ComponentVariable>) -> Self {
4746        self.component_variable = Some(value);
4747        self
4748    }
4749
4750    /// Sets the optional `componentCriteria` field.
4751    #[must_use]
4752    pub fn with_component_criteria(mut self, value: Vec<ComponentCriterion>) -> Self {
4753        self.component_criteria = Some(value);
4754        self
4755    }
4756
4757    /// Sets the optional `customData` field.
4758    #[must_use]
4759    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4760        self.custom_data = Some(value);
4761        self
4762    }
4763}
4764
4765impl Validate for GetReportRequest {
4766    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4767        path.push_key("componentVariable");
4768        if let Some(value) = &self.component_variable {
4769            validate::list_len(value.len(), Some(1), None, path, out);
4770            for (index, item) in value.iter().enumerate() {
4771                path.push_index(index);
4772                Validate::validate_at(item, path, out);
4773                path.pop();
4774            }
4775        }
4776        path.pop();
4777        path.push_key("componentCriteria");
4778        if let Some(value) = &self.component_criteria {
4779            validate::list_len(value.len(), Some(1), Some(4), path, out);
4780            for (index, item) in value.iter().enumerate() {
4781                path.push_index(index);
4782                Validate::validate_at(item, path, out);
4783                path.pop();
4784            }
4785        }
4786        path.pop();
4787        path.push_key("customData");
4788        if let Some(value) = &self.custom_data {
4789            Validate::validate_at(value, path, out);
4790        }
4791        path.pop();
4792    }
4793}
4794
4795impl Sealed for GetReportRequest {}
4796impl Request for GetReportRequest {
4797    type Action = Action;
4798    const ACTION: Action = Action::GetReport;
4799    const KIND: MessageKind = MessageKind::Call;
4800    const ORIGIN: Origin = Origin::Csms;
4801    type Response = GetReportResponse;
4802}
4803
4804impl Confirmed for GetReportRequest {}
4805
4806/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
4807#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4808pub struct GetReportResponse {
4809    /// The `status` member.
4810    pub status: GenericDeviceModelStatus,
4811    /// The `statusInfo` member.
4812    #[serde(rename = "statusInfo")]
4813    #[serde(default, skip_serializing_if = "Option::is_none")]
4814    pub status_info: Option<StatusInfo>,
4815    /// The `customData` member.
4816    #[serde(rename = "customData")]
4817    #[serde(default, skip_serializing_if = "Option::is_none")]
4818    pub custom_data: Option<crate::types::CustomData>,
4819}
4820
4821impl GetReportResponse {
4822    /// Creates a `GetReportResponse` from its required fields.
4823    #[must_use]
4824    pub fn new(status: GenericDeviceModelStatus) -> Self {
4825        Self {
4826            status,
4827            status_info: None,
4828            custom_data: None,
4829        }
4830    }
4831
4832    /// Sets the optional `statusInfo` field.
4833    #[must_use]
4834    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4835        self.status_info = Some(value);
4836        self
4837    }
4838
4839    /// Sets the optional `customData` field.
4840    #[must_use]
4841    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4842        self.custom_data = Some(value);
4843        self
4844    }
4845}
4846
4847impl Validate for GetReportResponse {
4848    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4849        path.push_key("status");
4850        Validate::validate_at(&self.status, path, out);
4851        path.pop();
4852        path.push_key("statusInfo");
4853        if let Some(value) = &self.status_info {
4854            Validate::validate_at(value, path, out);
4855        }
4856        path.pop();
4857        path.push_key("customData");
4858        if let Some(value) = &self.custom_data {
4859            Validate::validate_at(value, path, out);
4860        }
4861        path.pop();
4862    }
4863}
4864
4865impl Sealed for GetReportResponse {}
4866impl Response for GetReportResponse {}
4867
4868/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
4869#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4870pub struct GetTariffsRequest {
4871    /// EVSE id to get tariff from. When _evseId_ = 0, this gets tariffs from all EVSEs.
4872    #[serde(rename = "evseId")]
4873    pub evse_id: i32,
4874    /// The `customData` member.
4875    #[serde(rename = "customData")]
4876    #[serde(default, skip_serializing_if = "Option::is_none")]
4877    pub custom_data: Option<crate::types::CustomData>,
4878}
4879
4880impl GetTariffsRequest {
4881    /// Creates a `GetTariffsRequest` from its required fields.
4882    #[must_use]
4883    pub fn new(evse_id: i32) -> Self {
4884        Self {
4885            evse_id,
4886            custom_data: None,
4887        }
4888    }
4889
4890    /// Sets the optional `customData` field.
4891    #[must_use]
4892    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4893        self.custom_data = Some(value);
4894        self
4895    }
4896}
4897
4898impl Validate for GetTariffsRequest {
4899    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4900        path.push_key("evseId");
4901        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
4902        path.pop();
4903        path.push_key("customData");
4904        if let Some(value) = &self.custom_data {
4905            Validate::validate_at(value, path, out);
4906        }
4907        path.pop();
4908    }
4909}
4910
4911impl Sealed for GetTariffsRequest {}
4912impl Request for GetTariffsRequest {
4913    type Action = Action;
4914    const ACTION: Action = Action::GetTariffs;
4915    const KIND: MessageKind = MessageKind::Call;
4916    const ORIGIN: Origin = Origin::Csms;
4917    type Response = GetTariffsResponse;
4918}
4919
4920impl Confirmed for GetTariffsRequest {}
4921
4922/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
4923#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
4924pub struct GetTariffsResponse {
4925    /// The `status` member.
4926    pub status: TariffGetStatus,
4927    /// The `statusInfo` member.
4928    #[serde(rename = "statusInfo")]
4929    #[serde(default, skip_serializing_if = "Option::is_none")]
4930    pub status_info: Option<StatusInfo>,
4931    /// The `tariffAssignments` member.
4932    #[serde(rename = "tariffAssignments")]
4933    #[serde(default, skip_serializing_if = "Option::is_none")]
4934    pub tariff_assignments: Option<Vec<TariffAssignment>>,
4935    /// The `customData` member.
4936    #[serde(rename = "customData")]
4937    #[serde(default, skip_serializing_if = "Option::is_none")]
4938    pub custom_data: Option<crate::types::CustomData>,
4939}
4940
4941impl GetTariffsResponse {
4942    /// Creates a `GetTariffsResponse` from its required fields.
4943    #[must_use]
4944    pub fn new(status: TariffGetStatus) -> Self {
4945        Self {
4946            status,
4947            status_info: None,
4948            tariff_assignments: None,
4949            custom_data: None,
4950        }
4951    }
4952
4953    /// Sets the optional `statusInfo` field.
4954    #[must_use]
4955    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
4956        self.status_info = Some(value);
4957        self
4958    }
4959
4960    /// Sets the optional `tariffAssignments` field.
4961    #[must_use]
4962    pub fn with_tariff_assignments(mut self, value: Vec<TariffAssignment>) -> Self {
4963        self.tariff_assignments = Some(value);
4964        self
4965    }
4966
4967    /// Sets the optional `customData` field.
4968    #[must_use]
4969    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
4970        self.custom_data = Some(value);
4971        self
4972    }
4973}
4974
4975impl Validate for GetTariffsResponse {
4976    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
4977        path.push_key("status");
4978        Validate::validate_at(&self.status, path, out);
4979        path.pop();
4980        path.push_key("statusInfo");
4981        if let Some(value) = &self.status_info {
4982            Validate::validate_at(value, path, out);
4983        }
4984        path.pop();
4985        path.push_key("tariffAssignments");
4986        if let Some(value) = &self.tariff_assignments {
4987            validate::list_len(value.len(), Some(1), None, path, out);
4988            for (index, item) in value.iter().enumerate() {
4989                path.push_index(index);
4990                Validate::validate_at(item, path, out);
4991                path.pop();
4992            }
4993        }
4994        path.pop();
4995        path.push_key("customData");
4996        if let Some(value) = &self.custom_data {
4997            Validate::validate_at(value, path, out);
4998        }
4999        path.pop();
5000    }
5001}
5002
5003impl Sealed for GetTariffsResponse {}
5004impl Response for GetTariffsResponse {}
5005
5006/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
5007#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5008pub struct GetTransactionStatusRequest {
5009    /// The Id of the transaction for which the status is requested.
5010    #[serde(rename = "transactionId")]
5011    #[serde(default, skip_serializing_if = "Option::is_none")]
5012    pub transaction_id: Option<String>,
5013    /// The `customData` member.
5014    #[serde(rename = "customData")]
5015    #[serde(default, skip_serializing_if = "Option::is_none")]
5016    pub custom_data: Option<crate::types::CustomData>,
5017}
5018
5019impl GetTransactionStatusRequest {
5020    /// Creates an empty `GetTransactionStatusRequest`. Every field of this type is optional.
5021    #[must_use]
5022    pub fn new() -> Self {
5023        Self::default()
5024    }
5025
5026    /// Sets the optional `transactionId` field.
5027    #[must_use]
5028    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
5029        self.transaction_id = Some(value.into());
5030        self
5031    }
5032
5033    /// Sets the optional `customData` field.
5034    #[must_use]
5035    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5036        self.custom_data = Some(value);
5037        self
5038    }
5039}
5040
5041impl Validate for GetTransactionStatusRequest {
5042    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5043        path.push_key("transactionId");
5044        if let Some(value) = &self.transaction_id {
5045            validate::string(value.as_str(), None, Some(36), path, out);
5046        }
5047        path.pop();
5048        path.push_key("customData");
5049        if let Some(value) = &self.custom_data {
5050            Validate::validate_at(value, path, out);
5051        }
5052        path.pop();
5053    }
5054}
5055
5056impl Sealed for GetTransactionStatusRequest {}
5057impl Request for GetTransactionStatusRequest {
5058    type Action = Action;
5059    const ACTION: Action = Action::GetTransactionStatus;
5060    const KIND: MessageKind = MessageKind::Call;
5061    const ORIGIN: Origin = Origin::Csms;
5062    type Response = GetTransactionStatusResponse;
5063}
5064
5065impl Confirmed for GetTransactionStatusRequest {}
5066
5067/// Spec: OCPP 2.1 · E — Transactions · CSMS → Charging Station · CALL.
5068#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5069pub struct GetTransactionStatusResponse {
5070    /// Whether there are still message to be delivered.
5071    #[serde(rename = "messagesInQueue")]
5072    pub messages_in_queue: bool,
5073    /// Whether the transaction is still ongoing.
5074    #[serde(rename = "ongoingIndicator")]
5075    #[serde(default, skip_serializing_if = "Option::is_none")]
5076    pub ongoing_indicator: Option<bool>,
5077    /// The `customData` member.
5078    #[serde(rename = "customData")]
5079    #[serde(default, skip_serializing_if = "Option::is_none")]
5080    pub custom_data: Option<crate::types::CustomData>,
5081}
5082
5083impl GetTransactionStatusResponse {
5084    /// Creates a `GetTransactionStatusResponse` from its required fields.
5085    #[must_use]
5086    pub fn new(messages_in_queue: bool) -> Self {
5087        Self {
5088            messages_in_queue,
5089            ongoing_indicator: None,
5090            custom_data: None,
5091        }
5092    }
5093
5094    /// Sets the optional `ongoingIndicator` field.
5095    #[must_use]
5096    pub fn with_ongoing_indicator(mut self, value: bool) -> Self {
5097        self.ongoing_indicator = Some(value);
5098        self
5099    }
5100
5101    /// Sets the optional `customData` field.
5102    #[must_use]
5103    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5104        self.custom_data = Some(value);
5105        self
5106    }
5107}
5108
5109impl Validate for GetTransactionStatusResponse {
5110    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5111        path.push_key("customData");
5112        if let Some(value) = &self.custom_data {
5113            Validate::validate_at(value, path, out);
5114        }
5115        path.pop();
5116    }
5117}
5118
5119impl Sealed for GetTransactionStatusResponse {}
5120impl Response for GetTransactionStatusResponse {}
5121
5122/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
5123#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5124pub struct GetVariablesRequest {
5125    /// The `getVariableData` member.
5126    #[serde(rename = "getVariableData")]
5127    pub get_variable_data: Vec<GetVariableData>,
5128    /// The `customData` member.
5129    #[serde(rename = "customData")]
5130    #[serde(default, skip_serializing_if = "Option::is_none")]
5131    pub custom_data: Option<crate::types::CustomData>,
5132}
5133
5134impl GetVariablesRequest {
5135    /// Creates a `GetVariablesRequest` from its required fields.
5136    #[must_use]
5137    pub fn new(get_variable_data: Vec<GetVariableData>) -> Self {
5138        Self {
5139            get_variable_data,
5140            custom_data: None,
5141        }
5142    }
5143
5144    /// Sets the optional `customData` field.
5145    #[must_use]
5146    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5147        self.custom_data = Some(value);
5148        self
5149    }
5150}
5151
5152impl Validate for GetVariablesRequest {
5153    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5154        path.push_key("getVariableData");
5155        validate::list_len(self.get_variable_data.len(), Some(1), None, path, out);
5156        for (index, item) in self.get_variable_data.iter().enumerate() {
5157            path.push_index(index);
5158            Validate::validate_at(item, path, out);
5159            path.pop();
5160        }
5161        path.pop();
5162        path.push_key("customData");
5163        if let Some(value) = &self.custom_data {
5164            Validate::validate_at(value, path, out);
5165        }
5166        path.pop();
5167    }
5168}
5169
5170impl Sealed for GetVariablesRequest {}
5171impl Request for GetVariablesRequest {
5172    type Action = Action;
5173    const ACTION: Action = Action::GetVariables;
5174    const KIND: MessageKind = MessageKind::Call;
5175    const ORIGIN: Origin = Origin::Csms;
5176    type Response = GetVariablesResponse;
5177}
5178
5179impl Confirmed for GetVariablesRequest {}
5180
5181/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
5182#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5183pub struct GetVariablesResponse {
5184    /// The `getVariableResult` member.
5185    #[serde(rename = "getVariableResult")]
5186    pub get_variable_result: Vec<GetVariableResult>,
5187    /// The `customData` member.
5188    #[serde(rename = "customData")]
5189    #[serde(default, skip_serializing_if = "Option::is_none")]
5190    pub custom_data: Option<crate::types::CustomData>,
5191}
5192
5193impl GetVariablesResponse {
5194    /// Creates a `GetVariablesResponse` from its required fields.
5195    #[must_use]
5196    pub fn new(get_variable_result: Vec<GetVariableResult>) -> Self {
5197        Self {
5198            get_variable_result,
5199            custom_data: None,
5200        }
5201    }
5202
5203    /// Sets the optional `customData` field.
5204    #[must_use]
5205    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5206        self.custom_data = Some(value);
5207        self
5208    }
5209}
5210
5211impl Validate for GetVariablesResponse {
5212    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5213        path.push_key("getVariableResult");
5214        validate::list_len(self.get_variable_result.len(), Some(1), None, path, out);
5215        for (index, item) in self.get_variable_result.iter().enumerate() {
5216            path.push_index(index);
5217            Validate::validate_at(item, path, out);
5218            path.pop();
5219        }
5220        path.pop();
5221        path.push_key("customData");
5222        if let Some(value) = &self.custom_data {
5223            Validate::validate_at(value, path, out);
5224        }
5225        path.pop();
5226    }
5227}
5228
5229impl Sealed for GetVariablesResponse {}
5230impl Response for GetVariablesResponse {}
5231
5232/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
5233#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5234pub struct HeartbeatRequest {
5235    /// The `customData` member.
5236    #[serde(rename = "customData")]
5237    #[serde(default, skip_serializing_if = "Option::is_none")]
5238    pub custom_data: Option<crate::types::CustomData>,
5239}
5240
5241impl HeartbeatRequest {
5242    /// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
5243    #[must_use]
5244    pub fn new() -> Self {
5245        Self::default()
5246    }
5247
5248    /// Sets the optional `customData` field.
5249    #[must_use]
5250    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5251        self.custom_data = Some(value);
5252        self
5253    }
5254}
5255
5256impl Validate for HeartbeatRequest {
5257    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5258        path.push_key("customData");
5259        if let Some(value) = &self.custom_data {
5260            Validate::validate_at(value, path, out);
5261        }
5262        path.pop();
5263    }
5264}
5265
5266impl Sealed for HeartbeatRequest {}
5267impl Request for HeartbeatRequest {
5268    type Action = Action;
5269    const ACTION: Action = Action::Heartbeat;
5270    const KIND: MessageKind = MessageKind::Call;
5271    const ORIGIN: Origin = Origin::ChargingStation;
5272    type Response = HeartbeatResponse;
5273}
5274
5275impl Confirmed for HeartbeatRequest {}
5276
5277/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
5278#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5279pub struct HeartbeatResponse {
5280    /// Contains the current time of the CSMS.
5281    #[serde(rename = "currentTime")]
5282    pub current_time: crate::types::DateTime,
5283    /// The `customData` member.
5284    #[serde(rename = "customData")]
5285    #[serde(default, skip_serializing_if = "Option::is_none")]
5286    pub custom_data: Option<crate::types::CustomData>,
5287}
5288
5289impl HeartbeatResponse {
5290    /// Creates a `HeartbeatResponse` from its required fields.
5291    #[must_use]
5292    pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
5293        Self {
5294            current_time: current_time.into(),
5295            custom_data: None,
5296        }
5297    }
5298
5299    /// Sets the optional `customData` field.
5300    #[must_use]
5301    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5302        self.custom_data = Some(value);
5303        self
5304    }
5305}
5306
5307impl Validate for HeartbeatResponse {
5308    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5309        path.push_key("customData");
5310        if let Some(value) = &self.custom_data {
5311            Validate::validate_at(value, path, out);
5312        }
5313        path.pop();
5314    }
5315}
5316
5317impl Sealed for HeartbeatResponse {}
5318impl Response for HeartbeatResponse {}
5319
5320/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
5321#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5322pub struct InstallCertificateRequest {
5323    /// The `certificateType` member.
5324    #[serde(rename = "certificateType")]
5325    pub certificate_type: InstallCertificateUse,
5326    /// A PEM encoded X.509 certificate.
5327    pub certificate: String,
5328    /// The `customData` member.
5329    #[serde(rename = "customData")]
5330    #[serde(default, skip_serializing_if = "Option::is_none")]
5331    pub custom_data: Option<crate::types::CustomData>,
5332}
5333
5334impl InstallCertificateRequest {
5335    /// Creates a `InstallCertificateRequest` from its required fields.
5336    #[must_use]
5337    pub fn new(certificate_type: InstallCertificateUse, certificate: impl Into<String>) -> Self {
5338        Self {
5339            certificate_type,
5340            certificate: certificate.into(),
5341            custom_data: None,
5342        }
5343    }
5344
5345    /// Sets the optional `customData` field.
5346    #[must_use]
5347    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5348        self.custom_data = Some(value);
5349        self
5350    }
5351}
5352
5353impl Validate for InstallCertificateRequest {
5354    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5355        path.push_key("certificateType");
5356        Validate::validate_at(&self.certificate_type, path, out);
5357        path.pop();
5358        path.push_key("certificate");
5359        validate::string(self.certificate.as_str(), None, Some(10000), path, out);
5360        path.pop();
5361        path.push_key("customData");
5362        if let Some(value) = &self.custom_data {
5363            Validate::validate_at(value, path, out);
5364        }
5365        path.pop();
5366    }
5367}
5368
5369impl Sealed for InstallCertificateRequest {}
5370impl Request for InstallCertificateRequest {
5371    type Action = Action;
5372    const ACTION: Action = Action::InstallCertificate;
5373    const KIND: MessageKind = MessageKind::Call;
5374    const ORIGIN: Origin = Origin::Csms;
5375    type Response = InstallCertificateResponse;
5376}
5377
5378impl Confirmed for InstallCertificateRequest {}
5379
5380/// Spec: OCPP 2.1 · M — Certificate Management · CSMS → Charging Station · CALL.
5381#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5382pub struct InstallCertificateResponse {
5383    /// The `status` member.
5384    pub status: InstallCertificateStatus,
5385    /// The `statusInfo` member.
5386    #[serde(rename = "statusInfo")]
5387    #[serde(default, skip_serializing_if = "Option::is_none")]
5388    pub status_info: Option<StatusInfo>,
5389    /// The `customData` member.
5390    #[serde(rename = "customData")]
5391    #[serde(default, skip_serializing_if = "Option::is_none")]
5392    pub custom_data: Option<crate::types::CustomData>,
5393}
5394
5395impl InstallCertificateResponse {
5396    /// Creates a `InstallCertificateResponse` from its required fields.
5397    #[must_use]
5398    pub fn new(status: InstallCertificateStatus) -> Self {
5399        Self {
5400            status,
5401            status_info: None,
5402            custom_data: None,
5403        }
5404    }
5405
5406    /// Sets the optional `statusInfo` field.
5407    #[must_use]
5408    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5409        self.status_info = Some(value);
5410        self
5411    }
5412
5413    /// Sets the optional `customData` field.
5414    #[must_use]
5415    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5416        self.custom_data = Some(value);
5417        self
5418    }
5419}
5420
5421impl Validate for InstallCertificateResponse {
5422    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5423        path.push_key("status");
5424        Validate::validate_at(&self.status, path, out);
5425        path.pop();
5426        path.push_key("statusInfo");
5427        if let Some(value) = &self.status_info {
5428            Validate::validate_at(value, path, out);
5429        }
5430        path.pop();
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 InstallCertificateResponse {}
5440impl Response for InstallCertificateResponse {}
5441
5442/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5443#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5444pub struct LogStatusNotificationRequest {
5445    /// The `status` member.
5446    pub status: UploadLogStatus,
5447    /// The request id that was provided in GetLogRequest that started this log upload. This field is mandatory,
5448    /// unless the message was triggered by a TriggerMessageRequest AND there is no log upload ongoing.
5449    #[serde(rename = "requestId")]
5450    #[serde(default, skip_serializing_if = "Option::is_none")]
5451    pub request_id: Option<i32>,
5452    /// The `statusInfo` member.
5453    #[serde(rename = "statusInfo")]
5454    #[serde(default, skip_serializing_if = "Option::is_none")]
5455    pub status_info: Option<StatusInfo>,
5456    /// The `customData` member.
5457    #[serde(rename = "customData")]
5458    #[serde(default, skip_serializing_if = "Option::is_none")]
5459    pub custom_data: Option<crate::types::CustomData>,
5460}
5461
5462impl LogStatusNotificationRequest {
5463    /// Creates a `LogStatusNotificationRequest` from its required fields.
5464    #[must_use]
5465    pub fn new(status: UploadLogStatus) -> Self {
5466        Self {
5467            status,
5468            request_id: None,
5469            status_info: None,
5470            custom_data: None,
5471        }
5472    }
5473
5474    /// Sets the optional `requestId` field.
5475    #[must_use]
5476    pub fn with_request_id(mut self, value: i32) -> Self {
5477        self.request_id = Some(value);
5478        self
5479    }
5480
5481    /// Sets the optional `statusInfo` field.
5482    #[must_use]
5483    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5484        self.status_info = Some(value);
5485        self
5486    }
5487
5488    /// Sets the optional `customData` field.
5489    #[must_use]
5490    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5491        self.custom_data = Some(value);
5492        self
5493    }
5494}
5495
5496impl Validate for LogStatusNotificationRequest {
5497    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5498        path.push_key("status");
5499        Validate::validate_at(&self.status, path, out);
5500        path.pop();
5501        path.push_key("statusInfo");
5502        if let Some(value) = &self.status_info {
5503            Validate::validate_at(value, path, out);
5504        }
5505        path.pop();
5506        path.push_key("customData");
5507        if let Some(value) = &self.custom_data {
5508            Validate::validate_at(value, path, out);
5509        }
5510        path.pop();
5511    }
5512}
5513
5514impl Sealed for LogStatusNotificationRequest {}
5515impl Request for LogStatusNotificationRequest {
5516    type Action = Action;
5517    const ACTION: Action = Action::LogStatusNotification;
5518    const KIND: MessageKind = MessageKind::Call;
5519    const ORIGIN: Origin = Origin::ChargingStation;
5520    type Response = LogStatusNotificationResponse;
5521}
5522
5523impl Confirmed for LogStatusNotificationRequest {}
5524
5525/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5526#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5527pub struct LogStatusNotificationResponse {
5528    /// The `customData` member.
5529    #[serde(rename = "customData")]
5530    #[serde(default, skip_serializing_if = "Option::is_none")]
5531    pub custom_data: Option<crate::types::CustomData>,
5532}
5533
5534impl LogStatusNotificationResponse {
5535    /// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
5536    #[must_use]
5537    pub fn new() -> Self {
5538        Self::default()
5539    }
5540
5541    /// Sets the optional `customData` field.
5542    #[must_use]
5543    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5544        self.custom_data = Some(value);
5545        self
5546    }
5547}
5548
5549impl Validate for LogStatusNotificationResponse {
5550    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5551        path.push_key("customData");
5552        if let Some(value) = &self.custom_data {
5553            Validate::validate_at(value, path, out);
5554        }
5555        path.pop();
5556    }
5557}
5558
5559impl Sealed for LogStatusNotificationResponse {}
5560impl Response for LogStatusNotificationResponse {}
5561
5562/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
5563#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5564pub struct MeterValuesRequest {
5565    /// This contains a number (&gt;0) designating an EVSE of the Charging Station. ‘0’ (zero) is used to designate the main power meter.
5566    #[serde(rename = "evseId")]
5567    pub evse_id: i32,
5568    /// The `meterValue` member.
5569    #[serde(rename = "meterValue")]
5570    pub meter_value: Vec<MeterValue>,
5571    /// The `customData` member.
5572    #[serde(rename = "customData")]
5573    #[serde(default, skip_serializing_if = "Option::is_none")]
5574    pub custom_data: Option<crate::types::CustomData>,
5575}
5576
5577impl MeterValuesRequest {
5578    /// Creates a `MeterValuesRequest` from its required fields.
5579    #[must_use]
5580    pub fn new(evse_id: i32, meter_value: Vec<MeterValue>) -> Self {
5581        Self {
5582            evse_id,
5583            meter_value,
5584            custom_data: None,
5585        }
5586    }
5587
5588    /// Sets the optional `customData` field.
5589    #[must_use]
5590    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5591        self.custom_data = Some(value);
5592        self
5593    }
5594}
5595
5596impl Validate for MeterValuesRequest {
5597    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5598        path.push_key("evseId");
5599        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
5600        path.pop();
5601        path.push_key("meterValue");
5602        validate::list_len(self.meter_value.len(), Some(1), None, path, out);
5603        for (index, item) in self.meter_value.iter().enumerate() {
5604            path.push_index(index);
5605            Validate::validate_at(item, path, out);
5606            path.pop();
5607        }
5608        path.pop();
5609        path.push_key("customData");
5610        if let Some(value) = &self.custom_data {
5611            Validate::validate_at(value, path, out);
5612        }
5613        path.pop();
5614    }
5615}
5616
5617impl Sealed for MeterValuesRequest {}
5618impl Request for MeterValuesRequest {
5619    type Action = Action;
5620    const ACTION: Action = Action::MeterValues;
5621    const KIND: MessageKind = MessageKind::Call;
5622    const ORIGIN: Origin = Origin::ChargingStation;
5623    type Response = MeterValuesResponse;
5624}
5625
5626impl Confirmed for MeterValuesRequest {}
5627
5628/// Spec: OCPP 2.1 · J — Meter Values · Charging Station → CSMS · CALL.
5629#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5630pub struct MeterValuesResponse {
5631    /// The `customData` member.
5632    #[serde(rename = "customData")]
5633    #[serde(default, skip_serializing_if = "Option::is_none")]
5634    pub custom_data: Option<crate::types::CustomData>,
5635}
5636
5637impl MeterValuesResponse {
5638    /// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
5639    #[must_use]
5640    pub fn new() -> Self {
5641        Self::default()
5642    }
5643
5644    /// Sets the optional `customData` field.
5645    #[must_use]
5646    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5647        self.custom_data = Some(value);
5648        self
5649    }
5650}
5651
5652impl Validate for MeterValuesResponse {
5653    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5654        path.push_key("customData");
5655        if let Some(value) = &self.custom_data {
5656            Validate::validate_at(value, path, out);
5657        }
5658        path.pop();
5659    }
5660}
5661
5662impl Sealed for MeterValuesResponse {}
5663impl Response for MeterValuesResponse {}
5664
5665/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
5666#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5667pub struct NotifyAllowedEnergyTransferRequest {
5668    /// The transaction for which the allowed energy transfer is allowed.
5669    #[serde(rename = "transactionId")]
5670    pub transaction_id: String,
5671    /// Modes of energy transfer that are accepted by CSMS.
5672    #[serde(rename = "allowedEnergyTransfer")]
5673    pub allowed_energy_transfer: Vec<EnergyTransferMode>,
5674    /// The `customData` member.
5675    #[serde(rename = "customData")]
5676    #[serde(default, skip_serializing_if = "Option::is_none")]
5677    pub custom_data: Option<crate::types::CustomData>,
5678}
5679
5680impl NotifyAllowedEnergyTransferRequest {
5681    /// Creates a `NotifyAllowedEnergyTransferRequest` from its required fields.
5682    #[must_use]
5683    pub fn new(
5684        transaction_id: impl Into<String>,
5685        allowed_energy_transfer: Vec<EnergyTransferMode>,
5686    ) -> Self {
5687        Self {
5688            transaction_id: transaction_id.into(),
5689            allowed_energy_transfer,
5690            custom_data: None,
5691        }
5692    }
5693
5694    /// Sets the optional `customData` field.
5695    #[must_use]
5696    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5697        self.custom_data = Some(value);
5698        self
5699    }
5700}
5701
5702impl Validate for NotifyAllowedEnergyTransferRequest {
5703    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5704        path.push_key("transactionId");
5705        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
5706        path.pop();
5707        path.push_key("allowedEnergyTransfer");
5708        validate::list_len(self.allowed_energy_transfer.len(), Some(1), None, path, out);
5709        for (index, item) in self.allowed_energy_transfer.iter().enumerate() {
5710            path.push_index(index);
5711            Validate::validate_at(item, path, out);
5712            path.pop();
5713        }
5714        path.pop();
5715        path.push_key("customData");
5716        if let Some(value) = &self.custom_data {
5717            Validate::validate_at(value, path, out);
5718        }
5719        path.pop();
5720    }
5721}
5722
5723impl Sealed for NotifyAllowedEnergyTransferRequest {}
5724impl Request for NotifyAllowedEnergyTransferRequest {
5725    type Action = Action;
5726    const ACTION: Action = Action::NotifyAllowedEnergyTransfer;
5727    const KIND: MessageKind = MessageKind::Call;
5728    const ORIGIN: Origin = Origin::Csms;
5729    type Response = NotifyAllowedEnergyTransferResponse;
5730}
5731
5732impl Confirmed for NotifyAllowedEnergyTransferRequest {}
5733
5734/// Spec: OCPP 2.1 · Q — Bidirectional Power Transfer · CSMS → Charging Station · CALL.
5735#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5736pub struct NotifyAllowedEnergyTransferResponse {
5737    /// The `status` member.
5738    pub status: NotifyAllowedEnergyTransferStatus,
5739    /// The `statusInfo` member.
5740    #[serde(rename = "statusInfo")]
5741    #[serde(default, skip_serializing_if = "Option::is_none")]
5742    pub status_info: Option<StatusInfo>,
5743    /// The `customData` member.
5744    #[serde(rename = "customData")]
5745    #[serde(default, skip_serializing_if = "Option::is_none")]
5746    pub custom_data: Option<crate::types::CustomData>,
5747}
5748
5749impl NotifyAllowedEnergyTransferResponse {
5750    /// Creates a `NotifyAllowedEnergyTransferResponse` from its required fields.
5751    #[must_use]
5752    pub fn new(status: NotifyAllowedEnergyTransferStatus) -> Self {
5753        Self {
5754            status,
5755            status_info: None,
5756            custom_data: None,
5757        }
5758    }
5759
5760    /// Sets the optional `statusInfo` field.
5761    #[must_use]
5762    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
5763        self.status_info = Some(value);
5764        self
5765    }
5766
5767    /// Sets the optional `customData` field.
5768    #[must_use]
5769    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5770        self.custom_data = Some(value);
5771        self
5772    }
5773}
5774
5775impl Validate for NotifyAllowedEnergyTransferResponse {
5776    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5777        path.push_key("status");
5778        Validate::validate_at(&self.status, path, out);
5779        path.pop();
5780        path.push_key("statusInfo");
5781        if let Some(value) = &self.status_info {
5782            Validate::validate_at(value, path, out);
5783        }
5784        path.pop();
5785        path.push_key("customData");
5786        if let Some(value) = &self.custom_data {
5787            Validate::validate_at(value, path, out);
5788        }
5789        path.pop();
5790    }
5791}
5792
5793impl Sealed for NotifyAllowedEnergyTransferResponse {}
5794impl Response for NotifyAllowedEnergyTransferResponse {}
5795
5796/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5797#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5798pub struct NotifyChargingLimitRequest {
5799    /// The `chargingLimit` member.
5800    #[serde(rename = "chargingLimit")]
5801    pub charging_limit: ChargingLimit,
5802    /// The `chargingSchedule` member.
5803    #[serde(rename = "chargingSchedule")]
5804    #[serde(default, skip_serializing_if = "Option::is_none")]
5805    pub charging_schedule: Option<Vec<ChargingSchedule>>,
5806    /// The EVSE to which the charging limit is set. If absent or when zero, it applies to the entire Charging Station.
5807    #[serde(rename = "evseId")]
5808    #[serde(default, skip_serializing_if = "Option::is_none")]
5809    pub evse_id: Option<i32>,
5810    /// The `customData` member.
5811    #[serde(rename = "customData")]
5812    #[serde(default, skip_serializing_if = "Option::is_none")]
5813    pub custom_data: Option<crate::types::CustomData>,
5814}
5815
5816impl NotifyChargingLimitRequest {
5817    /// Creates a `NotifyChargingLimitRequest` from its required fields.
5818    #[must_use]
5819    pub fn new(charging_limit: ChargingLimit) -> Self {
5820        Self {
5821            charging_limit,
5822            charging_schedule: None,
5823            evse_id: None,
5824            custom_data: None,
5825        }
5826    }
5827
5828    /// Sets the optional `chargingSchedule` field.
5829    #[must_use]
5830    pub fn with_charging_schedule(mut self, value: Vec<ChargingSchedule>) -> Self {
5831        self.charging_schedule = Some(value);
5832        self
5833    }
5834
5835    /// Sets the optional `evseId` field.
5836    #[must_use]
5837    pub fn with_evse_id(mut self, value: i32) -> Self {
5838        self.evse_id = Some(value);
5839        self
5840    }
5841
5842    /// Sets the optional `customData` field.
5843    #[must_use]
5844    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5845        self.custom_data = Some(value);
5846        self
5847    }
5848}
5849
5850impl Validate for NotifyChargingLimitRequest {
5851    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5852        path.push_key("chargingLimit");
5853        Validate::validate_at(&self.charging_limit, path, out);
5854        path.pop();
5855        path.push_key("chargingSchedule");
5856        if let Some(value) = &self.charging_schedule {
5857            validate::list_len(value.len(), Some(1), None, path, out);
5858            for (index, item) in value.iter().enumerate() {
5859                path.push_index(index);
5860                Validate::validate_at(item, path, out);
5861                path.pop();
5862            }
5863        }
5864        path.pop();
5865        path.push_key("evseId");
5866        if let Some(value) = &self.evse_id {
5867            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
5868        }
5869        path.pop();
5870        path.push_key("customData");
5871        if let Some(value) = &self.custom_data {
5872            Validate::validate_at(value, path, out);
5873        }
5874        path.pop();
5875    }
5876}
5877
5878impl Sealed for NotifyChargingLimitRequest {}
5879impl Request for NotifyChargingLimitRequest {
5880    type Action = Action;
5881    const ACTION: Action = Action::NotifyChargingLimit;
5882    const KIND: MessageKind = MessageKind::Call;
5883    const ORIGIN: Origin = Origin::ChargingStation;
5884    type Response = NotifyChargingLimitResponse;
5885}
5886
5887impl Confirmed for NotifyChargingLimitRequest {}
5888
5889/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
5890#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
5891pub struct NotifyChargingLimitResponse {
5892    /// The `customData` member.
5893    #[serde(rename = "customData")]
5894    #[serde(default, skip_serializing_if = "Option::is_none")]
5895    pub custom_data: Option<crate::types::CustomData>,
5896}
5897
5898impl NotifyChargingLimitResponse {
5899    /// Creates an empty `NotifyChargingLimitResponse`. Every field of this type is optional.
5900    #[must_use]
5901    pub fn new() -> Self {
5902        Self::default()
5903    }
5904
5905    /// Sets the optional `customData` field.
5906    #[must_use]
5907    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5908        self.custom_data = Some(value);
5909        self
5910    }
5911}
5912
5913impl Validate for NotifyChargingLimitResponse {
5914    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5915        path.push_key("customData");
5916        if let Some(value) = &self.custom_data {
5917            Validate::validate_at(value, path, out);
5918        }
5919        path.pop();
5920    }
5921}
5922
5923impl Sealed for NotifyChargingLimitResponse {}
5924impl Response for NotifyChargingLimitResponse {}
5925
5926/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
5927#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
5928pub struct NotifyCustomerInformationRequest {
5929    /// (Part of) the requested data. No format specified in which the data is returned. Should be human readable.
5930    pub data: String,
5931    /// Sequence number of this message. First message starts at 0.
5932    #[serde(rename = "seqNo")]
5933    pub seq_no: i32,
5934    ///  Timestamp of the moment this message was generated at the Charging Station.
5935    #[serde(rename = "generatedAt")]
5936    pub generated_at: crate::types::DateTime,
5937    /// The Id of the request.
5938    #[serde(rename = "requestId")]
5939    pub request_id: i32,
5940    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
5941    /// Schema default: `false`.
5942    #[serde(default, skip_serializing_if = "Option::is_none")]
5943    pub tbc: Option<bool>,
5944    /// The `customData` member.
5945    #[serde(rename = "customData")]
5946    #[serde(default, skip_serializing_if = "Option::is_none")]
5947    pub custom_data: Option<crate::types::CustomData>,
5948}
5949
5950impl NotifyCustomerInformationRequest {
5951    /// Creates a `NotifyCustomerInformationRequest` from its required fields.
5952    #[must_use]
5953    pub fn new(
5954        data: impl Into<String>,
5955        seq_no: i32,
5956        generated_at: impl Into<crate::types::DateTime>,
5957        request_id: i32,
5958    ) -> Self {
5959        Self {
5960            data: data.into(),
5961            seq_no,
5962            generated_at: generated_at.into(),
5963            request_id,
5964            tbc: None,
5965            custom_data: None,
5966        }
5967    }
5968
5969    /// Sets the optional `tbc` field.
5970    #[must_use]
5971    pub fn with_tbc(mut self, value: bool) -> Self {
5972        self.tbc = Some(value);
5973        self
5974    }
5975
5976    /// Sets the optional `customData` field.
5977    #[must_use]
5978    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
5979        self.custom_data = Some(value);
5980        self
5981    }
5982}
5983
5984impl Validate for NotifyCustomerInformationRequest {
5985    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
5986        path.push_key("data");
5987        validate::string(self.data.as_str(), None, Some(512), path, out);
5988        path.pop();
5989        path.push_key("seqNo");
5990        validate::int_range(i64::from(self.seq_no), Some(0.0), None, path, out);
5991        path.pop();
5992        path.push_key("requestId");
5993        validate::int_range(i64::from(self.request_id), Some(0.0), None, path, out);
5994        path.pop();
5995        path.push_key("customData");
5996        if let Some(value) = &self.custom_data {
5997            Validate::validate_at(value, path, out);
5998        }
5999        path.pop();
6000    }
6001}
6002
6003impl Sealed for NotifyCustomerInformationRequest {}
6004impl Request for NotifyCustomerInformationRequest {
6005    type Action = Action;
6006    const ACTION: Action = Action::NotifyCustomerInformation;
6007    const KIND: MessageKind = MessageKind::Call;
6008    const ORIGIN: Origin = Origin::ChargingStation;
6009    type Response = NotifyCustomerInformationResponse;
6010}
6011
6012impl Confirmed for NotifyCustomerInformationRequest {}
6013
6014/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6015#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6016pub struct NotifyCustomerInformationResponse {
6017    /// The `customData` member.
6018    #[serde(rename = "customData")]
6019    #[serde(default, skip_serializing_if = "Option::is_none")]
6020    pub custom_data: Option<crate::types::CustomData>,
6021}
6022
6023impl NotifyCustomerInformationResponse {
6024    /// Creates an empty `NotifyCustomerInformationResponse`. Every field of this type is optional.
6025    #[must_use]
6026    pub fn new() -> Self {
6027        Self::default()
6028    }
6029
6030    /// Sets the optional `customData` field.
6031    #[must_use]
6032    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6033        self.custom_data = Some(value);
6034        self
6035    }
6036}
6037
6038impl Validate for NotifyCustomerInformationResponse {
6039    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6040        path.push_key("customData");
6041        if let Some(value) = &self.custom_data {
6042            Validate::validate_at(value, path, out);
6043        }
6044        path.pop();
6045    }
6046}
6047
6048impl Sealed for NotifyCustomerInformationResponse {}
6049impl Response for NotifyCustomerInformationResponse {}
6050
6051/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6052#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6053pub struct NotifyDERAlarmRequest {
6054    /// The `controlType` member.
6055    #[serde(rename = "controlType")]
6056    pub control_type: DERControl,
6057    /// Time of start or end of alarm.
6058    pub timestamp: crate::types::DateTime,
6059    /// The `gridEventFault` member.
6060    #[serde(rename = "gridEventFault")]
6061    #[serde(default, skip_serializing_if = "Option::is_none")]
6062    pub grid_event_fault: Option<GridEventFault>,
6063    /// True when error condition has ended.
6064    /// Absent or false when alarm has started.
6065    #[serde(rename = "alarmEnded")]
6066    #[serde(default, skip_serializing_if = "Option::is_none")]
6067    pub alarm_ended: Option<bool>,
6068    /// Optional info provided by EV.
6069    #[serde(rename = "extraInfo")]
6070    #[serde(default, skip_serializing_if = "Option::is_none")]
6071    pub extra_info: Option<String>,
6072    /// The `customData` member.
6073    #[serde(rename = "customData")]
6074    #[serde(default, skip_serializing_if = "Option::is_none")]
6075    pub custom_data: Option<crate::types::CustomData>,
6076}
6077
6078impl NotifyDERAlarmRequest {
6079    /// Creates a `NotifyDERAlarmRequest` from its required fields.
6080    #[must_use]
6081    pub fn new(control_type: DERControl, timestamp: impl Into<crate::types::DateTime>) -> Self {
6082        Self {
6083            control_type,
6084            timestamp: timestamp.into(),
6085            grid_event_fault: None,
6086            alarm_ended: None,
6087            extra_info: None,
6088            custom_data: None,
6089        }
6090    }
6091
6092    /// Sets the optional `gridEventFault` field.
6093    #[must_use]
6094    pub fn with_grid_event_fault(mut self, value: GridEventFault) -> Self {
6095        self.grid_event_fault = Some(value);
6096        self
6097    }
6098
6099    /// Sets the optional `alarmEnded` field.
6100    #[must_use]
6101    pub fn with_alarm_ended(mut self, value: bool) -> Self {
6102        self.alarm_ended = Some(value);
6103        self
6104    }
6105
6106    /// Sets the optional `extraInfo` field.
6107    #[must_use]
6108    pub fn with_extra_info(mut self, value: impl Into<String>) -> Self {
6109        self.extra_info = Some(value.into());
6110        self
6111    }
6112
6113    /// Sets the optional `customData` field.
6114    #[must_use]
6115    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6116        self.custom_data = Some(value);
6117        self
6118    }
6119}
6120
6121impl Validate for NotifyDERAlarmRequest {
6122    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6123        path.push_key("controlType");
6124        Validate::validate_at(&self.control_type, path, out);
6125        path.pop();
6126        path.push_key("gridEventFault");
6127        if let Some(value) = &self.grid_event_fault {
6128            Validate::validate_at(value, path, out);
6129        }
6130        path.pop();
6131        path.push_key("extraInfo");
6132        if let Some(value) = &self.extra_info {
6133            validate::string(value.as_str(), None, Some(200), path, out);
6134        }
6135        path.pop();
6136        path.push_key("customData");
6137        if let Some(value) = &self.custom_data {
6138            Validate::validate_at(value, path, out);
6139        }
6140        path.pop();
6141    }
6142}
6143
6144impl Sealed for NotifyDERAlarmRequest {}
6145impl Request for NotifyDERAlarmRequest {
6146    type Action = Action;
6147    const ACTION: Action = Action::NotifyDERAlarm;
6148    const KIND: MessageKind = MessageKind::Call;
6149    const ORIGIN: Origin = Origin::ChargingStation;
6150    type Response = NotifyDERAlarmResponse;
6151}
6152
6153impl Confirmed for NotifyDERAlarmRequest {}
6154
6155/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6156#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6157pub struct NotifyDERAlarmResponse {
6158    /// The `customData` member.
6159    #[serde(rename = "customData")]
6160    #[serde(default, skip_serializing_if = "Option::is_none")]
6161    pub custom_data: Option<crate::types::CustomData>,
6162}
6163
6164impl NotifyDERAlarmResponse {
6165    /// Creates an empty `NotifyDERAlarmResponse`. Every field of this type is optional.
6166    #[must_use]
6167    pub fn new() -> Self {
6168        Self::default()
6169    }
6170
6171    /// Sets the optional `customData` field.
6172    #[must_use]
6173    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6174        self.custom_data = Some(value);
6175        self
6176    }
6177}
6178
6179impl Validate for NotifyDERAlarmResponse {
6180    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6181        path.push_key("customData");
6182        if let Some(value) = &self.custom_data {
6183            Validate::validate_at(value, path, out);
6184        }
6185        path.pop();
6186    }
6187}
6188
6189impl Sealed for NotifyDERAlarmResponse {}
6190impl Response for NotifyDERAlarmResponse {}
6191
6192/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6193#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6194pub struct NotifyDERStartStopRequest {
6195    /// Id of the started or stopped DER control.
6196    /// Corresponds to the _controlId_ of the SetDERControlRequest.
6197    #[serde(rename = "controlId")]
6198    pub control_id: String,
6199    /// True if DER control has started. False if it has ended.
6200    pub started: bool,
6201    /// Time of start or end of event.
6202    pub timestamp: crate::types::DateTime,
6203    /// List of controlIds that are superseded as a result of this control starting.
6204    #[serde(rename = "supersededIds")]
6205    #[serde(default, skip_serializing_if = "Option::is_none")]
6206    pub superseded_ids: Option<Vec<String>>,
6207    /// The `customData` member.
6208    #[serde(rename = "customData")]
6209    #[serde(default, skip_serializing_if = "Option::is_none")]
6210    pub custom_data: Option<crate::types::CustomData>,
6211}
6212
6213impl NotifyDERStartStopRequest {
6214    /// Creates a `NotifyDERStartStopRequest` from its required fields.
6215    #[must_use]
6216    pub fn new(
6217        control_id: impl Into<String>,
6218        started: bool,
6219        timestamp: impl Into<crate::types::DateTime>,
6220    ) -> Self {
6221        Self {
6222            control_id: control_id.into(),
6223            started,
6224            timestamp: timestamp.into(),
6225            superseded_ids: None,
6226            custom_data: None,
6227        }
6228    }
6229
6230    /// Sets the optional `supersededIds` field.
6231    #[must_use]
6232    pub fn with_superseded_ids(
6233        mut self,
6234        value: impl IntoIterator<Item = impl Into<String>>,
6235    ) -> Self {
6236        self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
6237        self
6238    }
6239
6240    /// Sets the optional `customData` field.
6241    #[must_use]
6242    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6243        self.custom_data = Some(value);
6244        self
6245    }
6246}
6247
6248impl Validate for NotifyDERStartStopRequest {
6249    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6250        path.push_key("controlId");
6251        validate::string(self.control_id.as_str(), None, Some(36), path, out);
6252        path.pop();
6253        path.push_key("supersededIds");
6254        if let Some(value) = &self.superseded_ids {
6255            validate::list_len(value.len(), Some(1), Some(24), path, out);
6256            for (index, item) in value.iter().enumerate() {
6257                path.push_index(index);
6258                validate::string(item.as_str(), None, Some(36), path, out);
6259                path.pop();
6260            }
6261        }
6262        path.pop();
6263        path.push_key("customData");
6264        if let Some(value) = &self.custom_data {
6265            Validate::validate_at(value, path, out);
6266        }
6267        path.pop();
6268    }
6269}
6270
6271impl Sealed for NotifyDERStartStopRequest {}
6272impl Request for NotifyDERStartStopRequest {
6273    type Action = Action;
6274    const ACTION: Action = Action::NotifyDERStartStop;
6275    const KIND: MessageKind = MessageKind::Call;
6276    const ORIGIN: Origin = Origin::ChargingStation;
6277    type Response = NotifyDERStartStopResponse;
6278}
6279
6280impl Confirmed for NotifyDERStartStopRequest {}
6281
6282/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
6283#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6284pub struct NotifyDERStartStopResponse {
6285    /// The `customData` member.
6286    #[serde(rename = "customData")]
6287    #[serde(default, skip_serializing_if = "Option::is_none")]
6288    pub custom_data: Option<crate::types::CustomData>,
6289}
6290
6291impl NotifyDERStartStopResponse {
6292    /// Creates an empty `NotifyDERStartStopResponse`. Every field of this type is optional.
6293    #[must_use]
6294    pub fn new() -> Self {
6295        Self::default()
6296    }
6297
6298    /// Sets the optional `customData` field.
6299    #[must_use]
6300    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6301        self.custom_data = Some(value);
6302        self
6303    }
6304}
6305
6306impl Validate for NotifyDERStartStopResponse {
6307    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6308        path.push_key("customData");
6309        if let Some(value) = &self.custom_data {
6310            Validate::validate_at(value, path, out);
6311        }
6312        path.pop();
6313    }
6314}
6315
6316impl Sealed for NotifyDERStartStopResponse {}
6317impl Response for NotifyDERStartStopResponse {}
6318
6319/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
6320#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6321pub struct NotifyDisplayMessagesRequest {
6322    /// The id of the &lt;&lt;getdisplaymessagesrequest,GetDisplayMessagesRequest&gt;&gt; that requested this message.
6323    #[serde(rename = "requestId")]
6324    pub request_id: i32,
6325    /// The `messageInfo` member.
6326    #[serde(rename = "messageInfo")]
6327    #[serde(default, skip_serializing_if = "Option::is_none")]
6328    pub message_info: Option<Vec<MessageInfo>>,
6329    /// "to be continued" indicator. Indicates whether another part of the report follows in an upcoming NotifyDisplayMessagesRequest message. Default value when omitted is false.
6330    /// Schema default: `false`.
6331    #[serde(default, skip_serializing_if = "Option::is_none")]
6332    pub tbc: Option<bool>,
6333    /// The `customData` member.
6334    #[serde(rename = "customData")]
6335    #[serde(default, skip_serializing_if = "Option::is_none")]
6336    pub custom_data: Option<crate::types::CustomData>,
6337}
6338
6339impl NotifyDisplayMessagesRequest {
6340    /// Creates a `NotifyDisplayMessagesRequest` from its required fields.
6341    #[must_use]
6342    pub fn new(request_id: i32) -> Self {
6343        Self {
6344            request_id,
6345            message_info: None,
6346            tbc: None,
6347            custom_data: None,
6348        }
6349    }
6350
6351    /// Sets the optional `messageInfo` field.
6352    #[must_use]
6353    pub fn with_message_info(mut self, value: Vec<MessageInfo>) -> Self {
6354        self.message_info = Some(value);
6355        self
6356    }
6357
6358    /// Sets the optional `tbc` field.
6359    #[must_use]
6360    pub fn with_tbc(mut self, value: bool) -> Self {
6361        self.tbc = Some(value);
6362        self
6363    }
6364
6365    /// Sets the optional `customData` field.
6366    #[must_use]
6367    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6368        self.custom_data = Some(value);
6369        self
6370    }
6371}
6372
6373impl Validate for NotifyDisplayMessagesRequest {
6374    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6375        path.push_key("messageInfo");
6376        if let Some(value) = &self.message_info {
6377            validate::list_len(value.len(), Some(1), None, path, out);
6378            for (index, item) in value.iter().enumerate() {
6379                path.push_index(index);
6380                Validate::validate_at(item, path, out);
6381                path.pop();
6382            }
6383        }
6384        path.pop();
6385        path.push_key("customData");
6386        if let Some(value) = &self.custom_data {
6387            Validate::validate_at(value, path, out);
6388        }
6389        path.pop();
6390    }
6391}
6392
6393impl Sealed for NotifyDisplayMessagesRequest {}
6394impl Request for NotifyDisplayMessagesRequest {
6395    type Action = Action;
6396    const ACTION: Action = Action::NotifyDisplayMessages;
6397    const KIND: MessageKind = MessageKind::Call;
6398    const ORIGIN: Origin = Origin::ChargingStation;
6399    type Response = NotifyDisplayMessagesResponse;
6400}
6401
6402impl Confirmed for NotifyDisplayMessagesRequest {}
6403
6404/// Spec: OCPP 2.1 · O — Display Message · Charging Station → CSMS · CALL.
6405#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6406pub struct NotifyDisplayMessagesResponse {
6407    /// The `customData` member.
6408    #[serde(rename = "customData")]
6409    #[serde(default, skip_serializing_if = "Option::is_none")]
6410    pub custom_data: Option<crate::types::CustomData>,
6411}
6412
6413impl NotifyDisplayMessagesResponse {
6414    /// Creates an empty `NotifyDisplayMessagesResponse`. Every field of this type is optional.
6415    #[must_use]
6416    pub fn new() -> Self {
6417        Self::default()
6418    }
6419
6420    /// Sets the optional `customData` field.
6421    #[must_use]
6422    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6423        self.custom_data = Some(value);
6424        self
6425    }
6426}
6427
6428impl Validate for NotifyDisplayMessagesResponse {
6429    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6430        path.push_key("customData");
6431        if let Some(value) = &self.custom_data {
6432            Validate::validate_at(value, path, out);
6433        }
6434        path.pop();
6435    }
6436}
6437
6438impl Sealed for NotifyDisplayMessagesResponse {}
6439impl Response for NotifyDisplayMessagesResponse {}
6440
6441/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6442#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6443pub struct NotifyEVChargingNeedsRequest {
6444    /// Defines the EVSE and connector to which the EV is connected. EvseId may not be 0.
6445    #[serde(rename = "evseId")]
6446    pub evse_id: i32,
6447    /// The `chargingNeeds` member.
6448    #[serde(rename = "chargingNeeds")]
6449    pub charging_needs: ChargingNeeds,
6450    /// Contains the maximum elements the EV supports for: +
6451    /// - ISO 15118-2: schedule tuples in SASchedule (both Pmax and Tariff). +
6452    /// - ISO 15118-20: PowerScheduleEntry, PriceRule and PriceLevelScheduleEntries.
6453    #[serde(rename = "maxScheduleTuples")]
6454    #[serde(default, skip_serializing_if = "Option::is_none")]
6455    pub max_schedule_tuples: Option<i32>,
6456    /// *(2.1)* Time when EV charging needs were received. +
6457    /// Field can be added when charging station was offline when charging needs were received.
6458    #[serde(default, skip_serializing_if = "Option::is_none")]
6459    pub timestamp: Option<crate::types::DateTime>,
6460    /// The `customData` member.
6461    #[serde(rename = "customData")]
6462    #[serde(default, skip_serializing_if = "Option::is_none")]
6463    pub custom_data: Option<crate::types::CustomData>,
6464}
6465
6466impl NotifyEVChargingNeedsRequest {
6467    /// Creates a `NotifyEVChargingNeedsRequest` from its required fields.
6468    #[must_use]
6469    pub fn new(evse_id: i32, charging_needs: ChargingNeeds) -> Self {
6470        Self {
6471            evse_id,
6472            charging_needs,
6473            max_schedule_tuples: None,
6474            timestamp: None,
6475            custom_data: None,
6476        }
6477    }
6478
6479    /// Sets the optional `maxScheduleTuples` field.
6480    #[must_use]
6481    pub fn with_max_schedule_tuples(mut self, value: i32) -> Self {
6482        self.max_schedule_tuples = Some(value);
6483        self
6484    }
6485
6486    /// Sets the optional `timestamp` field.
6487    #[must_use]
6488    pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
6489        self.timestamp = Some(value.into());
6490        self
6491    }
6492
6493    /// Sets the optional `customData` field.
6494    #[must_use]
6495    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6496        self.custom_data = Some(value);
6497        self
6498    }
6499}
6500
6501impl Validate for NotifyEVChargingNeedsRequest {
6502    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6503        path.push_key("evseId");
6504        validate::int_range(i64::from(self.evse_id), Some(1.0), None, path, out);
6505        path.pop();
6506        path.push_key("chargingNeeds");
6507        Validate::validate_at(&self.charging_needs, path, out);
6508        path.pop();
6509        path.push_key("maxScheduleTuples");
6510        if let Some(value) = &self.max_schedule_tuples {
6511            validate::int_range(i64::from(*value), Some(0.0), None, 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 NotifyEVChargingNeedsRequest {}
6523impl Request for NotifyEVChargingNeedsRequest {
6524    type Action = Action;
6525    const ACTION: Action = Action::NotifyEVChargingNeeds;
6526    const KIND: MessageKind = MessageKind::Call;
6527    const ORIGIN: Origin = Origin::ChargingStation;
6528    type Response = NotifyEVChargingNeedsResponse;
6529}
6530
6531impl Confirmed for NotifyEVChargingNeedsRequest {}
6532
6533/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6534#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6535pub struct NotifyEVChargingNeedsResponse {
6536    /// The `status` member.
6537    pub status: NotifyEVChargingNeedsStatus,
6538    /// The `statusInfo` member.
6539    #[serde(rename = "statusInfo")]
6540    #[serde(default, skip_serializing_if = "Option::is_none")]
6541    pub status_info: Option<StatusInfo>,
6542    /// The `customData` member.
6543    #[serde(rename = "customData")]
6544    #[serde(default, skip_serializing_if = "Option::is_none")]
6545    pub custom_data: Option<crate::types::CustomData>,
6546}
6547
6548impl NotifyEVChargingNeedsResponse {
6549    /// Creates a `NotifyEVChargingNeedsResponse` from its required fields.
6550    #[must_use]
6551    pub fn new(status: NotifyEVChargingNeedsStatus) -> Self {
6552        Self {
6553            status,
6554            status_info: None,
6555            custom_data: None,
6556        }
6557    }
6558
6559    /// Sets the optional `statusInfo` field.
6560    #[must_use]
6561    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6562        self.status_info = Some(value);
6563        self
6564    }
6565
6566    /// Sets the optional `customData` field.
6567    #[must_use]
6568    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6569        self.custom_data = Some(value);
6570        self
6571    }
6572}
6573
6574impl Validate for NotifyEVChargingNeedsResponse {
6575    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6576        path.push_key("status");
6577        Validate::validate_at(&self.status, path, out);
6578        path.pop();
6579        path.push_key("statusInfo");
6580        if let Some(value) = &self.status_info {
6581            Validate::validate_at(value, path, out);
6582        }
6583        path.pop();
6584        path.push_key("customData");
6585        if let Some(value) = &self.custom_data {
6586            Validate::validate_at(value, path, out);
6587        }
6588        path.pop();
6589    }
6590}
6591
6592impl Sealed for NotifyEVChargingNeedsResponse {}
6593impl Response for NotifyEVChargingNeedsResponse {}
6594
6595/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6596#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6597pub struct NotifyEVChargingScheduleRequest {
6598    /// Periods contained in the charging profile are relative to this point in time.
6599    #[serde(rename = "timeBase")]
6600    pub time_base: crate::types::DateTime,
6601    /// The `chargingSchedule` member.
6602    #[serde(rename = "chargingSchedule")]
6603    pub charging_schedule: ChargingSchedule,
6604    /// The charging schedule contained in this notification applies to an EVSE. EvseId must be &gt; 0.
6605    #[serde(rename = "evseId")]
6606    pub evse_id: i32,
6607    /// *(2.1)* Id  of the _chargingSchedule_ that EV selected from the provided ChargingProfile.
6608    #[serde(rename = "selectedChargingScheduleId")]
6609    #[serde(default, skip_serializing_if = "Option::is_none")]
6610    pub selected_charging_schedule_id: Option<i32>,
6611    /// *(2.1)* True when power tolerance is accepted by EV.
6612    /// This value is taken from EVPowerProfile.PowerToleranceAcceptance in the ISO 15118-20 PowerDeliverReq message..
6613    #[serde(rename = "powerToleranceAcceptance")]
6614    #[serde(default, skip_serializing_if = "Option::is_none")]
6615    pub power_tolerance_acceptance: Option<bool>,
6616    /// The `customData` member.
6617    #[serde(rename = "customData")]
6618    #[serde(default, skip_serializing_if = "Option::is_none")]
6619    pub custom_data: Option<crate::types::CustomData>,
6620}
6621
6622impl NotifyEVChargingScheduleRequest {
6623    /// Creates a `NotifyEVChargingScheduleRequest` from its required fields.
6624    #[must_use]
6625    pub fn new(
6626        time_base: impl Into<crate::types::DateTime>,
6627        charging_schedule: ChargingSchedule,
6628        evse_id: i32,
6629    ) -> Self {
6630        Self {
6631            time_base: time_base.into(),
6632            charging_schedule,
6633            evse_id,
6634            selected_charging_schedule_id: None,
6635            power_tolerance_acceptance: None,
6636            custom_data: None,
6637        }
6638    }
6639
6640    /// Sets the optional `selectedChargingScheduleId` field.
6641    #[must_use]
6642    pub fn with_selected_charging_schedule_id(mut self, value: i32) -> Self {
6643        self.selected_charging_schedule_id = Some(value);
6644        self
6645    }
6646
6647    /// Sets the optional `powerToleranceAcceptance` field.
6648    #[must_use]
6649    pub fn with_power_tolerance_acceptance(mut self, value: bool) -> Self {
6650        self.power_tolerance_acceptance = Some(value);
6651        self
6652    }
6653
6654    /// Sets the optional `customData` field.
6655    #[must_use]
6656    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6657        self.custom_data = Some(value);
6658        self
6659    }
6660}
6661
6662impl Validate for NotifyEVChargingScheduleRequest {
6663    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6664        path.push_key("chargingSchedule");
6665        Validate::validate_at(&self.charging_schedule, path, out);
6666        path.pop();
6667        path.push_key("evseId");
6668        validate::int_range(i64::from(self.evse_id), Some(1.0), None, path, out);
6669        path.pop();
6670        path.push_key("selectedChargingScheduleId");
6671        if let Some(value) = &self.selected_charging_schedule_id {
6672            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
6673        }
6674        path.pop();
6675        path.push_key("customData");
6676        if let Some(value) = &self.custom_data {
6677            Validate::validate_at(value, path, out);
6678        }
6679        path.pop();
6680    }
6681}
6682
6683impl Sealed for NotifyEVChargingScheduleRequest {}
6684impl Request for NotifyEVChargingScheduleRequest {
6685    type Action = Action;
6686    const ACTION: Action = Action::NotifyEVChargingSchedule;
6687    const KIND: MessageKind = MessageKind::Call;
6688    const ORIGIN: Origin = Origin::ChargingStation;
6689    type Response = NotifyEVChargingScheduleResponse;
6690}
6691
6692impl Confirmed for NotifyEVChargingScheduleRequest {}
6693
6694/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
6695#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6696pub struct NotifyEVChargingScheduleResponse {
6697    /// The `status` member.
6698    pub status: GenericStatus,
6699    /// The `statusInfo` member.
6700    #[serde(rename = "statusInfo")]
6701    #[serde(default, skip_serializing_if = "Option::is_none")]
6702    pub status_info: Option<StatusInfo>,
6703    /// The `customData` member.
6704    #[serde(rename = "customData")]
6705    #[serde(default, skip_serializing_if = "Option::is_none")]
6706    pub custom_data: Option<crate::types::CustomData>,
6707}
6708
6709impl NotifyEVChargingScheduleResponse {
6710    /// Creates a `NotifyEVChargingScheduleResponse` from its required fields.
6711    #[must_use]
6712    pub fn new(status: GenericStatus) -> Self {
6713        Self {
6714            status,
6715            status_info: None,
6716            custom_data: None,
6717        }
6718    }
6719
6720    /// Sets the optional `statusInfo` field.
6721    #[must_use]
6722    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
6723        self.status_info = Some(value);
6724        self
6725    }
6726
6727    /// Sets the optional `customData` field.
6728    #[must_use]
6729    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6730        self.custom_data = Some(value);
6731        self
6732    }
6733}
6734
6735impl Validate for NotifyEVChargingScheduleResponse {
6736    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6737        path.push_key("status");
6738        Validate::validate_at(&self.status, path, out);
6739        path.pop();
6740        path.push_key("statusInfo");
6741        if let Some(value) = &self.status_info {
6742            Validate::validate_at(value, path, out);
6743        }
6744        path.pop();
6745        path.push_key("customData");
6746        if let Some(value) = &self.custom_data {
6747            Validate::validate_at(value, path, out);
6748        }
6749        path.pop();
6750    }
6751}
6752
6753impl Sealed for NotifyEVChargingScheduleResponse {}
6754impl Response for NotifyEVChargingScheduleResponse {}
6755
6756/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6757#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6758pub struct NotifyEventRequest {
6759    /// Timestamp of the moment this message was generated at the Charging Station.
6760    #[serde(rename = "generatedAt")]
6761    pub generated_at: crate::types::DateTime,
6762    /// Sequence number of this message. First message starts at 0.
6763    #[serde(rename = "seqNo")]
6764    pub seq_no: i32,
6765    /// The `eventData` member.
6766    #[serde(rename = "eventData")]
6767    pub event_data: Vec<EventData>,
6768    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyEventRequest message. Default value when omitted is false.
6769    /// Schema default: `false`.
6770    #[serde(default, skip_serializing_if = "Option::is_none")]
6771    pub tbc: Option<bool>,
6772    /// The `customData` member.
6773    #[serde(rename = "customData")]
6774    #[serde(default, skip_serializing_if = "Option::is_none")]
6775    pub custom_data: Option<crate::types::CustomData>,
6776}
6777
6778impl NotifyEventRequest {
6779    /// Creates a `NotifyEventRequest` from its required fields.
6780    #[must_use]
6781    pub fn new(
6782        generated_at: impl Into<crate::types::DateTime>,
6783        seq_no: i32,
6784        event_data: Vec<EventData>,
6785    ) -> Self {
6786        Self {
6787            generated_at: generated_at.into(),
6788            seq_no,
6789            event_data,
6790            tbc: None,
6791            custom_data: None,
6792        }
6793    }
6794
6795    /// Sets the optional `tbc` field.
6796    #[must_use]
6797    pub fn with_tbc(mut self, value: bool) -> Self {
6798        self.tbc = Some(value);
6799        self
6800    }
6801
6802    /// Sets the optional `customData` field.
6803    #[must_use]
6804    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6805        self.custom_data = Some(value);
6806        self
6807    }
6808}
6809
6810impl Validate for NotifyEventRequest {
6811    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6812        path.push_key("seqNo");
6813        validate::int_range(i64::from(self.seq_no), Some(0.0), None, path, out);
6814        path.pop();
6815        path.push_key("eventData");
6816        validate::list_len(self.event_data.len(), Some(1), None, path, out);
6817        for (index, item) in self.event_data.iter().enumerate() {
6818            path.push_index(index);
6819            Validate::validate_at(item, path, out);
6820            path.pop();
6821        }
6822        path.pop();
6823        path.push_key("customData");
6824        if let Some(value) = &self.custom_data {
6825            Validate::validate_at(value, path, out);
6826        }
6827        path.pop();
6828    }
6829}
6830
6831impl Sealed for NotifyEventRequest {}
6832impl Request for NotifyEventRequest {
6833    type Action = Action;
6834    const ACTION: Action = Action::NotifyEvent;
6835    const KIND: MessageKind = MessageKind::Call;
6836    const ORIGIN: Origin = Origin::ChargingStation;
6837    type Response = NotifyEventResponse;
6838}
6839
6840impl Confirmed for NotifyEventRequest {}
6841
6842/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6843#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6844pub struct NotifyEventResponse {
6845    /// The `customData` member.
6846    #[serde(rename = "customData")]
6847    #[serde(default, skip_serializing_if = "Option::is_none")]
6848    pub custom_data: Option<crate::types::CustomData>,
6849}
6850
6851impl NotifyEventResponse {
6852    /// Creates an empty `NotifyEventResponse`. Every field of this type is optional.
6853    #[must_use]
6854    pub fn new() -> Self {
6855        Self::default()
6856    }
6857
6858    /// Sets the optional `customData` field.
6859    #[must_use]
6860    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6861        self.custom_data = Some(value);
6862        self
6863    }
6864}
6865
6866impl Validate for NotifyEventResponse {
6867    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6868        path.push_key("customData");
6869        if let Some(value) = &self.custom_data {
6870            Validate::validate_at(value, path, out);
6871        }
6872        path.pop();
6873    }
6874}
6875
6876impl Sealed for NotifyEventResponse {}
6877impl Response for NotifyEventResponse {}
6878
6879/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6880#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6881pub struct NotifyMonitoringReportRequest {
6882    /// The id of the GetMonitoringRequest that requested this report.
6883    #[serde(rename = "requestId")]
6884    pub request_id: i32,
6885    /// Sequence number of this message. First message starts at 0.
6886    #[serde(rename = "seqNo")]
6887    pub seq_no: i32,
6888    /// Timestamp of the moment this message was generated at the Charging Station.
6889    #[serde(rename = "generatedAt")]
6890    pub generated_at: crate::types::DateTime,
6891    /// The `monitor` member.
6892    #[serde(default, skip_serializing_if = "Option::is_none")]
6893    pub monitor: Option<Vec<MonitoringData>>,
6894    /// “to be continued” indicator. Indicates whether another part of the monitoringData follows in an upcoming notifyMonitoringReportRequest message. Default value when omitted is false.
6895    /// Schema default: `false`.
6896    #[serde(default, skip_serializing_if = "Option::is_none")]
6897    pub tbc: Option<bool>,
6898    /// The `customData` member.
6899    #[serde(rename = "customData")]
6900    #[serde(default, skip_serializing_if = "Option::is_none")]
6901    pub custom_data: Option<crate::types::CustomData>,
6902}
6903
6904impl NotifyMonitoringReportRequest {
6905    /// Creates a `NotifyMonitoringReportRequest` from its required fields.
6906    #[must_use]
6907    pub fn new(
6908        request_id: i32,
6909        seq_no: i32,
6910        generated_at: impl Into<crate::types::DateTime>,
6911    ) -> Self {
6912        Self {
6913            request_id,
6914            seq_no,
6915            generated_at: generated_at.into(),
6916            monitor: None,
6917            tbc: None,
6918            custom_data: None,
6919        }
6920    }
6921
6922    /// Sets the optional `monitor` field.
6923    #[must_use]
6924    pub fn with_monitor(mut self, value: Vec<MonitoringData>) -> Self {
6925        self.monitor = Some(value);
6926        self
6927    }
6928
6929    /// Sets the optional `tbc` field.
6930    #[must_use]
6931    pub fn with_tbc(mut self, value: bool) -> Self {
6932        self.tbc = Some(value);
6933        self
6934    }
6935
6936    /// Sets the optional `customData` field.
6937    #[must_use]
6938    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6939        self.custom_data = Some(value);
6940        self
6941    }
6942}
6943
6944impl Validate for NotifyMonitoringReportRequest {
6945    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
6946        path.push_key("seqNo");
6947        validate::int_range(i64::from(self.seq_no), Some(0.0), None, path, out);
6948        path.pop();
6949        path.push_key("monitor");
6950        if let Some(value) = &self.monitor {
6951            validate::list_len(value.len(), Some(1), None, path, out);
6952            for (index, item) in value.iter().enumerate() {
6953                path.push_index(index);
6954                Validate::validate_at(item, path, out);
6955                path.pop();
6956            }
6957        }
6958        path.pop();
6959        path.push_key("customData");
6960        if let Some(value) = &self.custom_data {
6961            Validate::validate_at(value, path, out);
6962        }
6963        path.pop();
6964    }
6965}
6966
6967impl Sealed for NotifyMonitoringReportRequest {}
6968impl Request for NotifyMonitoringReportRequest {
6969    type Action = Action;
6970    const ACTION: Action = Action::NotifyMonitoringReport;
6971    const KIND: MessageKind = MessageKind::Call;
6972    const ORIGIN: Origin = Origin::ChargingStation;
6973    type Response = NotifyMonitoringReportResponse;
6974}
6975
6976impl Confirmed for NotifyMonitoringReportRequest {}
6977
6978/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
6979#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
6980pub struct NotifyMonitoringReportResponse {
6981    /// The `customData` member.
6982    #[serde(rename = "customData")]
6983    #[serde(default, skip_serializing_if = "Option::is_none")]
6984    pub custom_data: Option<crate::types::CustomData>,
6985}
6986
6987impl NotifyMonitoringReportResponse {
6988    /// Creates an empty `NotifyMonitoringReportResponse`. Every field of this type is optional.
6989    #[must_use]
6990    pub fn new() -> Self {
6991        Self::default()
6992    }
6993
6994    /// Sets the optional `customData` field.
6995    #[must_use]
6996    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
6997        self.custom_data = Some(value);
6998        self
6999    }
7000}
7001
7002impl Validate for NotifyMonitoringReportResponse {
7003    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7004        path.push_key("customData");
7005        if let Some(value) = &self.custom_data {
7006            Validate::validate_at(value, path, out);
7007        }
7008        path.pop();
7009    }
7010}
7011
7012impl Sealed for NotifyMonitoringReportResponse {}
7013impl Response for NotifyMonitoringReportResponse {}
7014
7015/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · SEND (unconfirmed, never answered — Part 4 §4.2.4).
7016#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7017pub struct NotifyPeriodicEventStreamRequest {
7018    /// The `data` member.
7019    pub data: Vec<StreamDataElement>,
7020    /// Id of stream.
7021    pub id: i32,
7022    /// Number of data elements still pending to be sent.
7023    pub pending: i32,
7024    /// Base timestamp to add to time offset of values.
7025    pub basetime: crate::types::DateTime,
7026    /// The `customData` member.
7027    #[serde(rename = "customData")]
7028    #[serde(default, skip_serializing_if = "Option::is_none")]
7029    pub custom_data: Option<crate::types::CustomData>,
7030}
7031
7032impl NotifyPeriodicEventStreamRequest {
7033    /// Creates a `NotifyPeriodicEventStreamRequest` from its required fields.
7034    #[must_use]
7035    pub fn new(
7036        data: Vec<StreamDataElement>,
7037        id: i32,
7038        pending: i32,
7039        basetime: impl Into<crate::types::DateTime>,
7040    ) -> Self {
7041        Self {
7042            data,
7043            id,
7044            pending,
7045            basetime: basetime.into(),
7046            custom_data: None,
7047        }
7048    }
7049
7050    /// Sets the optional `customData` field.
7051    #[must_use]
7052    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7053        self.custom_data = Some(value);
7054        self
7055    }
7056}
7057
7058impl Validate for NotifyPeriodicEventStreamRequest {
7059    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7060        path.push_key("data");
7061        validate::list_len(self.data.len(), Some(1), None, path, out);
7062        for (index, item) in self.data.iter().enumerate() {
7063            path.push_index(index);
7064            Validate::validate_at(item, path, out);
7065            path.pop();
7066        }
7067        path.pop();
7068        path.push_key("id");
7069        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
7070        path.pop();
7071        path.push_key("pending");
7072        validate::int_range(i64::from(self.pending), Some(0.0), None, path, out);
7073        path.pop();
7074        path.push_key("customData");
7075        if let Some(value) = &self.custom_data {
7076            Validate::validate_at(value, path, out);
7077        }
7078        path.pop();
7079    }
7080}
7081
7082impl Sealed for NotifyPeriodicEventStreamRequest {}
7083impl Request for NotifyPeriodicEventStreamRequest {
7084    type Action = Action;
7085    const ACTION: Action = Action::NotifyPeriodicEventStream;
7086    const KIND: MessageKind = MessageKind::Send;
7087    const ORIGIN: Origin = Origin::ChargingStation;
7088    type Response = crate::message::NoResponse;
7089}
7090
7091impl Unconfirmed for NotifyPeriodicEventStreamRequest {}
7092
7093/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
7094#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7095pub struct NotifyPriorityChargingRequest {
7096    /// The transaction for which priority charging is requested.
7097    #[serde(rename = "transactionId")]
7098    pub transaction_id: String,
7099    /// True if priority charging was activated. False if it has stopped using the priority charging profile.
7100    pub activated: bool,
7101    /// The `customData` member.
7102    #[serde(rename = "customData")]
7103    #[serde(default, skip_serializing_if = "Option::is_none")]
7104    pub custom_data: Option<crate::types::CustomData>,
7105}
7106
7107impl NotifyPriorityChargingRequest {
7108    /// Creates a `NotifyPriorityChargingRequest` from its required fields.
7109    #[must_use]
7110    pub fn new(transaction_id: impl Into<String>, activated: bool) -> Self {
7111        Self {
7112            transaction_id: transaction_id.into(),
7113            activated,
7114            custom_data: None,
7115        }
7116    }
7117
7118    /// Sets the optional `customData` field.
7119    #[must_use]
7120    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7121        self.custom_data = Some(value);
7122        self
7123    }
7124}
7125
7126impl Validate for NotifyPriorityChargingRequest {
7127    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7128        path.push_key("transactionId");
7129        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
7130        path.pop();
7131        path.push_key("customData");
7132        if let Some(value) = &self.custom_data {
7133            Validate::validate_at(value, path, out);
7134        }
7135        path.pop();
7136    }
7137}
7138
7139impl Sealed for NotifyPriorityChargingRequest {}
7140impl Request for NotifyPriorityChargingRequest {
7141    type Action = Action;
7142    const ACTION: Action = Action::NotifyPriorityCharging;
7143    const KIND: MessageKind = MessageKind::Call;
7144    const ORIGIN: Origin = Origin::ChargingStation;
7145    type Response = NotifyPriorityChargingResponse;
7146}
7147
7148impl Confirmed for NotifyPriorityChargingRequest {}
7149
7150/// This response message has an empty body.
7151///
7152/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
7153#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7154pub struct NotifyPriorityChargingResponse {
7155    /// The `customData` member.
7156    #[serde(rename = "customData")]
7157    #[serde(default, skip_serializing_if = "Option::is_none")]
7158    pub custom_data: Option<crate::types::CustomData>,
7159}
7160
7161impl NotifyPriorityChargingResponse {
7162    /// Creates an empty `NotifyPriorityChargingResponse`. Every field of this type is optional.
7163    #[must_use]
7164    pub fn new() -> Self {
7165        Self::default()
7166    }
7167
7168    /// Sets the optional `customData` field.
7169    #[must_use]
7170    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7171        self.custom_data = Some(value);
7172        self
7173    }
7174}
7175
7176impl Validate for NotifyPriorityChargingResponse {
7177    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7178        path.push_key("customData");
7179        if let Some(value) = &self.custom_data {
7180            Validate::validate_at(value, path, out);
7181        }
7182        path.pop();
7183    }
7184}
7185
7186impl Sealed for NotifyPriorityChargingResponse {}
7187impl Response for NotifyPriorityChargingResponse {}
7188
7189/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
7190#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7191pub struct NotifyReportRequest {
7192    /// The id of the GetReportRequest  or GetBaseReportRequest that requested this report
7193    #[serde(rename = "requestId")]
7194    pub request_id: i32,
7195    /// Timestamp of the moment this message was generated at the Charging Station.
7196    #[serde(rename = "generatedAt")]
7197    pub generated_at: crate::types::DateTime,
7198    /// Sequence number of this message. First message starts at 0.
7199    #[serde(rename = "seqNo")]
7200    pub seq_no: i32,
7201    /// The `reportData` member.
7202    #[serde(rename = "reportData")]
7203    #[serde(default, skip_serializing_if = "Option::is_none")]
7204    pub report_data: Option<Vec<ReportData>>,
7205    /// “to be continued” indicator. Indicates whether another part of the report follows in an upcoming notifyReportRequest message. Default value when omitted is false.
7206    /// Schema default: `false`.
7207    #[serde(default, skip_serializing_if = "Option::is_none")]
7208    pub tbc: Option<bool>,
7209    /// The `customData` member.
7210    #[serde(rename = "customData")]
7211    #[serde(default, skip_serializing_if = "Option::is_none")]
7212    pub custom_data: Option<crate::types::CustomData>,
7213}
7214
7215impl NotifyReportRequest {
7216    /// Creates a `NotifyReportRequest` from its required fields.
7217    #[must_use]
7218    pub fn new(
7219        request_id: i32,
7220        generated_at: impl Into<crate::types::DateTime>,
7221        seq_no: i32,
7222    ) -> Self {
7223        Self {
7224            request_id,
7225            generated_at: generated_at.into(),
7226            seq_no,
7227            report_data: None,
7228            tbc: None,
7229            custom_data: None,
7230        }
7231    }
7232
7233    /// Sets the optional `reportData` field.
7234    #[must_use]
7235    pub fn with_report_data(mut self, value: Vec<ReportData>) -> Self {
7236        self.report_data = Some(value);
7237        self
7238    }
7239
7240    /// Sets the optional `tbc` field.
7241    #[must_use]
7242    pub fn with_tbc(mut self, value: bool) -> Self {
7243        self.tbc = Some(value);
7244        self
7245    }
7246
7247    /// Sets the optional `customData` field.
7248    #[must_use]
7249    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7250        self.custom_data = Some(value);
7251        self
7252    }
7253}
7254
7255impl Validate for NotifyReportRequest {
7256    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7257        path.push_key("seqNo");
7258        validate::int_range(i64::from(self.seq_no), Some(0.0), None, path, out);
7259        path.pop();
7260        path.push_key("reportData");
7261        if let Some(value) = &self.report_data {
7262            validate::list_len(value.len(), Some(1), None, path, out);
7263            for (index, item) in value.iter().enumerate() {
7264                path.push_index(index);
7265                Validate::validate_at(item, path, out);
7266                path.pop();
7267            }
7268        }
7269        path.pop();
7270        path.push_key("customData");
7271        if let Some(value) = &self.custom_data {
7272            Validate::validate_at(value, path, out);
7273        }
7274        path.pop();
7275    }
7276}
7277
7278impl Sealed for NotifyReportRequest {}
7279impl Request for NotifyReportRequest {
7280    type Action = Action;
7281    const ACTION: Action = Action::NotifyReport;
7282    const KIND: MessageKind = MessageKind::Call;
7283    const ORIGIN: Origin = Origin::ChargingStation;
7284    type Response = NotifyReportResponse;
7285}
7286
7287impl Confirmed for NotifyReportRequest {}
7288
7289/// Spec: OCPP 2.1 · B — Provisioning · Charging Station → CSMS · CALL.
7290#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7291pub struct NotifyReportResponse {
7292    /// The `customData` member.
7293    #[serde(rename = "customData")]
7294    #[serde(default, skip_serializing_if = "Option::is_none")]
7295    pub custom_data: Option<crate::types::CustomData>,
7296}
7297
7298impl NotifyReportResponse {
7299    /// Creates an empty `NotifyReportResponse`. Every field of this type is optional.
7300    #[must_use]
7301    pub fn new() -> Self {
7302        Self::default()
7303    }
7304
7305    /// Sets the optional `customData` field.
7306    #[must_use]
7307    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7308        self.custom_data = Some(value);
7309        self
7310    }
7311}
7312
7313impl Validate for NotifyReportResponse {
7314    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7315        path.push_key("customData");
7316        if let Some(value) = &self.custom_data {
7317            Validate::validate_at(value, path, out);
7318        }
7319        path.pop();
7320    }
7321}
7322
7323impl Sealed for NotifyReportResponse {}
7324impl Response for NotifyReportResponse {}
7325
7326/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
7327#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7328pub struct NotifySettlementRequest {
7329    /// The payment reference received from the payment terminal and is used as the value for _idToken_.
7330    #[serde(rename = "pspRef")]
7331    pub psp_ref: String,
7332    /// The `status` member.
7333    pub status: PaymentStatus,
7334    /// The amount that was settled, or attempted to be settled (in case of failure).
7335    #[serde(rename = "settlementAmount")]
7336    pub settlement_amount: crate::types::Decimal,
7337    /// The time when the settlement was done.
7338    #[serde(rename = "settlementTime")]
7339    pub settlement_time: crate::types::DateTime,
7340    /// The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
7341    #[serde(rename = "transactionId")]
7342    #[serde(default, skip_serializing_if = "Option::is_none")]
7343    pub transaction_id: Option<String>,
7344    /// Additional information from payment terminal/payment process.
7345    #[serde(rename = "statusInfo")]
7346    #[serde(default, skip_serializing_if = "Option::is_none")]
7347    pub status_info: Option<String>,
7348    /// The `receiptId` member.
7349    #[serde(rename = "receiptId")]
7350    #[serde(default, skip_serializing_if = "Option::is_none")]
7351    pub receipt_id: Option<String>,
7352    /// The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
7353    #[serde(rename = "receiptUrl")]
7354    #[serde(default, skip_serializing_if = "Option::is_none")]
7355    pub receipt_url: Option<String>,
7356    /// The `vatCompany` member.
7357    #[serde(rename = "vatCompany")]
7358    #[serde(default, skip_serializing_if = "Option::is_none")]
7359    pub vat_company: Option<Address>,
7360    /// VAT number for a company receipt.
7361    #[serde(rename = "vatNumber")]
7362    #[serde(default, skip_serializing_if = "Option::is_none")]
7363    pub vat_number: Option<String>,
7364    /// The `customData` member.
7365    #[serde(rename = "customData")]
7366    #[serde(default, skip_serializing_if = "Option::is_none")]
7367    pub custom_data: Option<crate::types::CustomData>,
7368}
7369
7370impl NotifySettlementRequest {
7371    /// Creates a `NotifySettlementRequest` from its required fields.
7372    #[must_use]
7373    pub fn new(
7374        psp_ref: impl Into<String>,
7375        status: PaymentStatus,
7376        settlement_amount: impl Into<crate::types::Decimal>,
7377        settlement_time: impl Into<crate::types::DateTime>,
7378    ) -> Self {
7379        Self {
7380            psp_ref: psp_ref.into(),
7381            status,
7382            settlement_amount: settlement_amount.into(),
7383            settlement_time: settlement_time.into(),
7384            transaction_id: None,
7385            status_info: None,
7386            receipt_id: None,
7387            receipt_url: None,
7388            vat_company: None,
7389            vat_number: None,
7390            custom_data: None,
7391        }
7392    }
7393
7394    /// Sets the optional `transactionId` field.
7395    #[must_use]
7396    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
7397        self.transaction_id = Some(value.into());
7398        self
7399    }
7400
7401    /// Sets the optional `statusInfo` field.
7402    #[must_use]
7403    pub fn with_status_info(mut self, value: impl Into<String>) -> Self {
7404        self.status_info = Some(value.into());
7405        self
7406    }
7407
7408    /// Sets the optional `receiptId` field.
7409    #[must_use]
7410    pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
7411        self.receipt_id = Some(value.into());
7412        self
7413    }
7414
7415    /// Sets the optional `receiptUrl` field.
7416    #[must_use]
7417    pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
7418        self.receipt_url = Some(value.into());
7419        self
7420    }
7421
7422    /// Sets the optional `vatCompany` field.
7423    #[must_use]
7424    pub fn with_vat_company(mut self, value: Address) -> Self {
7425        self.vat_company = Some(value);
7426        self
7427    }
7428
7429    /// Sets the optional `vatNumber` field.
7430    #[must_use]
7431    pub fn with_vat_number(mut self, value: impl Into<String>) -> Self {
7432        self.vat_number = Some(value.into());
7433        self
7434    }
7435
7436    /// Sets the optional `customData` field.
7437    #[must_use]
7438    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7439        self.custom_data = Some(value);
7440        self
7441    }
7442}
7443
7444impl Validate for NotifySettlementRequest {
7445    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7446        path.push_key("pspRef");
7447        validate::string(self.psp_ref.as_str(), None, Some(255), path, out);
7448        path.pop();
7449        path.push_key("status");
7450        Validate::validate_at(&self.status, path, out);
7451        path.pop();
7452        path.push_key("transactionId");
7453        if let Some(value) = &self.transaction_id {
7454            validate::string(value.as_str(), None, Some(36), path, out);
7455        }
7456        path.pop();
7457        path.push_key("statusInfo");
7458        if let Some(value) = &self.status_info {
7459            validate::string(value.as_str(), None, Some(500), path, out);
7460        }
7461        path.pop();
7462        path.push_key("receiptId");
7463        if let Some(value) = &self.receipt_id {
7464            validate::string(value.as_str(), None, Some(50), path, out);
7465        }
7466        path.pop();
7467        path.push_key("receiptUrl");
7468        if let Some(value) = &self.receipt_url {
7469            validate::string(value.as_str(), None, Some(2000), path, out);
7470        }
7471        path.pop();
7472        path.push_key("vatCompany");
7473        if let Some(value) = &self.vat_company {
7474            Validate::validate_at(value, path, out);
7475        }
7476        path.pop();
7477        path.push_key("vatNumber");
7478        if let Some(value) = &self.vat_number {
7479            validate::string(value.as_str(), None, Some(20), path, out);
7480        }
7481        path.pop();
7482        path.push_key("customData");
7483        if let Some(value) = &self.custom_data {
7484            Validate::validate_at(value, path, out);
7485        }
7486        path.pop();
7487    }
7488}
7489
7490impl Sealed for NotifySettlementRequest {}
7491impl Request for NotifySettlementRequest {
7492    type Action = Action;
7493    const ACTION: Action = Action::NotifySettlement;
7494    const KIND: MessageKind = MessageKind::Call;
7495    const ORIGIN: Origin = Origin::ChargingStation;
7496    type Response = NotifySettlementResponse;
7497}
7498
7499impl Confirmed for NotifySettlementRequest {}
7500
7501/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
7502#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7503pub struct NotifySettlementResponse {
7504    /// The receipt URL if receipt generated by CSMS. The Charging Station can QR encode it and show it to the EV Driver.
7505    #[serde(rename = "receiptUrl")]
7506    #[serde(default, skip_serializing_if = "Option::is_none")]
7507    pub receipt_url: Option<String>,
7508    /// The receipt id if the receipt is generated by CSMS.
7509    #[serde(rename = "receiptId")]
7510    #[serde(default, skip_serializing_if = "Option::is_none")]
7511    pub receipt_id: Option<String>,
7512    /// The `customData` member.
7513    #[serde(rename = "customData")]
7514    #[serde(default, skip_serializing_if = "Option::is_none")]
7515    pub custom_data: Option<crate::types::CustomData>,
7516}
7517
7518impl NotifySettlementResponse {
7519    /// Creates an empty `NotifySettlementResponse`. Every field of this type is optional.
7520    #[must_use]
7521    pub fn new() -> Self {
7522        Self::default()
7523    }
7524
7525    /// Sets the optional `receiptUrl` field.
7526    #[must_use]
7527    pub fn with_receipt_url(mut self, value: impl Into<String>) -> Self {
7528        self.receipt_url = Some(value.into());
7529        self
7530    }
7531
7532    /// Sets the optional `receiptId` field.
7533    #[must_use]
7534    pub fn with_receipt_id(mut self, value: impl Into<String>) -> Self {
7535        self.receipt_id = Some(value.into());
7536        self
7537    }
7538
7539    /// Sets the optional `customData` field.
7540    #[must_use]
7541    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7542        self.custom_data = Some(value);
7543        self
7544    }
7545}
7546
7547impl Validate for NotifySettlementResponse {
7548    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7549        path.push_key("receiptUrl");
7550        if let Some(value) = &self.receipt_url {
7551            validate::string(value.as_str(), None, Some(2000), path, out);
7552        }
7553        path.pop();
7554        path.push_key("receiptId");
7555        if let Some(value) = &self.receipt_id {
7556            validate::string(value.as_str(), None, Some(50), path, out);
7557        }
7558        path.pop();
7559        path.push_key("customData");
7560        if let Some(value) = &self.custom_data {
7561            Validate::validate_at(value, path, out);
7562        }
7563        path.pop();
7564    }
7565}
7566
7567impl Sealed for NotifySettlementResponse {}
7568impl Response for NotifySettlementResponse {}
7569
7570/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
7571#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7572pub struct NotifyWebPaymentStartedRequest {
7573    /// EVSE id for which transaction is requested.
7574    #[serde(rename = "evseId")]
7575    pub evse_id: i32,
7576    /// Timeout value in seconds after which no result of web payment process (e.g. QR code scanning) is to be expected anymore.
7577    pub timeout: i32,
7578    /// The `customData` member.
7579    #[serde(rename = "customData")]
7580    #[serde(default, skip_serializing_if = "Option::is_none")]
7581    pub custom_data: Option<crate::types::CustomData>,
7582}
7583
7584impl NotifyWebPaymentStartedRequest {
7585    /// Creates a `NotifyWebPaymentStartedRequest` from its required fields.
7586    #[must_use]
7587    pub fn new(evse_id: i32, timeout: i32) -> Self {
7588        Self {
7589            evse_id,
7590            timeout,
7591            custom_data: None,
7592        }
7593    }
7594
7595    /// Sets the optional `customData` field.
7596    #[must_use]
7597    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7598        self.custom_data = Some(value);
7599        self
7600    }
7601}
7602
7603impl Validate for NotifyWebPaymentStartedRequest {
7604    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7605        path.push_key("evseId");
7606        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
7607        path.pop();
7608        path.push_key("customData");
7609        if let Some(value) = &self.custom_data {
7610            Validate::validate_at(value, path, out);
7611        }
7612        path.pop();
7613    }
7614}
7615
7616impl Sealed for NotifyWebPaymentStartedRequest {}
7617impl Request for NotifyWebPaymentStartedRequest {
7618    type Action = Action;
7619    const ACTION: Action = Action::NotifyWebPaymentStarted;
7620    const KIND: MessageKind = MessageKind::Call;
7621    const ORIGIN: Origin = Origin::ChargingStation;
7622    type Response = NotifyWebPaymentStartedResponse;
7623}
7624
7625impl Confirmed for NotifyWebPaymentStartedRequest {}
7626
7627/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
7628#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
7629pub struct NotifyWebPaymentStartedResponse {
7630    /// The `customData` member.
7631    #[serde(rename = "customData")]
7632    #[serde(default, skip_serializing_if = "Option::is_none")]
7633    pub custom_data: Option<crate::types::CustomData>,
7634}
7635
7636impl NotifyWebPaymentStartedResponse {
7637    /// Creates an empty `NotifyWebPaymentStartedResponse`. Every field of this type is optional.
7638    #[must_use]
7639    pub fn new() -> Self {
7640        Self::default()
7641    }
7642
7643    /// Sets the optional `customData` field.
7644    #[must_use]
7645    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7646        self.custom_data = Some(value);
7647        self
7648    }
7649}
7650
7651impl Validate for NotifyWebPaymentStartedResponse {
7652    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7653        path.push_key("customData");
7654        if let Some(value) = &self.custom_data {
7655            Validate::validate_at(value, path, out);
7656        }
7657        path.pop();
7658    }
7659}
7660
7661impl Sealed for NotifyWebPaymentStartedResponse {}
7662impl Response for NotifyWebPaymentStartedResponse {}
7663
7664/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
7665#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7666pub struct OpenPeriodicEventStreamRequest {
7667    /// The `constantStreamData` member.
7668    #[serde(rename = "constantStreamData")]
7669    pub constant_stream_data: ConstantStreamData,
7670    /// The `customData` member.
7671    #[serde(rename = "customData")]
7672    #[serde(default, skip_serializing_if = "Option::is_none")]
7673    pub custom_data: Option<crate::types::CustomData>,
7674}
7675
7676impl OpenPeriodicEventStreamRequest {
7677    /// Creates a `OpenPeriodicEventStreamRequest` from its required fields.
7678    #[must_use]
7679    pub fn new(constant_stream_data: ConstantStreamData) -> Self {
7680        Self {
7681            constant_stream_data,
7682            custom_data: None,
7683        }
7684    }
7685
7686    /// Sets the optional `customData` field.
7687    #[must_use]
7688    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7689        self.custom_data = Some(value);
7690        self
7691    }
7692}
7693
7694impl Validate for OpenPeriodicEventStreamRequest {
7695    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7696        path.push_key("constantStreamData");
7697        Validate::validate_at(&self.constant_stream_data, path, out);
7698        path.pop();
7699        path.push_key("customData");
7700        if let Some(value) = &self.custom_data {
7701            Validate::validate_at(value, path, out);
7702        }
7703        path.pop();
7704    }
7705}
7706
7707impl Sealed for OpenPeriodicEventStreamRequest {}
7708impl Request for OpenPeriodicEventStreamRequest {
7709    type Action = Action;
7710    const ACTION: Action = Action::OpenPeriodicEventStream;
7711    const KIND: MessageKind = MessageKind::Call;
7712    const ORIGIN: Origin = Origin::ChargingStation;
7713    type Response = OpenPeriodicEventStreamResponse;
7714}
7715
7716impl Confirmed for OpenPeriodicEventStreamRequest {}
7717
7718/// Spec: OCPP 2.1 · N — Diagnostics · Charging Station → CSMS · CALL.
7719#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7720pub struct OpenPeriodicEventStreamResponse {
7721    /// The `status` member.
7722    pub status: GenericStatus,
7723    /// The `statusInfo` member.
7724    #[serde(rename = "statusInfo")]
7725    #[serde(default, skip_serializing_if = "Option::is_none")]
7726    pub status_info: Option<StatusInfo>,
7727    /// The `customData` member.
7728    #[serde(rename = "customData")]
7729    #[serde(default, skip_serializing_if = "Option::is_none")]
7730    pub custom_data: Option<crate::types::CustomData>,
7731}
7732
7733impl OpenPeriodicEventStreamResponse {
7734    /// Creates a `OpenPeriodicEventStreamResponse` from its required fields.
7735    #[must_use]
7736    pub fn new(status: GenericStatus) -> Self {
7737        Self {
7738            status,
7739            status_info: None,
7740            custom_data: None,
7741        }
7742    }
7743
7744    /// Sets the optional `statusInfo` field.
7745    #[must_use]
7746    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7747        self.status_info = Some(value);
7748        self
7749    }
7750
7751    /// Sets the optional `customData` field.
7752    #[must_use]
7753    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7754        self.custom_data = Some(value);
7755        self
7756    }
7757}
7758
7759impl Validate for OpenPeriodicEventStreamResponse {
7760    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7761        path.push_key("status");
7762        Validate::validate_at(&self.status, path, out);
7763        path.pop();
7764        path.push_key("statusInfo");
7765        if let Some(value) = &self.status_info {
7766            Validate::validate_at(value, path, out);
7767        }
7768        path.pop();
7769        path.push_key("customData");
7770        if let Some(value) = &self.custom_data {
7771            Validate::validate_at(value, path, out);
7772        }
7773        path.pop();
7774    }
7775}
7776
7777impl Sealed for OpenPeriodicEventStreamResponse {}
7778impl Response for OpenPeriodicEventStreamResponse {}
7779
7780/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
7781#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7782pub struct PublishFirmwareRequest {
7783    /// This contains a string containing a URI pointing to a
7784    /// location from which to retrieve the firmware.
7785    pub location: String,
7786    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
7787    pub checksum: String,
7788    /// The Id of the request.
7789    #[serde(rename = "requestId")]
7790    pub request_id: i32,
7791    /// This specifies how many times Charging Station must retry
7792    /// to download the firmware before giving up. If this field is not
7793    /// present, it is left to Charging Station to decide how many times it wants to retry.
7794    /// If the value is 0, it means: no retries.
7795    #[serde(default, skip_serializing_if = "Option::is_none")]
7796    pub retries: Option<i32>,
7797    /// The interval in seconds
7798    /// after which a retry may be
7799    /// attempted. If this field is not
7800    /// present, it is left to Charging
7801    /// Station to decide how long to wait
7802    /// between attempts.
7803    #[serde(rename = "retryInterval")]
7804    #[serde(default, skip_serializing_if = "Option::is_none")]
7805    pub retry_interval: Option<i32>,
7806    /// The `customData` member.
7807    #[serde(rename = "customData")]
7808    #[serde(default, skip_serializing_if = "Option::is_none")]
7809    pub custom_data: Option<crate::types::CustomData>,
7810}
7811
7812impl PublishFirmwareRequest {
7813    /// Creates a `PublishFirmwareRequest` from its required fields.
7814    #[must_use]
7815    pub fn new(location: impl Into<String>, checksum: impl Into<String>, request_id: i32) -> Self {
7816        Self {
7817            location: location.into(),
7818            checksum: checksum.into(),
7819            request_id,
7820            retries: None,
7821            retry_interval: None,
7822            custom_data: None,
7823        }
7824    }
7825
7826    /// Sets the optional `retries` field.
7827    #[must_use]
7828    pub fn with_retries(mut self, value: i32) -> Self {
7829        self.retries = Some(value);
7830        self
7831    }
7832
7833    /// Sets the optional `retryInterval` field.
7834    #[must_use]
7835    pub fn with_retry_interval(mut self, value: i32) -> Self {
7836        self.retry_interval = Some(value);
7837        self
7838    }
7839
7840    /// Sets the optional `customData` field.
7841    #[must_use]
7842    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7843        self.custom_data = Some(value);
7844        self
7845    }
7846}
7847
7848impl Validate for PublishFirmwareRequest {
7849    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7850        path.push_key("location");
7851        validate::string(self.location.as_str(), None, Some(2000), path, out);
7852        path.pop();
7853        path.push_key("checksum");
7854        validate::string(self.checksum.as_str(), None, Some(32), path, out);
7855        path.pop();
7856        path.push_key("requestId");
7857        validate::int_range(i64::from(self.request_id), Some(0.0), None, path, out);
7858        path.pop();
7859        path.push_key("retries");
7860        if let Some(value) = &self.retries {
7861            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
7862        }
7863        path.pop();
7864        path.push_key("retryInterval");
7865        if let Some(value) = &self.retry_interval {
7866            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
7867        }
7868        path.pop();
7869        path.push_key("customData");
7870        if let Some(value) = &self.custom_data {
7871            Validate::validate_at(value, path, out);
7872        }
7873        path.pop();
7874    }
7875}
7876
7877impl Sealed for PublishFirmwareRequest {}
7878impl Request for PublishFirmwareRequest {
7879    type Action = Action;
7880    const ACTION: Action = Action::PublishFirmware;
7881    const KIND: MessageKind = MessageKind::Call;
7882    const ORIGIN: Origin = Origin::Csms;
7883    type Response = PublishFirmwareResponse;
7884}
7885
7886impl Confirmed for PublishFirmwareRequest {}
7887
7888/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
7889#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7890pub struct PublishFirmwareResponse {
7891    /// The `status` member.
7892    pub status: GenericStatus,
7893    /// The `statusInfo` member.
7894    #[serde(rename = "statusInfo")]
7895    #[serde(default, skip_serializing_if = "Option::is_none")]
7896    pub status_info: Option<StatusInfo>,
7897    /// The `customData` member.
7898    #[serde(rename = "customData")]
7899    #[serde(default, skip_serializing_if = "Option::is_none")]
7900    pub custom_data: Option<crate::types::CustomData>,
7901}
7902
7903impl PublishFirmwareResponse {
7904    /// Creates a `PublishFirmwareResponse` from its required fields.
7905    #[must_use]
7906    pub fn new(status: GenericStatus) -> Self {
7907        Self {
7908            status,
7909            status_info: None,
7910            custom_data: None,
7911        }
7912    }
7913
7914    /// Sets the optional `statusInfo` field.
7915    #[must_use]
7916    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
7917        self.status_info = Some(value);
7918        self
7919    }
7920
7921    /// Sets the optional `customData` field.
7922    #[must_use]
7923    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
7924        self.custom_data = Some(value);
7925        self
7926    }
7927}
7928
7929impl Validate for PublishFirmwareResponse {
7930    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
7931        path.push_key("status");
7932        Validate::validate_at(&self.status, path, out);
7933        path.pop();
7934        path.push_key("statusInfo");
7935        if let Some(value) = &self.status_info {
7936            Validate::validate_at(value, path, out);
7937        }
7938        path.pop();
7939        path.push_key("customData");
7940        if let Some(value) = &self.custom_data {
7941            Validate::validate_at(value, path, out);
7942        }
7943        path.pop();
7944    }
7945}
7946
7947impl Sealed for PublishFirmwareResponse {}
7948impl Response for PublishFirmwareResponse {}
7949
7950/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
7951#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7952pub struct PublishFirmwareStatusNotificationRequest {
7953    /// The `status` member.
7954    pub status: PublishFirmwareStatus,
7955    /// Required if status is Published. Can be multiple URI’s, if the Local Controller supports e.g. HTTP, HTTPS, and FTP.
7956    #[serde(default, skip_serializing_if = "Option::is_none")]
7957    pub location: Option<Vec<String>>,
7958    /// The request id that was
7959    /// provided in the
7960    /// PublishFirmwareRequest which
7961    /// triggered this action.
7962    #[serde(rename = "requestId")]
7963    #[serde(default, skip_serializing_if = "Option::is_none")]
7964    pub request_id: Option<i32>,
7965    /// The `statusInfo` member.
7966    #[serde(rename = "statusInfo")]
7967    #[serde(default, skip_serializing_if = "Option::is_none")]
7968    pub status_info: Option<StatusInfo>,
7969    /// The `customData` member.
7970    #[serde(rename = "customData")]
7971    #[serde(default, skip_serializing_if = "Option::is_none")]
7972    pub custom_data: Option<crate::types::CustomData>,
7973}
7974
7975impl PublishFirmwareStatusNotificationRequest {
7976    /// Creates a `PublishFirmwareStatusNotificationRequest` from its required fields.
7977    #[must_use]
7978    pub fn new(status: PublishFirmwareStatus) -> Self {
7979        Self {
7980            status,
7981            location: None,
7982            request_id: None,
7983            status_info: None,
7984            custom_data: None,
7985        }
7986    }
7987
7988    /// Sets the optional `location` field.
7989    #[must_use]
7990    pub fn with_location(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
7991        self.location = Some(value.into_iter().map(Into::into).collect());
7992        self
7993    }
7994
7995    /// Sets the optional `requestId` field.
7996    #[must_use]
7997    pub fn with_request_id(mut self, value: i32) -> Self {
7998        self.request_id = Some(value);
7999        self
8000    }
8001
8002    /// Sets the optional `statusInfo` field.
8003    #[must_use]
8004    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8005        self.status_info = Some(value);
8006        self
8007    }
8008
8009    /// Sets the optional `customData` field.
8010    #[must_use]
8011    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8012        self.custom_data = Some(value);
8013        self
8014    }
8015}
8016
8017impl Validate for PublishFirmwareStatusNotificationRequest {
8018    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8019        path.push_key("status");
8020        Validate::validate_at(&self.status, path, out);
8021        path.pop();
8022        path.push_key("location");
8023        if let Some(value) = &self.location {
8024            validate::list_len(value.len(), Some(1), None, path, out);
8025            for (index, item) in value.iter().enumerate() {
8026                path.push_index(index);
8027                validate::string(item.as_str(), None, Some(2000), path, out);
8028                path.pop();
8029            }
8030        }
8031        path.pop();
8032        path.push_key("requestId");
8033        if let Some(value) = &self.request_id {
8034            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
8035        }
8036        path.pop();
8037        path.push_key("statusInfo");
8038        if let Some(value) = &self.status_info {
8039            Validate::validate_at(value, path, out);
8040        }
8041        path.pop();
8042        path.push_key("customData");
8043        if let Some(value) = &self.custom_data {
8044            Validate::validate_at(value, path, out);
8045        }
8046        path.pop();
8047    }
8048}
8049
8050impl Sealed for PublishFirmwareStatusNotificationRequest {}
8051impl Request for PublishFirmwareStatusNotificationRequest {
8052    type Action = Action;
8053    const ACTION: Action = Action::PublishFirmwareStatusNotification;
8054    const KIND: MessageKind = MessageKind::Call;
8055    const ORIGIN: Origin = Origin::ChargingStation;
8056    type Response = PublishFirmwareStatusNotificationResponse;
8057}
8058
8059impl Confirmed for PublishFirmwareStatusNotificationRequest {}
8060
8061/// Spec: OCPP 2.1 · L — Firmware Management · Charging Station → CSMS · CALL.
8062#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8063pub struct PublishFirmwareStatusNotificationResponse {
8064    /// The `customData` member.
8065    #[serde(rename = "customData")]
8066    #[serde(default, skip_serializing_if = "Option::is_none")]
8067    pub custom_data: Option<crate::types::CustomData>,
8068}
8069
8070impl PublishFirmwareStatusNotificationResponse {
8071    /// Creates an empty `PublishFirmwareStatusNotificationResponse`. Every field of this type is optional.
8072    #[must_use]
8073    pub fn new() -> Self {
8074        Self::default()
8075    }
8076
8077    /// Sets the optional `customData` field.
8078    #[must_use]
8079    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8080        self.custom_data = Some(value);
8081        self
8082    }
8083}
8084
8085impl Validate for PublishFirmwareStatusNotificationResponse {
8086    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8087        path.push_key("customData");
8088        if let Some(value) = &self.custom_data {
8089            Validate::validate_at(value, path, out);
8090        }
8091        path.pop();
8092    }
8093}
8094
8095impl Sealed for PublishFirmwareStatusNotificationResponse {}
8096impl Response for PublishFirmwareStatusNotificationResponse {}
8097
8098/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8099#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8100pub struct PullDynamicScheduleUpdateRequest {
8101    /// Id of charging profile to update.
8102    #[serde(rename = "chargingProfileId")]
8103    pub charging_profile_id: i32,
8104    /// The `customData` member.
8105    #[serde(rename = "customData")]
8106    #[serde(default, skip_serializing_if = "Option::is_none")]
8107    pub custom_data: Option<crate::types::CustomData>,
8108}
8109
8110impl PullDynamicScheduleUpdateRequest {
8111    /// Creates a `PullDynamicScheduleUpdateRequest` from its required fields.
8112    #[must_use]
8113    pub fn new(charging_profile_id: i32) -> Self {
8114        Self {
8115            charging_profile_id,
8116            custom_data: None,
8117        }
8118    }
8119
8120    /// Sets the optional `customData` field.
8121    #[must_use]
8122    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8123        self.custom_data = Some(value);
8124        self
8125    }
8126}
8127
8128impl Validate for PullDynamicScheduleUpdateRequest {
8129    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8130        path.push_key("customData");
8131        if let Some(value) = &self.custom_data {
8132            Validate::validate_at(value, path, out);
8133        }
8134        path.pop();
8135    }
8136}
8137
8138impl Sealed for PullDynamicScheduleUpdateRequest {}
8139impl Request for PullDynamicScheduleUpdateRequest {
8140    type Action = Action;
8141    const ACTION: Action = Action::PullDynamicScheduleUpdate;
8142    const KIND: MessageKind = MessageKind::Call;
8143    const ORIGIN: Origin = Origin::ChargingStation;
8144    type Response = PullDynamicScheduleUpdateResponse;
8145}
8146
8147impl Confirmed for PullDynamicScheduleUpdateRequest {}
8148
8149/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8150#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8151pub struct PullDynamicScheduleUpdateResponse {
8152    /// The `status` member.
8153    pub status: ChargingProfileStatus,
8154    /// The `scheduleUpdate` member.
8155    #[serde(rename = "scheduleUpdate")]
8156    #[serde(default, skip_serializing_if = "Option::is_none")]
8157    pub schedule_update: Option<ChargingScheduleUpdate>,
8158    /// The `statusInfo` member.
8159    #[serde(rename = "statusInfo")]
8160    #[serde(default, skip_serializing_if = "Option::is_none")]
8161    pub status_info: Option<StatusInfo>,
8162    /// The `customData` member.
8163    #[serde(rename = "customData")]
8164    #[serde(default, skip_serializing_if = "Option::is_none")]
8165    pub custom_data: Option<crate::types::CustomData>,
8166}
8167
8168impl PullDynamicScheduleUpdateResponse {
8169    /// Creates a `PullDynamicScheduleUpdateResponse` from its required fields.
8170    #[must_use]
8171    pub fn new(status: ChargingProfileStatus) -> Self {
8172        Self {
8173            status,
8174            schedule_update: None,
8175            status_info: None,
8176            custom_data: None,
8177        }
8178    }
8179
8180    /// Sets the optional `scheduleUpdate` field.
8181    #[must_use]
8182    pub fn with_schedule_update(mut self, value: ChargingScheduleUpdate) -> Self {
8183        self.schedule_update = Some(value);
8184        self
8185    }
8186
8187    /// Sets the optional `statusInfo` field.
8188    #[must_use]
8189    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8190        self.status_info = Some(value);
8191        self
8192    }
8193
8194    /// Sets the optional `customData` field.
8195    #[must_use]
8196    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8197        self.custom_data = Some(value);
8198        self
8199    }
8200}
8201
8202impl Validate for PullDynamicScheduleUpdateResponse {
8203    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8204        path.push_key("status");
8205        Validate::validate_at(&self.status, path, out);
8206        path.pop();
8207        path.push_key("scheduleUpdate");
8208        if let Some(value) = &self.schedule_update {
8209            Validate::validate_at(value, path, out);
8210        }
8211        path.pop();
8212        path.push_key("statusInfo");
8213        if let Some(value) = &self.status_info {
8214            Validate::validate_at(value, path, out);
8215        }
8216        path.pop();
8217        path.push_key("customData");
8218        if let Some(value) = &self.custom_data {
8219            Validate::validate_at(value, path, out);
8220        }
8221        path.pop();
8222    }
8223}
8224
8225impl Sealed for PullDynamicScheduleUpdateResponse {}
8226impl Response for PullDynamicScheduleUpdateResponse {}
8227
8228/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8229#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8230pub struct ReportChargingProfilesRequest {
8231    /// 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.
8232    #[serde(rename = "requestId")]
8233    pub request_id: i32,
8234    /// Source that has installed this charging profile. Values defined in Appendix as ChargingLimitSourceEnumStringType.
8235    #[serde(rename = "chargingLimitSource")]
8236    pub charging_limit_source: String,
8237    /// The `chargingProfile` member.
8238    #[serde(rename = "chargingProfile")]
8239    pub charging_profile: Vec<ChargingProfile>,
8240    /// The evse to which the charging profile applies. If evseId = 0, the message contains an overall limit for the Charging Station.
8241    #[serde(rename = "evseId")]
8242    pub evse_id: i32,
8243    /// To Be Continued. Default value when omitted: false. false indicates that there are no further messages as part of this report.
8244    /// Schema default: `false`.
8245    #[serde(default, skip_serializing_if = "Option::is_none")]
8246    pub tbc: Option<bool>,
8247    /// The `customData` member.
8248    #[serde(rename = "customData")]
8249    #[serde(default, skip_serializing_if = "Option::is_none")]
8250    pub custom_data: Option<crate::types::CustomData>,
8251}
8252
8253impl ReportChargingProfilesRequest {
8254    /// Creates a `ReportChargingProfilesRequest` from its required fields.
8255    #[must_use]
8256    pub fn new(
8257        request_id: i32,
8258        charging_limit_source: impl Into<String>,
8259        charging_profile: Vec<ChargingProfile>,
8260        evse_id: i32,
8261    ) -> Self {
8262        Self {
8263            request_id,
8264            charging_limit_source: charging_limit_source.into(),
8265            charging_profile,
8266            evse_id,
8267            tbc: None,
8268            custom_data: None,
8269        }
8270    }
8271
8272    /// Sets the optional `tbc` field.
8273    #[must_use]
8274    pub fn with_tbc(mut self, value: bool) -> Self {
8275        self.tbc = Some(value);
8276        self
8277    }
8278
8279    /// Sets the optional `customData` field.
8280    #[must_use]
8281    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8282        self.custom_data = Some(value);
8283        self
8284    }
8285}
8286
8287impl Validate for ReportChargingProfilesRequest {
8288    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8289        path.push_key("chargingLimitSource");
8290        validate::string(
8291            self.charging_limit_source.as_str(),
8292            None,
8293            Some(20),
8294            path,
8295            out,
8296        );
8297        path.pop();
8298        path.push_key("chargingProfile");
8299        validate::list_len(self.charging_profile.len(), Some(1), None, path, out);
8300        for (index, item) in self.charging_profile.iter().enumerate() {
8301            path.push_index(index);
8302            Validate::validate_at(item, path, out);
8303            path.pop();
8304        }
8305        path.pop();
8306        path.push_key("evseId");
8307        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
8308        path.pop();
8309        path.push_key("customData");
8310        if let Some(value) = &self.custom_data {
8311            Validate::validate_at(value, path, out);
8312        }
8313        path.pop();
8314    }
8315}
8316
8317impl Sealed for ReportChargingProfilesRequest {}
8318impl Request for ReportChargingProfilesRequest {
8319    type Action = Action;
8320    const ACTION: Action = Action::ReportChargingProfiles;
8321    const KIND: MessageKind = MessageKind::Call;
8322    const ORIGIN: Origin = Origin::ChargingStation;
8323    type Response = ReportChargingProfilesResponse;
8324}
8325
8326impl Confirmed for ReportChargingProfilesRequest {}
8327
8328/// Spec: OCPP 2.1 · K — Smart Charging · Charging Station → CSMS · CALL.
8329#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8330pub struct ReportChargingProfilesResponse {
8331    /// The `customData` member.
8332    #[serde(rename = "customData")]
8333    #[serde(default, skip_serializing_if = "Option::is_none")]
8334    pub custom_data: Option<crate::types::CustomData>,
8335}
8336
8337impl ReportChargingProfilesResponse {
8338    /// Creates an empty `ReportChargingProfilesResponse`. Every field of this type is optional.
8339    #[must_use]
8340    pub fn new() -> Self {
8341        Self::default()
8342    }
8343
8344    /// Sets the optional `customData` field.
8345    #[must_use]
8346    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8347        self.custom_data = Some(value);
8348        self
8349    }
8350}
8351
8352impl Validate for ReportChargingProfilesResponse {
8353    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8354        path.push_key("customData");
8355        if let Some(value) = &self.custom_data {
8356            Validate::validate_at(value, path, out);
8357        }
8358        path.pop();
8359    }
8360}
8361
8362impl Sealed for ReportChargingProfilesResponse {}
8363impl Response for ReportChargingProfilesResponse {}
8364
8365/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
8366#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8367pub struct ReportDERControlRequest {
8368    /// RequestId from GetDERControlRequest.
8369    #[serde(rename = "requestId")]
8370    pub request_id: i32,
8371    /// The `curve` member.
8372    #[serde(default, skip_serializing_if = "Option::is_none")]
8373    pub curve: Option<Vec<DERCurveGet>>,
8374    /// The `enterService` member.
8375    #[serde(rename = "enterService")]
8376    #[serde(default, skip_serializing_if = "Option::is_none")]
8377    pub enter_service: Option<Vec<EnterServiceGet>>,
8378    /// The `fixedPFAbsorb` member.
8379    #[serde(rename = "fixedPFAbsorb")]
8380    #[serde(default, skip_serializing_if = "Option::is_none")]
8381    pub fixed_pf_absorb: Option<Vec<FixedPFGet>>,
8382    /// The `fixedPFInject` member.
8383    #[serde(rename = "fixedPFInject")]
8384    #[serde(default, skip_serializing_if = "Option::is_none")]
8385    pub fixed_pf_inject: Option<Vec<FixedPFGet>>,
8386    /// The `fixedVar` member.
8387    #[serde(rename = "fixedVar")]
8388    #[serde(default, skip_serializing_if = "Option::is_none")]
8389    pub fixed_var: Option<Vec<FixedVarGet>>,
8390    /// The `freqDroop` member.
8391    #[serde(rename = "freqDroop")]
8392    #[serde(default, skip_serializing_if = "Option::is_none")]
8393    pub freq_droop: Option<Vec<FreqDroopGet>>,
8394    /// The `gradient` member.
8395    #[serde(default, skip_serializing_if = "Option::is_none")]
8396    pub gradient: Option<Vec<GradientGet>>,
8397    /// The `limitMaxDischarge` member.
8398    #[serde(rename = "limitMaxDischarge")]
8399    #[serde(default, skip_serializing_if = "Option::is_none")]
8400    pub limit_max_discharge: Option<Vec<LimitMaxDischargeGet>>,
8401    /// To Be Continued. Default value when omitted: false. +
8402    /// False indicates that there are no further messages as part of this report.
8403    #[serde(default, skip_serializing_if = "Option::is_none")]
8404    pub tbc: Option<bool>,
8405    /// The `customData` member.
8406    #[serde(rename = "customData")]
8407    #[serde(default, skip_serializing_if = "Option::is_none")]
8408    pub custom_data: Option<crate::types::CustomData>,
8409}
8410
8411impl ReportDERControlRequest {
8412    /// Creates a `ReportDERControlRequest` from its required fields.
8413    #[must_use]
8414    pub fn new(request_id: i32) -> Self {
8415        Self {
8416            request_id,
8417            curve: None,
8418            enter_service: None,
8419            fixed_pf_absorb: None,
8420            fixed_pf_inject: None,
8421            fixed_var: None,
8422            freq_droop: None,
8423            gradient: None,
8424            limit_max_discharge: None,
8425            tbc: None,
8426            custom_data: None,
8427        }
8428    }
8429
8430    /// Sets the optional `curve` field.
8431    #[must_use]
8432    pub fn with_curve(mut self, value: Vec<DERCurveGet>) -> Self {
8433        self.curve = Some(value);
8434        self
8435    }
8436
8437    /// Sets the optional `enterService` field.
8438    #[must_use]
8439    pub fn with_enter_service(mut self, value: Vec<EnterServiceGet>) -> Self {
8440        self.enter_service = Some(value);
8441        self
8442    }
8443
8444    /// Sets the optional `fixedPFAbsorb` field.
8445    #[must_use]
8446    pub fn with_fixed_pf_absorb(mut self, value: Vec<FixedPFGet>) -> Self {
8447        self.fixed_pf_absorb = Some(value);
8448        self
8449    }
8450
8451    /// Sets the optional `fixedPFInject` field.
8452    #[must_use]
8453    pub fn with_fixed_pf_inject(mut self, value: Vec<FixedPFGet>) -> Self {
8454        self.fixed_pf_inject = Some(value);
8455        self
8456    }
8457
8458    /// Sets the optional `fixedVar` field.
8459    #[must_use]
8460    pub fn with_fixed_var(mut self, value: Vec<FixedVarGet>) -> Self {
8461        self.fixed_var = Some(value);
8462        self
8463    }
8464
8465    /// Sets the optional `freqDroop` field.
8466    #[must_use]
8467    pub fn with_freq_droop(mut self, value: Vec<FreqDroopGet>) -> Self {
8468        self.freq_droop = Some(value);
8469        self
8470    }
8471
8472    /// Sets the optional `gradient` field.
8473    #[must_use]
8474    pub fn with_gradient(mut self, value: Vec<GradientGet>) -> Self {
8475        self.gradient = Some(value);
8476        self
8477    }
8478
8479    /// Sets the optional `limitMaxDischarge` field.
8480    #[must_use]
8481    pub fn with_limit_max_discharge(mut self, value: Vec<LimitMaxDischargeGet>) -> Self {
8482        self.limit_max_discharge = Some(value);
8483        self
8484    }
8485
8486    /// Sets the optional `tbc` field.
8487    #[must_use]
8488    pub fn with_tbc(mut self, value: bool) -> Self {
8489        self.tbc = Some(value);
8490        self
8491    }
8492
8493    /// Sets the optional `customData` field.
8494    #[must_use]
8495    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8496        self.custom_data = Some(value);
8497        self
8498    }
8499}
8500
8501impl Validate for ReportDERControlRequest {
8502    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8503        path.push_key("curve");
8504        if let Some(value) = &self.curve {
8505            validate::list_len(value.len(), Some(1), Some(24), path, out);
8506            for (index, item) in value.iter().enumerate() {
8507                path.push_index(index);
8508                Validate::validate_at(item, path, out);
8509                path.pop();
8510            }
8511        }
8512        path.pop();
8513        path.push_key("enterService");
8514        if let Some(value) = &self.enter_service {
8515            validate::list_len(value.len(), Some(1), Some(24), path, out);
8516            for (index, item) in value.iter().enumerate() {
8517                path.push_index(index);
8518                Validate::validate_at(item, path, out);
8519                path.pop();
8520            }
8521        }
8522        path.pop();
8523        path.push_key("fixedPFAbsorb");
8524        if let Some(value) = &self.fixed_pf_absorb {
8525            validate::list_len(value.len(), Some(1), Some(24), path, out);
8526            for (index, item) in value.iter().enumerate() {
8527                path.push_index(index);
8528                Validate::validate_at(item, path, out);
8529                path.pop();
8530            }
8531        }
8532        path.pop();
8533        path.push_key("fixedPFInject");
8534        if let Some(value) = &self.fixed_pf_inject {
8535            validate::list_len(value.len(), Some(1), Some(24), path, out);
8536            for (index, item) in value.iter().enumerate() {
8537                path.push_index(index);
8538                Validate::validate_at(item, path, out);
8539                path.pop();
8540            }
8541        }
8542        path.pop();
8543        path.push_key("fixedVar");
8544        if let Some(value) = &self.fixed_var {
8545            validate::list_len(value.len(), Some(1), Some(24), path, out);
8546            for (index, item) in value.iter().enumerate() {
8547                path.push_index(index);
8548                Validate::validate_at(item, path, out);
8549                path.pop();
8550            }
8551        }
8552        path.pop();
8553        path.push_key("freqDroop");
8554        if let Some(value) = &self.freq_droop {
8555            validate::list_len(value.len(), Some(1), Some(24), path, out);
8556            for (index, item) in value.iter().enumerate() {
8557                path.push_index(index);
8558                Validate::validate_at(item, path, out);
8559                path.pop();
8560            }
8561        }
8562        path.pop();
8563        path.push_key("gradient");
8564        if let Some(value) = &self.gradient {
8565            validate::list_len(value.len(), Some(1), Some(24), path, out);
8566            for (index, item) in value.iter().enumerate() {
8567                path.push_index(index);
8568                Validate::validate_at(item, path, out);
8569                path.pop();
8570            }
8571        }
8572        path.pop();
8573        path.push_key("limitMaxDischarge");
8574        if let Some(value) = &self.limit_max_discharge {
8575            validate::list_len(value.len(), Some(1), Some(24), path, out);
8576            for (index, item) in value.iter().enumerate() {
8577                path.push_index(index);
8578                Validate::validate_at(item, path, out);
8579                path.pop();
8580            }
8581        }
8582        path.pop();
8583        path.push_key("customData");
8584        if let Some(value) = &self.custom_data {
8585            Validate::validate_at(value, path, out);
8586        }
8587        path.pop();
8588    }
8589}
8590
8591impl Sealed for ReportDERControlRequest {}
8592impl Request for ReportDERControlRequest {
8593    type Action = Action;
8594    const ACTION: Action = Action::ReportDERControl;
8595    const KIND: MessageKind = MessageKind::Call;
8596    const ORIGIN: Origin = Origin::ChargingStation;
8597    type Response = ReportDERControlResponse;
8598}
8599
8600impl Confirmed for ReportDERControlRequest {}
8601
8602/// This message has no parameters.
8603///
8604/// Spec: OCPP 2.1 · R — DER Control · Charging Station → CSMS · CALL.
8605#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
8606pub struct ReportDERControlResponse {
8607    /// The `customData` member.
8608    #[serde(rename = "customData")]
8609    #[serde(default, skip_serializing_if = "Option::is_none")]
8610    pub custom_data: Option<crate::types::CustomData>,
8611}
8612
8613impl ReportDERControlResponse {
8614    /// Creates an empty `ReportDERControlResponse`. Every field of this type is optional.
8615    #[must_use]
8616    pub fn new() -> Self {
8617        Self::default()
8618    }
8619
8620    /// Sets the optional `customData` field.
8621    #[must_use]
8622    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8623        self.custom_data = Some(value);
8624        self
8625    }
8626}
8627
8628impl Validate for ReportDERControlResponse {
8629    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8630        path.push_key("customData");
8631        if let Some(value) = &self.custom_data {
8632            Validate::validate_at(value, path, out);
8633        }
8634        path.pop();
8635    }
8636}
8637
8638impl Sealed for ReportDERControlResponse {}
8639impl Response for ReportDERControlResponse {}
8640
8641/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
8642#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8643pub struct RequestBatterySwapRequest {
8644    /// The `idToken` member.
8645    #[serde(rename = "idToken")]
8646    pub id_token: IdToken,
8647    /// Request id to match with BatterySwapRequest.
8648    #[serde(rename = "requestId")]
8649    pub request_id: i32,
8650    /// The `customData` member.
8651    #[serde(rename = "customData")]
8652    #[serde(default, skip_serializing_if = "Option::is_none")]
8653    pub custom_data: Option<crate::types::CustomData>,
8654}
8655
8656impl RequestBatterySwapRequest {
8657    /// Creates a `RequestBatterySwapRequest` from its required fields.
8658    #[must_use]
8659    pub fn new(id_token: IdToken, request_id: i32) -> Self {
8660        Self {
8661            id_token,
8662            request_id,
8663            custom_data: None,
8664        }
8665    }
8666
8667    /// Sets the optional `customData` field.
8668    #[must_use]
8669    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8670        self.custom_data = Some(value);
8671        self
8672    }
8673}
8674
8675impl Validate for RequestBatterySwapRequest {
8676    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8677        path.push_key("idToken");
8678        Validate::validate_at(&self.id_token, path, out);
8679        path.pop();
8680        path.push_key("customData");
8681        if let Some(value) = &self.custom_data {
8682            Validate::validate_at(value, path, out);
8683        }
8684        path.pop();
8685    }
8686}
8687
8688impl Sealed for RequestBatterySwapRequest {}
8689impl Request for RequestBatterySwapRequest {
8690    type Action = Action;
8691    const ACTION: Action = Action::RequestBatterySwap;
8692    const KIND: MessageKind = MessageKind::Call;
8693    const ORIGIN: Origin = Origin::Csms;
8694    type Response = RequestBatterySwapResponse;
8695}
8696
8697impl Confirmed for RequestBatterySwapRequest {}
8698
8699/// Spec: OCPP 2.1 · S — Battery Swapping · CSMS → Charging Station · CALL.
8700#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8701pub struct RequestBatterySwapResponse {
8702    /// The `status` member.
8703    pub status: GenericStatus,
8704    /// The `statusInfo` member.
8705    #[serde(rename = "statusInfo")]
8706    #[serde(default, skip_serializing_if = "Option::is_none")]
8707    pub status_info: Option<StatusInfo>,
8708    /// The `customData` member.
8709    #[serde(rename = "customData")]
8710    #[serde(default, skip_serializing_if = "Option::is_none")]
8711    pub custom_data: Option<crate::types::CustomData>,
8712}
8713
8714impl RequestBatterySwapResponse {
8715    /// Creates a `RequestBatterySwapResponse` from its required fields.
8716    #[must_use]
8717    pub fn new(status: GenericStatus) -> Self {
8718        Self {
8719            status,
8720            status_info: None,
8721            custom_data: None,
8722        }
8723    }
8724
8725    /// Sets the optional `statusInfo` field.
8726    #[must_use]
8727    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8728        self.status_info = Some(value);
8729        self
8730    }
8731
8732    /// Sets the optional `customData` field.
8733    #[must_use]
8734    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8735        self.custom_data = Some(value);
8736        self
8737    }
8738}
8739
8740impl Validate for RequestBatterySwapResponse {
8741    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8742        path.push_key("status");
8743        Validate::validate_at(&self.status, path, out);
8744        path.pop();
8745        path.push_key("statusInfo");
8746        if let Some(value) = &self.status_info {
8747            Validate::validate_at(value, path, out);
8748        }
8749        path.pop();
8750        path.push_key("customData");
8751        if let Some(value) = &self.custom_data {
8752            Validate::validate_at(value, path, out);
8753        }
8754        path.pop();
8755    }
8756}
8757
8758impl Sealed for RequestBatterySwapResponse {}
8759impl Response for RequestBatterySwapResponse {}
8760
8761/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
8762#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8763pub struct RequestStartTransactionRequest {
8764    /// The `idToken` member.
8765    #[serde(rename = "idToken")]
8766    pub id_token: IdToken,
8767    /// Id given by the server to this start request. The Charging Station will return this in the &lt;&lt;transactioneventrequest, TransactionEventRequest&gt;&gt;, letting the server know which transaction was started for this request. Use to start a transaction.
8768    #[serde(rename = "remoteStartId")]
8769    pub remote_start_id: i32,
8770    /// Number of the EVSE on which to start the transaction. EvseId SHALL be &gt; 0
8771    #[serde(rename = "evseId")]
8772    #[serde(default, skip_serializing_if = "Option::is_none")]
8773    pub evse_id: Option<i32>,
8774    /// The `groupIdToken` member.
8775    #[serde(rename = "groupIdToken")]
8776    #[serde(default, skip_serializing_if = "Option::is_none")]
8777    pub group_id_token: Option<IdToken>,
8778    /// The `chargingProfile` member.
8779    #[serde(rename = "chargingProfile")]
8780    #[serde(default, skip_serializing_if = "Option::is_none")]
8781    pub charging_profile: Option<ChargingProfile>,
8782    /// The `customData` member.
8783    #[serde(rename = "customData")]
8784    #[serde(default, skip_serializing_if = "Option::is_none")]
8785    pub custom_data: Option<crate::types::CustomData>,
8786}
8787
8788impl RequestStartTransactionRequest {
8789    /// Creates a `RequestStartTransactionRequest` from its required fields.
8790    #[must_use]
8791    pub fn new(id_token: IdToken, remote_start_id: i32) -> Self {
8792        Self {
8793            id_token,
8794            remote_start_id,
8795            evse_id: None,
8796            group_id_token: None,
8797            charging_profile: None,
8798            custom_data: None,
8799        }
8800    }
8801
8802    /// Sets the optional `evseId` field.
8803    #[must_use]
8804    pub fn with_evse_id(mut self, value: i32) -> Self {
8805        self.evse_id = Some(value);
8806        self
8807    }
8808
8809    /// Sets the optional `groupIdToken` field.
8810    #[must_use]
8811    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
8812        self.group_id_token = Some(value);
8813        self
8814    }
8815
8816    /// Sets the optional `chargingProfile` field.
8817    #[must_use]
8818    pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
8819        self.charging_profile = Some(value);
8820        self
8821    }
8822
8823    /// Sets the optional `customData` field.
8824    #[must_use]
8825    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8826        self.custom_data = Some(value);
8827        self
8828    }
8829}
8830
8831impl Validate for RequestStartTransactionRequest {
8832    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8833        path.push_key("idToken");
8834        Validate::validate_at(&self.id_token, path, out);
8835        path.pop();
8836        path.push_key("evseId");
8837        if let Some(value) = &self.evse_id {
8838            validate::int_range(i64::from(*value), Some(1.0), None, path, out);
8839        }
8840        path.pop();
8841        path.push_key("groupIdToken");
8842        if let Some(value) = &self.group_id_token {
8843            Validate::validate_at(value, path, out);
8844        }
8845        path.pop();
8846        path.push_key("chargingProfile");
8847        if let Some(value) = &self.charging_profile {
8848            Validate::validate_at(value, path, out);
8849        }
8850        path.pop();
8851        path.push_key("customData");
8852        if let Some(value) = &self.custom_data {
8853            Validate::validate_at(value, path, out);
8854        }
8855        path.pop();
8856    }
8857}
8858
8859impl Sealed for RequestStartTransactionRequest {}
8860impl Request for RequestStartTransactionRequest {
8861    type Action = Action;
8862    const ACTION: Action = Action::RequestStartTransaction;
8863    const KIND: MessageKind = MessageKind::Call;
8864    const ORIGIN: Origin = Origin::Csms;
8865    type Response = RequestStartTransactionResponse;
8866}
8867
8868impl Confirmed for RequestStartTransactionRequest {}
8869
8870/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
8871#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8872pub struct RequestStartTransactionResponse {
8873    /// The `status` member.
8874    pub status: RequestStartStopStatus,
8875    /// The `statusInfo` member.
8876    #[serde(rename = "statusInfo")]
8877    #[serde(default, skip_serializing_if = "Option::is_none")]
8878    pub status_info: Option<StatusInfo>,
8879    /// 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.
8880    #[serde(rename = "transactionId")]
8881    #[serde(default, skip_serializing_if = "Option::is_none")]
8882    pub transaction_id: Option<String>,
8883    /// The `customData` member.
8884    #[serde(rename = "customData")]
8885    #[serde(default, skip_serializing_if = "Option::is_none")]
8886    pub custom_data: Option<crate::types::CustomData>,
8887}
8888
8889impl RequestStartTransactionResponse {
8890    /// Creates a `RequestStartTransactionResponse` from its required fields.
8891    #[must_use]
8892    pub fn new(status: RequestStartStopStatus) -> Self {
8893        Self {
8894            status,
8895            status_info: None,
8896            transaction_id: None,
8897            custom_data: None,
8898        }
8899    }
8900
8901    /// Sets the optional `statusInfo` field.
8902    #[must_use]
8903    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
8904        self.status_info = Some(value);
8905        self
8906    }
8907
8908    /// Sets the optional `transactionId` field.
8909    #[must_use]
8910    pub fn with_transaction_id(mut self, value: impl Into<String>) -> Self {
8911        self.transaction_id = Some(value.into());
8912        self
8913    }
8914
8915    /// Sets the optional `customData` field.
8916    #[must_use]
8917    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8918        self.custom_data = Some(value);
8919        self
8920    }
8921}
8922
8923impl Validate for RequestStartTransactionResponse {
8924    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8925        path.push_key("status");
8926        Validate::validate_at(&self.status, path, out);
8927        path.pop();
8928        path.push_key("statusInfo");
8929        if let Some(value) = &self.status_info {
8930            Validate::validate_at(value, path, out);
8931        }
8932        path.pop();
8933        path.push_key("transactionId");
8934        if let Some(value) = &self.transaction_id {
8935            validate::string(value.as_str(), None, Some(36), path, out);
8936        }
8937        path.pop();
8938        path.push_key("customData");
8939        if let Some(value) = &self.custom_data {
8940            Validate::validate_at(value, path, out);
8941        }
8942        path.pop();
8943    }
8944}
8945
8946impl Sealed for RequestStartTransactionResponse {}
8947impl Response for RequestStartTransactionResponse {}
8948
8949/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
8950#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
8951pub struct RequestStopTransactionRequest {
8952    /// The identifier of the transaction which the Charging Station is requested to stop.
8953    #[serde(rename = "transactionId")]
8954    pub transaction_id: String,
8955    /// The `customData` member.
8956    #[serde(rename = "customData")]
8957    #[serde(default, skip_serializing_if = "Option::is_none")]
8958    pub custom_data: Option<crate::types::CustomData>,
8959}
8960
8961impl RequestStopTransactionRequest {
8962    /// Creates a `RequestStopTransactionRequest` from its required fields.
8963    #[must_use]
8964    pub fn new(transaction_id: impl Into<String>) -> Self {
8965        Self {
8966            transaction_id: transaction_id.into(),
8967            custom_data: None,
8968        }
8969    }
8970
8971    /// Sets the optional `customData` field.
8972    #[must_use]
8973    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
8974        self.custom_data = Some(value);
8975        self
8976    }
8977}
8978
8979impl Validate for RequestStopTransactionRequest {
8980    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
8981        path.push_key("transactionId");
8982        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
8983        path.pop();
8984        path.push_key("customData");
8985        if let Some(value) = &self.custom_data {
8986            Validate::validate_at(value, path, out);
8987        }
8988        path.pop();
8989    }
8990}
8991
8992impl Sealed for RequestStopTransactionRequest {}
8993impl Request for RequestStopTransactionRequest {
8994    type Action = Action;
8995    const ACTION: Action = Action::RequestStopTransaction;
8996    const KIND: MessageKind = MessageKind::Call;
8997    const ORIGIN: Origin = Origin::Csms;
8998    type Response = RequestStopTransactionResponse;
8999}
9000
9001impl Confirmed for RequestStopTransactionRequest {}
9002
9003/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
9004#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9005pub struct RequestStopTransactionResponse {
9006    /// The `status` member.
9007    pub status: RequestStartStopStatus,
9008    /// The `statusInfo` member.
9009    #[serde(rename = "statusInfo")]
9010    #[serde(default, skip_serializing_if = "Option::is_none")]
9011    pub status_info: Option<StatusInfo>,
9012    /// The `customData` member.
9013    #[serde(rename = "customData")]
9014    #[serde(default, skip_serializing_if = "Option::is_none")]
9015    pub custom_data: Option<crate::types::CustomData>,
9016}
9017
9018impl RequestStopTransactionResponse {
9019    /// Creates a `RequestStopTransactionResponse` from its required fields.
9020    #[must_use]
9021    pub fn new(status: RequestStartStopStatus) -> Self {
9022        Self {
9023            status,
9024            status_info: None,
9025            custom_data: None,
9026        }
9027    }
9028
9029    /// Sets the optional `statusInfo` field.
9030    #[must_use]
9031    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9032        self.status_info = Some(value);
9033        self
9034    }
9035
9036    /// Sets the optional `customData` field.
9037    #[must_use]
9038    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9039        self.custom_data = Some(value);
9040        self
9041    }
9042}
9043
9044impl Validate for RequestStopTransactionResponse {
9045    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9046        path.push_key("status");
9047        Validate::validate_at(&self.status, path, out);
9048        path.pop();
9049        path.push_key("statusInfo");
9050        if let Some(value) = &self.status_info {
9051            Validate::validate_at(value, path, out);
9052        }
9053        path.pop();
9054        path.push_key("customData");
9055        if let Some(value) = &self.custom_data {
9056            Validate::validate_at(value, path, out);
9057        }
9058        path.pop();
9059    }
9060}
9061
9062impl Sealed for RequestStopTransactionResponse {}
9063impl Response for RequestStopTransactionResponse {}
9064
9065/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
9066#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9067pub struct ReservationStatusUpdateRequest {
9068    /// The ID of the reservation.
9069    #[serde(rename = "reservationId")]
9070    pub reservation_id: i32,
9071    /// The `reservationUpdateStatus` member.
9072    #[serde(rename = "reservationUpdateStatus")]
9073    pub reservation_update_status: ReservationUpdateStatus,
9074    /// The `customData` member.
9075    #[serde(rename = "customData")]
9076    #[serde(default, skip_serializing_if = "Option::is_none")]
9077    pub custom_data: Option<crate::types::CustomData>,
9078}
9079
9080impl ReservationStatusUpdateRequest {
9081    /// Creates a `ReservationStatusUpdateRequest` from its required fields.
9082    #[must_use]
9083    pub fn new(reservation_id: i32, reservation_update_status: ReservationUpdateStatus) -> Self {
9084        Self {
9085            reservation_id,
9086            reservation_update_status,
9087            custom_data: None,
9088        }
9089    }
9090
9091    /// Sets the optional `customData` field.
9092    #[must_use]
9093    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9094        self.custom_data = Some(value);
9095        self
9096    }
9097}
9098
9099impl Validate for ReservationStatusUpdateRequest {
9100    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9101        path.push_key("reservationId");
9102        validate::int_range(i64::from(self.reservation_id), Some(0.0), None, path, out);
9103        path.pop();
9104        path.push_key("reservationUpdateStatus");
9105        Validate::validate_at(&self.reservation_update_status, path, out);
9106        path.pop();
9107        path.push_key("customData");
9108        if let Some(value) = &self.custom_data {
9109            Validate::validate_at(value, path, out);
9110        }
9111        path.pop();
9112    }
9113}
9114
9115impl Sealed for ReservationStatusUpdateRequest {}
9116impl Request for ReservationStatusUpdateRequest {
9117    type Action = Action;
9118    const ACTION: Action = Action::ReservationStatusUpdate;
9119    const KIND: MessageKind = MessageKind::Call;
9120    const ORIGIN: Origin = Origin::ChargingStation;
9121    type Response = ReservationStatusUpdateResponse;
9122}
9123
9124impl Confirmed for ReservationStatusUpdateRequest {}
9125
9126/// Spec: OCPP 2.1 · H — Reservation · Charging Station → CSMS · CALL.
9127#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9128pub struct ReservationStatusUpdateResponse {
9129    /// The `customData` member.
9130    #[serde(rename = "customData")]
9131    #[serde(default, skip_serializing_if = "Option::is_none")]
9132    pub custom_data: Option<crate::types::CustomData>,
9133}
9134
9135impl ReservationStatusUpdateResponse {
9136    /// Creates an empty `ReservationStatusUpdateResponse`. Every field of this type is optional.
9137    #[must_use]
9138    pub fn new() -> Self {
9139        Self::default()
9140    }
9141
9142    /// Sets the optional `customData` field.
9143    #[must_use]
9144    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9145        self.custom_data = Some(value);
9146        self
9147    }
9148}
9149
9150impl Validate for ReservationStatusUpdateResponse {
9151    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9152        path.push_key("customData");
9153        if let Some(value) = &self.custom_data {
9154            Validate::validate_at(value, path, out);
9155        }
9156        path.pop();
9157    }
9158}
9159
9160impl Sealed for ReservationStatusUpdateResponse {}
9161impl Response for ReservationStatusUpdateResponse {}
9162
9163/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
9164#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9165pub struct ReserveNowRequest {
9166    /// Id of reservation.
9167    pub id: i32,
9168    /// Date and time at which the reservation expires.
9169    #[serde(rename = "expiryDateTime")]
9170    pub expiry_date_time: crate::types::DateTime,
9171    /// The `idToken` member.
9172    #[serde(rename = "idToken")]
9173    pub id_token: IdToken,
9174    /// This field specifies the connector type. Values defined in Appendix as ConnectorEnumStringType.
9175    #[serde(rename = "connectorType")]
9176    #[serde(default, skip_serializing_if = "Option::is_none")]
9177    pub connector_type: Option<String>,
9178    /// This contains ID of the evse to be reserved.
9179    #[serde(rename = "evseId")]
9180    #[serde(default, skip_serializing_if = "Option::is_none")]
9181    pub evse_id: Option<i32>,
9182    /// The `groupIdToken` member.
9183    #[serde(rename = "groupIdToken")]
9184    #[serde(default, skip_serializing_if = "Option::is_none")]
9185    pub group_id_token: Option<IdToken>,
9186    /// The `customData` member.
9187    #[serde(rename = "customData")]
9188    #[serde(default, skip_serializing_if = "Option::is_none")]
9189    pub custom_data: Option<crate::types::CustomData>,
9190}
9191
9192impl ReserveNowRequest {
9193    /// Creates a `ReserveNowRequest` from its required fields.
9194    #[must_use]
9195    pub fn new(
9196        id: i32,
9197        expiry_date_time: impl Into<crate::types::DateTime>,
9198        id_token: IdToken,
9199    ) -> Self {
9200        Self {
9201            id,
9202            expiry_date_time: expiry_date_time.into(),
9203            id_token,
9204            connector_type: None,
9205            evse_id: None,
9206            group_id_token: None,
9207            custom_data: None,
9208        }
9209    }
9210
9211    /// Sets the optional `connectorType` field.
9212    #[must_use]
9213    pub fn with_connector_type(mut self, value: impl Into<String>) -> Self {
9214        self.connector_type = Some(value.into());
9215        self
9216    }
9217
9218    /// Sets the optional `evseId` field.
9219    #[must_use]
9220    pub fn with_evse_id(mut self, value: i32) -> Self {
9221        self.evse_id = Some(value);
9222        self
9223    }
9224
9225    /// Sets the optional `groupIdToken` field.
9226    #[must_use]
9227    pub fn with_group_id_token(mut self, value: IdToken) -> Self {
9228        self.group_id_token = Some(value);
9229        self
9230    }
9231
9232    /// Sets the optional `customData` field.
9233    #[must_use]
9234    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9235        self.custom_data = Some(value);
9236        self
9237    }
9238}
9239
9240impl Validate for ReserveNowRequest {
9241    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9242        path.push_key("id");
9243        validate::int_range(i64::from(self.id), Some(0.0), None, path, out);
9244        path.pop();
9245        path.push_key("idToken");
9246        Validate::validate_at(&self.id_token, path, out);
9247        path.pop();
9248        path.push_key("connectorType");
9249        if let Some(value) = &self.connector_type {
9250            validate::string(value.as_str(), None, Some(20), path, out);
9251        }
9252        path.pop();
9253        path.push_key("evseId");
9254        if let Some(value) = &self.evse_id {
9255            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
9256        }
9257        path.pop();
9258        path.push_key("groupIdToken");
9259        if let Some(value) = &self.group_id_token {
9260            Validate::validate_at(value, path, out);
9261        }
9262        path.pop();
9263        path.push_key("customData");
9264        if let Some(value) = &self.custom_data {
9265            Validate::validate_at(value, path, out);
9266        }
9267        path.pop();
9268    }
9269}
9270
9271impl Sealed for ReserveNowRequest {}
9272impl Request for ReserveNowRequest {
9273    type Action = Action;
9274    const ACTION: Action = Action::ReserveNow;
9275    const KIND: MessageKind = MessageKind::Call;
9276    const ORIGIN: Origin = Origin::Csms;
9277    type Response = ReserveNowResponse;
9278}
9279
9280impl Confirmed for ReserveNowRequest {}
9281
9282/// Spec: OCPP 2.1 · H — Reservation · CSMS → Charging Station · CALL.
9283#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9284pub struct ReserveNowResponse {
9285    /// The `status` member.
9286    pub status: ReserveNowStatus,
9287    /// The `statusInfo` member.
9288    #[serde(rename = "statusInfo")]
9289    #[serde(default, skip_serializing_if = "Option::is_none")]
9290    pub status_info: Option<StatusInfo>,
9291    /// The `customData` member.
9292    #[serde(rename = "customData")]
9293    #[serde(default, skip_serializing_if = "Option::is_none")]
9294    pub custom_data: Option<crate::types::CustomData>,
9295}
9296
9297impl ReserveNowResponse {
9298    /// Creates a `ReserveNowResponse` from its required fields.
9299    #[must_use]
9300    pub fn new(status: ReserveNowStatus) -> Self {
9301        Self {
9302            status,
9303            status_info: None,
9304            custom_data: None,
9305        }
9306    }
9307
9308    /// Sets the optional `statusInfo` field.
9309    #[must_use]
9310    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9311        self.status_info = Some(value);
9312        self
9313    }
9314
9315    /// Sets the optional `customData` field.
9316    #[must_use]
9317    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9318        self.custom_data = Some(value);
9319        self
9320    }
9321}
9322
9323impl Validate for ReserveNowResponse {
9324    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9325        path.push_key("status");
9326        Validate::validate_at(&self.status, path, out);
9327        path.pop();
9328        path.push_key("statusInfo");
9329        if let Some(value) = &self.status_info {
9330            Validate::validate_at(value, path, out);
9331        }
9332        path.pop();
9333        path.push_key("customData");
9334        if let Some(value) = &self.custom_data {
9335            Validate::validate_at(value, path, out);
9336        }
9337        path.pop();
9338    }
9339}
9340
9341impl Sealed for ReserveNowResponse {}
9342impl Response for ReserveNowResponse {}
9343
9344/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
9345#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9346pub struct ResetRequest {
9347    /// The `type` member.
9348    pub r#type: ResetEnum,
9349    /// This contains the ID of a specific EVSE that needs to be reset, instead of the entire Charging Station.
9350    #[serde(rename = "evseId")]
9351    #[serde(default, skip_serializing_if = "Option::is_none")]
9352    pub evse_id: Option<i32>,
9353    /// The `customData` member.
9354    #[serde(rename = "customData")]
9355    #[serde(default, skip_serializing_if = "Option::is_none")]
9356    pub custom_data: Option<crate::types::CustomData>,
9357}
9358
9359impl ResetRequest {
9360    /// Creates a `ResetRequest` from its required fields.
9361    #[must_use]
9362    pub fn new(r#type: ResetEnum) -> Self {
9363        Self {
9364            r#type,
9365            evse_id: None,
9366            custom_data: None,
9367        }
9368    }
9369
9370    /// Sets the optional `evseId` field.
9371    #[must_use]
9372    pub fn with_evse_id(mut self, value: i32) -> Self {
9373        self.evse_id = Some(value);
9374        self
9375    }
9376
9377    /// Sets the optional `customData` field.
9378    #[must_use]
9379    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9380        self.custom_data = Some(value);
9381        self
9382    }
9383}
9384
9385impl Validate for ResetRequest {
9386    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9387        path.push_key("type");
9388        Validate::validate_at(&self.r#type, path, out);
9389        path.pop();
9390        path.push_key("evseId");
9391        if let Some(value) = &self.evse_id {
9392            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
9393        }
9394        path.pop();
9395        path.push_key("customData");
9396        if let Some(value) = &self.custom_data {
9397            Validate::validate_at(value, path, out);
9398        }
9399        path.pop();
9400    }
9401}
9402
9403impl Sealed for ResetRequest {}
9404impl Request for ResetRequest {
9405    type Action = Action;
9406    const ACTION: Action = Action::Reset;
9407    const KIND: MessageKind = MessageKind::Call;
9408    const ORIGIN: Origin = Origin::Csms;
9409    type Response = ResetResponse;
9410}
9411
9412impl Confirmed for ResetRequest {}
9413
9414/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
9415#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9416pub struct ResetResponse {
9417    /// The `status` member.
9418    pub status: ResetStatus,
9419    /// The `statusInfo` member.
9420    #[serde(rename = "statusInfo")]
9421    #[serde(default, skip_serializing_if = "Option::is_none")]
9422    pub status_info: Option<StatusInfo>,
9423    /// The `customData` member.
9424    #[serde(rename = "customData")]
9425    #[serde(default, skip_serializing_if = "Option::is_none")]
9426    pub custom_data: Option<crate::types::CustomData>,
9427}
9428
9429impl ResetResponse {
9430    /// Creates a `ResetResponse` from its required fields.
9431    #[must_use]
9432    pub fn new(status: ResetStatus) -> Self {
9433        Self {
9434            status,
9435            status_info: None,
9436            custom_data: None,
9437        }
9438    }
9439
9440    /// Sets the optional `statusInfo` field.
9441    #[must_use]
9442    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9443        self.status_info = Some(value);
9444        self
9445    }
9446
9447    /// Sets the optional `customData` field.
9448    #[must_use]
9449    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9450        self.custom_data = Some(value);
9451        self
9452    }
9453}
9454
9455impl Validate for ResetResponse {
9456    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9457        path.push_key("status");
9458        Validate::validate_at(&self.status, path, out);
9459        path.pop();
9460        path.push_key("statusInfo");
9461        if let Some(value) = &self.status_info {
9462            Validate::validate_at(value, path, out);
9463        }
9464        path.pop();
9465        path.push_key("customData");
9466        if let Some(value) = &self.custom_data {
9467            Validate::validate_at(value, path, out);
9468        }
9469        path.pop();
9470    }
9471}
9472
9473impl Sealed for ResetResponse {}
9474impl Response for ResetResponse {}
9475
9476/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
9477#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9478pub struct SecurityEventNotificationRequest {
9479    /// Type of the security event. This value should be taken from the Security events list.
9480    pub r#type: String,
9481    /// Date and time at which the event occurred.
9482    pub timestamp: crate::types::DateTime,
9483    /// Additional information about the occurred security event.
9484    #[serde(rename = "techInfo")]
9485    #[serde(default, skip_serializing_if = "Option::is_none")]
9486    pub tech_info: Option<String>,
9487    /// The `customData` member.
9488    #[serde(rename = "customData")]
9489    #[serde(default, skip_serializing_if = "Option::is_none")]
9490    pub custom_data: Option<crate::types::CustomData>,
9491}
9492
9493impl SecurityEventNotificationRequest {
9494    /// Creates a `SecurityEventNotificationRequest` from its required fields.
9495    #[must_use]
9496    pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
9497        Self {
9498            r#type: r#type.into(),
9499            timestamp: timestamp.into(),
9500            tech_info: None,
9501            custom_data: None,
9502        }
9503    }
9504
9505    /// Sets the optional `techInfo` field.
9506    #[must_use]
9507    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
9508        self.tech_info = Some(value.into());
9509        self
9510    }
9511
9512    /// Sets the optional `customData` field.
9513    #[must_use]
9514    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9515        self.custom_data = Some(value);
9516        self
9517    }
9518}
9519
9520impl Validate for SecurityEventNotificationRequest {
9521    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9522        path.push_key("type");
9523        validate::string(self.r#type.as_str(), None, Some(50), path, out);
9524        path.pop();
9525        path.push_key("techInfo");
9526        if let Some(value) = &self.tech_info {
9527            validate::string(value.as_str(), None, Some(255), path, out);
9528        }
9529        path.pop();
9530        path.push_key("customData");
9531        if let Some(value) = &self.custom_data {
9532            Validate::validate_at(value, path, out);
9533        }
9534        path.pop();
9535    }
9536}
9537
9538impl Sealed for SecurityEventNotificationRequest {}
9539impl Request for SecurityEventNotificationRequest {
9540    type Action = Action;
9541    const ACTION: Action = Action::SecurityEventNotification;
9542    const KIND: MessageKind = MessageKind::Call;
9543    const ORIGIN: Origin = Origin::ChargingStation;
9544    type Response = SecurityEventNotificationResponse;
9545}
9546
9547impl Confirmed for SecurityEventNotificationRequest {}
9548
9549/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
9550#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
9551pub struct SecurityEventNotificationResponse {
9552    /// The `customData` member.
9553    #[serde(rename = "customData")]
9554    #[serde(default, skip_serializing_if = "Option::is_none")]
9555    pub custom_data: Option<crate::types::CustomData>,
9556}
9557
9558impl SecurityEventNotificationResponse {
9559    /// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
9560    #[must_use]
9561    pub fn new() -> Self {
9562        Self::default()
9563    }
9564
9565    /// Sets the optional `customData` field.
9566    #[must_use]
9567    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9568        self.custom_data = Some(value);
9569        self
9570    }
9571}
9572
9573impl Validate for SecurityEventNotificationResponse {
9574    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9575        path.push_key("customData");
9576        if let Some(value) = &self.custom_data {
9577            Validate::validate_at(value, path, out);
9578        }
9579        path.pop();
9580    }
9581}
9582
9583impl Sealed for SecurityEventNotificationResponse {}
9584impl Response for SecurityEventNotificationResponse {}
9585
9586/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
9587#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9588pub struct SendLocalListRequest {
9589    /// 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.
9590    #[serde(rename = "versionNumber")]
9591    pub version_number: i32,
9592    /// The `updateType` member.
9593    #[serde(rename = "updateType")]
9594    pub update_type: Update,
9595    /// The `localAuthorizationList` member.
9596    #[serde(rename = "localAuthorizationList")]
9597    #[serde(default, skip_serializing_if = "Option::is_none")]
9598    pub local_authorization_list: Option<Vec<AuthorizationData>>,
9599    /// The `customData` member.
9600    #[serde(rename = "customData")]
9601    #[serde(default, skip_serializing_if = "Option::is_none")]
9602    pub custom_data: Option<crate::types::CustomData>,
9603}
9604
9605impl SendLocalListRequest {
9606    /// Creates a `SendLocalListRequest` from its required fields.
9607    #[must_use]
9608    pub fn new(version_number: i32, update_type: Update) -> Self {
9609        Self {
9610            version_number,
9611            update_type,
9612            local_authorization_list: None,
9613            custom_data: None,
9614        }
9615    }
9616
9617    /// Sets the optional `localAuthorizationList` field.
9618    #[must_use]
9619    pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
9620        self.local_authorization_list = Some(value);
9621        self
9622    }
9623
9624    /// Sets the optional `customData` field.
9625    #[must_use]
9626    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9627        self.custom_data = Some(value);
9628        self
9629    }
9630}
9631
9632impl Validate for SendLocalListRequest {
9633    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9634        path.push_key("updateType");
9635        Validate::validate_at(&self.update_type, path, out);
9636        path.pop();
9637        path.push_key("localAuthorizationList");
9638        if let Some(value) = &self.local_authorization_list {
9639            validate::list_len(value.len(), Some(1), None, path, out);
9640            for (index, item) in value.iter().enumerate() {
9641                path.push_index(index);
9642                Validate::validate_at(item, path, out);
9643                path.pop();
9644            }
9645        }
9646        path.pop();
9647        path.push_key("customData");
9648        if let Some(value) = &self.custom_data {
9649            Validate::validate_at(value, path, out);
9650        }
9651        path.pop();
9652    }
9653}
9654
9655impl Sealed for SendLocalListRequest {}
9656impl Request for SendLocalListRequest {
9657    type Action = Action;
9658    const ACTION: Action = Action::SendLocalList;
9659    const KIND: MessageKind = MessageKind::Call;
9660    const ORIGIN: Origin = Origin::Csms;
9661    type Response = SendLocalListResponse;
9662}
9663
9664impl Confirmed for SendLocalListRequest {}
9665
9666/// Spec: OCPP 2.1 · D — Local Authorization List Management · CSMS → Charging Station · CALL.
9667#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9668pub struct SendLocalListResponse {
9669    /// The `status` member.
9670    pub status: SendLocalListStatus,
9671    /// The `statusInfo` member.
9672    #[serde(rename = "statusInfo")]
9673    #[serde(default, skip_serializing_if = "Option::is_none")]
9674    pub status_info: Option<StatusInfo>,
9675    /// The `customData` member.
9676    #[serde(rename = "customData")]
9677    #[serde(default, skip_serializing_if = "Option::is_none")]
9678    pub custom_data: Option<crate::types::CustomData>,
9679}
9680
9681impl SendLocalListResponse {
9682    /// Creates a `SendLocalListResponse` from its required fields.
9683    #[must_use]
9684    pub fn new(status: SendLocalListStatus) -> Self {
9685        Self {
9686            status,
9687            status_info: None,
9688            custom_data: None,
9689        }
9690    }
9691
9692    /// Sets the optional `statusInfo` field.
9693    #[must_use]
9694    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9695        self.status_info = Some(value);
9696        self
9697    }
9698
9699    /// Sets the optional `customData` field.
9700    #[must_use]
9701    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9702        self.custom_data = Some(value);
9703        self
9704    }
9705}
9706
9707impl Validate for SendLocalListResponse {
9708    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9709        path.push_key("status");
9710        Validate::validate_at(&self.status, path, out);
9711        path.pop();
9712        path.push_key("statusInfo");
9713        if let Some(value) = &self.status_info {
9714            Validate::validate_at(value, path, out);
9715        }
9716        path.pop();
9717        path.push_key("customData");
9718        if let Some(value) = &self.custom_data {
9719            Validate::validate_at(value, path, out);
9720        }
9721        path.pop();
9722    }
9723}
9724
9725impl Sealed for SendLocalListResponse {}
9726impl Response for SendLocalListResponse {}
9727
9728/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
9729#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9730pub struct SetChargingProfileRequest {
9731    /// 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.
9732    #[serde(rename = "evseId")]
9733    pub evse_id: i32,
9734    /// The `chargingProfile` member.
9735    #[serde(rename = "chargingProfile")]
9736    pub charging_profile: ChargingProfile,
9737    /// The `customData` member.
9738    #[serde(rename = "customData")]
9739    #[serde(default, skip_serializing_if = "Option::is_none")]
9740    pub custom_data: Option<crate::types::CustomData>,
9741}
9742
9743impl SetChargingProfileRequest {
9744    /// Creates a `SetChargingProfileRequest` from its required fields.
9745    #[must_use]
9746    pub fn new(evse_id: i32, charging_profile: ChargingProfile) -> Self {
9747        Self {
9748            evse_id,
9749            charging_profile,
9750            custom_data: None,
9751        }
9752    }
9753
9754    /// Sets the optional `customData` field.
9755    #[must_use]
9756    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9757        self.custom_data = Some(value);
9758        self
9759    }
9760}
9761
9762impl Validate for SetChargingProfileRequest {
9763    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9764        path.push_key("evseId");
9765        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
9766        path.pop();
9767        path.push_key("chargingProfile");
9768        Validate::validate_at(&self.charging_profile, path, out);
9769        path.pop();
9770        path.push_key("customData");
9771        if let Some(value) = &self.custom_data {
9772            Validate::validate_at(value, path, out);
9773        }
9774        path.pop();
9775    }
9776}
9777
9778impl Sealed for SetChargingProfileRequest {}
9779impl Request for SetChargingProfileRequest {
9780    type Action = Action;
9781    const ACTION: Action = Action::SetChargingProfile;
9782    const KIND: MessageKind = MessageKind::Call;
9783    const ORIGIN: Origin = Origin::Csms;
9784    type Response = SetChargingProfileResponse;
9785}
9786
9787impl Confirmed for SetChargingProfileRequest {}
9788
9789/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
9790#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9791pub struct SetChargingProfileResponse {
9792    /// The `status` member.
9793    pub status: ChargingProfileStatus,
9794    /// The `statusInfo` member.
9795    #[serde(rename = "statusInfo")]
9796    #[serde(default, skip_serializing_if = "Option::is_none")]
9797    pub status_info: Option<StatusInfo>,
9798    /// The `customData` member.
9799    #[serde(rename = "customData")]
9800    #[serde(default, skip_serializing_if = "Option::is_none")]
9801    pub custom_data: Option<crate::types::CustomData>,
9802}
9803
9804impl SetChargingProfileResponse {
9805    /// Creates a `SetChargingProfileResponse` from its required fields.
9806    #[must_use]
9807    pub fn new(status: ChargingProfileStatus) -> Self {
9808        Self {
9809            status,
9810            status_info: None,
9811            custom_data: None,
9812        }
9813    }
9814
9815    /// Sets the optional `statusInfo` field.
9816    #[must_use]
9817    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
9818        self.status_info = Some(value);
9819        self
9820    }
9821
9822    /// Sets the optional `customData` field.
9823    #[must_use]
9824    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9825        self.custom_data = Some(value);
9826        self
9827    }
9828}
9829
9830impl Validate for SetChargingProfileResponse {
9831    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9832        path.push_key("status");
9833        Validate::validate_at(&self.status, path, out);
9834        path.pop();
9835        path.push_key("statusInfo");
9836        if let Some(value) = &self.status_info {
9837            Validate::validate_at(value, path, out);
9838        }
9839        path.pop();
9840        path.push_key("customData");
9841        if let Some(value) = &self.custom_data {
9842            Validate::validate_at(value, path, out);
9843        }
9844        path.pop();
9845    }
9846}
9847
9848impl Sealed for SetChargingProfileResponse {}
9849impl Response for SetChargingProfileResponse {}
9850
9851/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
9852#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
9853pub struct SetDERControlRequest {
9854    /// True if this is a default DER control
9855    #[serde(rename = "isDefault")]
9856    pub is_default: bool,
9857    /// Unique id of this control, e.g. UUID
9858    #[serde(rename = "controlId")]
9859    pub control_id: String,
9860    /// The `controlType` member.
9861    #[serde(rename = "controlType")]
9862    pub control_type: DERControl,
9863    /// The `curve` member.
9864    #[serde(default, skip_serializing_if = "Option::is_none")]
9865    pub curve: Option<DERCurve>,
9866    /// The `enterService` member.
9867    #[serde(rename = "enterService")]
9868    #[serde(default, skip_serializing_if = "Option::is_none")]
9869    pub enter_service: Option<EnterService>,
9870    /// The `fixedPFAbsorb` member.
9871    #[serde(rename = "fixedPFAbsorb")]
9872    #[serde(default, skip_serializing_if = "Option::is_none")]
9873    pub fixed_pf_absorb: Option<FixedPF>,
9874    /// The `fixedPFInject` member.
9875    #[serde(rename = "fixedPFInject")]
9876    #[serde(default, skip_serializing_if = "Option::is_none")]
9877    pub fixed_pf_inject: Option<FixedPF>,
9878    /// The `fixedVar` member.
9879    #[serde(rename = "fixedVar")]
9880    #[serde(default, skip_serializing_if = "Option::is_none")]
9881    pub fixed_var: Option<FixedVar>,
9882    /// The `freqDroop` member.
9883    #[serde(rename = "freqDroop")]
9884    #[serde(default, skip_serializing_if = "Option::is_none")]
9885    pub freq_droop: Option<FreqDroop>,
9886    /// The `gradient` member.
9887    #[serde(default, skip_serializing_if = "Option::is_none")]
9888    pub gradient: Option<Gradient>,
9889    /// The `limitMaxDischarge` member.
9890    #[serde(rename = "limitMaxDischarge")]
9891    #[serde(default, skip_serializing_if = "Option::is_none")]
9892    pub limit_max_discharge: Option<LimitMaxDischarge>,
9893    /// The `customData` member.
9894    #[serde(rename = "customData")]
9895    #[serde(default, skip_serializing_if = "Option::is_none")]
9896    pub custom_data: Option<crate::types::CustomData>,
9897}
9898
9899impl SetDERControlRequest {
9900    /// Creates a `SetDERControlRequest` from its required fields.
9901    #[must_use]
9902    pub fn new(is_default: bool, control_id: impl Into<String>, control_type: DERControl) -> Self {
9903        Self {
9904            is_default,
9905            control_id: control_id.into(),
9906            control_type,
9907            curve: None,
9908            enter_service: None,
9909            fixed_pf_absorb: None,
9910            fixed_pf_inject: None,
9911            fixed_var: None,
9912            freq_droop: None,
9913            gradient: None,
9914            limit_max_discharge: None,
9915            custom_data: None,
9916        }
9917    }
9918
9919    /// Sets the optional `curve` field.
9920    #[must_use]
9921    pub fn with_curve(mut self, value: DERCurve) -> Self {
9922        self.curve = Some(value);
9923        self
9924    }
9925
9926    /// Sets the optional `enterService` field.
9927    #[must_use]
9928    pub fn with_enter_service(mut self, value: EnterService) -> Self {
9929        self.enter_service = Some(value);
9930        self
9931    }
9932
9933    /// Sets the optional `fixedPFAbsorb` field.
9934    #[must_use]
9935    pub fn with_fixed_pf_absorb(mut self, value: FixedPF) -> Self {
9936        self.fixed_pf_absorb = Some(value);
9937        self
9938    }
9939
9940    /// Sets the optional `fixedPFInject` field.
9941    #[must_use]
9942    pub fn with_fixed_pf_inject(mut self, value: FixedPF) -> Self {
9943        self.fixed_pf_inject = Some(value);
9944        self
9945    }
9946
9947    /// Sets the optional `fixedVar` field.
9948    #[must_use]
9949    pub fn with_fixed_var(mut self, value: FixedVar) -> Self {
9950        self.fixed_var = Some(value);
9951        self
9952    }
9953
9954    /// Sets the optional `freqDroop` field.
9955    #[must_use]
9956    pub fn with_freq_droop(mut self, value: FreqDroop) -> Self {
9957        self.freq_droop = Some(value);
9958        self
9959    }
9960
9961    /// Sets the optional `gradient` field.
9962    #[must_use]
9963    pub fn with_gradient(mut self, value: Gradient) -> Self {
9964        self.gradient = Some(value);
9965        self
9966    }
9967
9968    /// Sets the optional `limitMaxDischarge` field.
9969    #[must_use]
9970    pub fn with_limit_max_discharge(mut self, value: LimitMaxDischarge) -> Self {
9971        self.limit_max_discharge = Some(value);
9972        self
9973    }
9974
9975    /// Sets the optional `customData` field.
9976    #[must_use]
9977    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
9978        self.custom_data = Some(value);
9979        self
9980    }
9981}
9982
9983impl Validate for SetDERControlRequest {
9984    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
9985        path.push_key("controlId");
9986        validate::string(self.control_id.as_str(), None, Some(36), path, out);
9987        path.pop();
9988        path.push_key("controlType");
9989        Validate::validate_at(&self.control_type, path, out);
9990        path.pop();
9991        path.push_key("curve");
9992        if let Some(value) = &self.curve {
9993            Validate::validate_at(value, path, out);
9994        }
9995        path.pop();
9996        path.push_key("enterService");
9997        if let Some(value) = &self.enter_service {
9998            Validate::validate_at(value, path, out);
9999        }
10000        path.pop();
10001        path.push_key("fixedPFAbsorb");
10002        if let Some(value) = &self.fixed_pf_absorb {
10003            Validate::validate_at(value, path, out);
10004        }
10005        path.pop();
10006        path.push_key("fixedPFInject");
10007        if let Some(value) = &self.fixed_pf_inject {
10008            Validate::validate_at(value, path, out);
10009        }
10010        path.pop();
10011        path.push_key("fixedVar");
10012        if let Some(value) = &self.fixed_var {
10013            Validate::validate_at(value, path, out);
10014        }
10015        path.pop();
10016        path.push_key("freqDroop");
10017        if let Some(value) = &self.freq_droop {
10018            Validate::validate_at(value, path, out);
10019        }
10020        path.pop();
10021        path.push_key("gradient");
10022        if let Some(value) = &self.gradient {
10023            Validate::validate_at(value, path, out);
10024        }
10025        path.pop();
10026        path.push_key("limitMaxDischarge");
10027        if let Some(value) = &self.limit_max_discharge {
10028            Validate::validate_at(value, path, out);
10029        }
10030        path.pop();
10031        path.push_key("customData");
10032        if let Some(value) = &self.custom_data {
10033            Validate::validate_at(value, path, out);
10034        }
10035        path.pop();
10036    }
10037}
10038
10039impl Sealed for SetDERControlRequest {}
10040impl Request for SetDERControlRequest {
10041    type Action = Action;
10042    const ACTION: Action = Action::SetDERControl;
10043    const KIND: MessageKind = MessageKind::Call;
10044    const ORIGIN: Origin = Origin::Csms;
10045    type Response = SetDERControlResponse;
10046}
10047
10048impl Confirmed for SetDERControlRequest {}
10049
10050/// Spec: OCPP 2.1 · R — DER Control · CSMS → Charging Station · CALL.
10051#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10052pub struct SetDERControlResponse {
10053    /// The `status` member.
10054    pub status: DERControlStatus,
10055    /// The `statusInfo` member.
10056    #[serde(rename = "statusInfo")]
10057    #[serde(default, skip_serializing_if = "Option::is_none")]
10058    pub status_info: Option<StatusInfo>,
10059    /// List of controlIds that are superseded as a result of setting this control.
10060    #[serde(rename = "supersededIds")]
10061    #[serde(default, skip_serializing_if = "Option::is_none")]
10062    pub superseded_ids: Option<Vec<String>>,
10063    /// The `customData` member.
10064    #[serde(rename = "customData")]
10065    #[serde(default, skip_serializing_if = "Option::is_none")]
10066    pub custom_data: Option<crate::types::CustomData>,
10067}
10068
10069impl SetDERControlResponse {
10070    /// Creates a `SetDERControlResponse` from its required fields.
10071    #[must_use]
10072    pub fn new(status: DERControlStatus) -> Self {
10073        Self {
10074            status,
10075            status_info: None,
10076            superseded_ids: None,
10077            custom_data: None,
10078        }
10079    }
10080
10081    /// Sets the optional `statusInfo` field.
10082    #[must_use]
10083    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10084        self.status_info = Some(value);
10085        self
10086    }
10087
10088    /// Sets the optional `supersededIds` field.
10089    #[must_use]
10090    pub fn with_superseded_ids(
10091        mut self,
10092        value: impl IntoIterator<Item = impl Into<String>>,
10093    ) -> Self {
10094        self.superseded_ids = Some(value.into_iter().map(Into::into).collect());
10095        self
10096    }
10097
10098    /// Sets the optional `customData` field.
10099    #[must_use]
10100    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10101        self.custom_data = Some(value);
10102        self
10103    }
10104}
10105
10106impl Validate for SetDERControlResponse {
10107    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10108        path.push_key("status");
10109        Validate::validate_at(&self.status, path, out);
10110        path.pop();
10111        path.push_key("statusInfo");
10112        if let Some(value) = &self.status_info {
10113            Validate::validate_at(value, path, out);
10114        }
10115        path.pop();
10116        path.push_key("supersededIds");
10117        if let Some(value) = &self.superseded_ids {
10118            validate::list_len(value.len(), Some(1), Some(24), path, out);
10119            for (index, item) in value.iter().enumerate() {
10120                path.push_index(index);
10121                validate::string(item.as_str(), None, Some(36), path, out);
10122                path.pop();
10123            }
10124        }
10125        path.pop();
10126        path.push_key("customData");
10127        if let Some(value) = &self.custom_data {
10128            Validate::validate_at(value, path, out);
10129        }
10130        path.pop();
10131    }
10132}
10133
10134impl Sealed for SetDERControlResponse {}
10135impl Response for SetDERControlResponse {}
10136
10137/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
10138#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10139pub struct SetDefaultTariffRequest {
10140    /// EVSE that tariff applies to. When _evseId_ = 0, then tarriff applies to all EVSEs.
10141    #[serde(rename = "evseId")]
10142    pub evse_id: i32,
10143    /// The `tariff` member.
10144    pub tariff: Tariff,
10145    /// The `customData` member.
10146    #[serde(rename = "customData")]
10147    #[serde(default, skip_serializing_if = "Option::is_none")]
10148    pub custom_data: Option<crate::types::CustomData>,
10149}
10150
10151impl SetDefaultTariffRequest {
10152    /// Creates a `SetDefaultTariffRequest` from its required fields.
10153    #[must_use]
10154    pub fn new(evse_id: i32, tariff: Tariff) -> Self {
10155        Self {
10156            evse_id,
10157            tariff,
10158            custom_data: None,
10159        }
10160    }
10161
10162    /// Sets the optional `customData` field.
10163    #[must_use]
10164    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10165        self.custom_data = Some(value);
10166        self
10167    }
10168}
10169
10170impl Validate for SetDefaultTariffRequest {
10171    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10172        path.push_key("evseId");
10173        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
10174        path.pop();
10175        path.push_key("tariff");
10176        Validate::validate_at(&self.tariff, path, out);
10177        path.pop();
10178        path.push_key("customData");
10179        if let Some(value) = &self.custom_data {
10180            Validate::validate_at(value, path, out);
10181        }
10182        path.pop();
10183    }
10184}
10185
10186impl Sealed for SetDefaultTariffRequest {}
10187impl Request for SetDefaultTariffRequest {
10188    type Action = Action;
10189    const ACTION: Action = Action::SetDefaultTariff;
10190    const KIND: MessageKind = MessageKind::Call;
10191    const ORIGIN: Origin = Origin::Csms;
10192    type Response = SetDefaultTariffResponse;
10193}
10194
10195impl Confirmed for SetDefaultTariffRequest {}
10196
10197/// Spec: OCPP 2.1 · I — Tariff and Cost · CSMS → Charging Station · CALL.
10198#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10199pub struct SetDefaultTariffResponse {
10200    /// The `status` member.
10201    pub status: TariffSetStatus,
10202    /// The `statusInfo` member.
10203    #[serde(rename = "statusInfo")]
10204    #[serde(default, skip_serializing_if = "Option::is_none")]
10205    pub status_info: Option<StatusInfo>,
10206    /// The `customData` member.
10207    #[serde(rename = "customData")]
10208    #[serde(default, skip_serializing_if = "Option::is_none")]
10209    pub custom_data: Option<crate::types::CustomData>,
10210}
10211
10212impl SetDefaultTariffResponse {
10213    /// Creates a `SetDefaultTariffResponse` from its required fields.
10214    #[must_use]
10215    pub fn new(status: TariffSetStatus) -> Self {
10216        Self {
10217            status,
10218            status_info: None,
10219            custom_data: None,
10220        }
10221    }
10222
10223    /// Sets the optional `statusInfo` field.
10224    #[must_use]
10225    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10226        self.status_info = Some(value);
10227        self
10228    }
10229
10230    /// Sets the optional `customData` field.
10231    #[must_use]
10232    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10233        self.custom_data = Some(value);
10234        self
10235    }
10236}
10237
10238impl Validate for SetDefaultTariffResponse {
10239    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10240        path.push_key("status");
10241        Validate::validate_at(&self.status, path, out);
10242        path.pop();
10243        path.push_key("statusInfo");
10244        if let Some(value) = &self.status_info {
10245            Validate::validate_at(value, path, out);
10246        }
10247        path.pop();
10248        path.push_key("customData");
10249        if let Some(value) = &self.custom_data {
10250            Validate::validate_at(value, path, out);
10251        }
10252        path.pop();
10253    }
10254}
10255
10256impl Sealed for SetDefaultTariffResponse {}
10257impl Response for SetDefaultTariffResponse {}
10258
10259/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
10260#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10261pub struct SetDisplayMessageRequest {
10262    /// The `message` member.
10263    pub message: MessageInfo,
10264    /// The `customData` member.
10265    #[serde(rename = "customData")]
10266    #[serde(default, skip_serializing_if = "Option::is_none")]
10267    pub custom_data: Option<crate::types::CustomData>,
10268}
10269
10270impl SetDisplayMessageRequest {
10271    /// Creates a `SetDisplayMessageRequest` from its required fields.
10272    #[must_use]
10273    pub fn new(message: MessageInfo) -> Self {
10274        Self {
10275            message,
10276            custom_data: None,
10277        }
10278    }
10279
10280    /// Sets the optional `customData` field.
10281    #[must_use]
10282    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10283        self.custom_data = Some(value);
10284        self
10285    }
10286}
10287
10288impl Validate for SetDisplayMessageRequest {
10289    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10290        path.push_key("message");
10291        Validate::validate_at(&self.message, path, out);
10292        path.pop();
10293        path.push_key("customData");
10294        if let Some(value) = &self.custom_data {
10295            Validate::validate_at(value, path, out);
10296        }
10297        path.pop();
10298    }
10299}
10300
10301impl Sealed for SetDisplayMessageRequest {}
10302impl Request for SetDisplayMessageRequest {
10303    type Action = Action;
10304    const ACTION: Action = Action::SetDisplayMessage;
10305    const KIND: MessageKind = MessageKind::Call;
10306    const ORIGIN: Origin = Origin::Csms;
10307    type Response = SetDisplayMessageResponse;
10308}
10309
10310impl Confirmed for SetDisplayMessageRequest {}
10311
10312/// Spec: OCPP 2.1 · O — Display Message · CSMS → Charging Station · CALL.
10313#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10314pub struct SetDisplayMessageResponse {
10315    /// The `status` member.
10316    pub status: DisplayMessageStatus,
10317    /// The `statusInfo` member.
10318    #[serde(rename = "statusInfo")]
10319    #[serde(default, skip_serializing_if = "Option::is_none")]
10320    pub status_info: Option<StatusInfo>,
10321    /// The `customData` member.
10322    #[serde(rename = "customData")]
10323    #[serde(default, skip_serializing_if = "Option::is_none")]
10324    pub custom_data: Option<crate::types::CustomData>,
10325}
10326
10327impl SetDisplayMessageResponse {
10328    /// Creates a `SetDisplayMessageResponse` from its required fields.
10329    #[must_use]
10330    pub fn new(status: DisplayMessageStatus) -> Self {
10331        Self {
10332            status,
10333            status_info: None,
10334            custom_data: None,
10335        }
10336    }
10337
10338    /// Sets the optional `statusInfo` field.
10339    #[must_use]
10340    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10341        self.status_info = Some(value);
10342        self
10343    }
10344
10345    /// Sets the optional `customData` field.
10346    #[must_use]
10347    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10348        self.custom_data = Some(value);
10349        self
10350    }
10351}
10352
10353impl Validate for SetDisplayMessageResponse {
10354    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10355        path.push_key("status");
10356        Validate::validate_at(&self.status, path, out);
10357        path.pop();
10358        path.push_key("statusInfo");
10359        if let Some(value) = &self.status_info {
10360            Validate::validate_at(value, path, out);
10361        }
10362        path.pop();
10363        path.push_key("customData");
10364        if let Some(value) = &self.custom_data {
10365            Validate::validate_at(value, path, out);
10366        }
10367        path.pop();
10368    }
10369}
10370
10371impl Sealed for SetDisplayMessageResponse {}
10372impl Response for SetDisplayMessageResponse {}
10373
10374/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10375#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10376pub struct SetMonitoringBaseRequest {
10377    /// The `monitoringBase` member.
10378    #[serde(rename = "monitoringBase")]
10379    pub monitoring_base: MonitoringBase,
10380    /// The `customData` member.
10381    #[serde(rename = "customData")]
10382    #[serde(default, skip_serializing_if = "Option::is_none")]
10383    pub custom_data: Option<crate::types::CustomData>,
10384}
10385
10386impl SetMonitoringBaseRequest {
10387    /// Creates a `SetMonitoringBaseRequest` from its required fields.
10388    #[must_use]
10389    pub fn new(monitoring_base: MonitoringBase) -> Self {
10390        Self {
10391            monitoring_base,
10392            custom_data: None,
10393        }
10394    }
10395
10396    /// Sets the optional `customData` field.
10397    #[must_use]
10398    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10399        self.custom_data = Some(value);
10400        self
10401    }
10402}
10403
10404impl Validate for SetMonitoringBaseRequest {
10405    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10406        path.push_key("monitoringBase");
10407        Validate::validate_at(&self.monitoring_base, path, out);
10408        path.pop();
10409        path.push_key("customData");
10410        if let Some(value) = &self.custom_data {
10411            Validate::validate_at(value, path, out);
10412        }
10413        path.pop();
10414    }
10415}
10416
10417impl Sealed for SetMonitoringBaseRequest {}
10418impl Request for SetMonitoringBaseRequest {
10419    type Action = Action;
10420    const ACTION: Action = Action::SetMonitoringBase;
10421    const KIND: MessageKind = MessageKind::Call;
10422    const ORIGIN: Origin = Origin::Csms;
10423    type Response = SetMonitoringBaseResponse;
10424}
10425
10426impl Confirmed for SetMonitoringBaseRequest {}
10427
10428/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10429#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10430pub struct SetMonitoringBaseResponse {
10431    /// The `status` member.
10432    pub status: GenericDeviceModelStatus,
10433    /// The `statusInfo` member.
10434    #[serde(rename = "statusInfo")]
10435    #[serde(default, skip_serializing_if = "Option::is_none")]
10436    pub status_info: Option<StatusInfo>,
10437    /// The `customData` member.
10438    #[serde(rename = "customData")]
10439    #[serde(default, skip_serializing_if = "Option::is_none")]
10440    pub custom_data: Option<crate::types::CustomData>,
10441}
10442
10443impl SetMonitoringBaseResponse {
10444    /// Creates a `SetMonitoringBaseResponse` from its required fields.
10445    #[must_use]
10446    pub fn new(status: GenericDeviceModelStatus) -> Self {
10447        Self {
10448            status,
10449            status_info: None,
10450            custom_data: None,
10451        }
10452    }
10453
10454    /// Sets the optional `statusInfo` field.
10455    #[must_use]
10456    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10457        self.status_info = Some(value);
10458        self
10459    }
10460
10461    /// Sets the optional `customData` field.
10462    #[must_use]
10463    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10464        self.custom_data = Some(value);
10465        self
10466    }
10467}
10468
10469impl Validate for SetMonitoringBaseResponse {
10470    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10471        path.push_key("status");
10472        Validate::validate_at(&self.status, path, out);
10473        path.pop();
10474        path.push_key("statusInfo");
10475        if let Some(value) = &self.status_info {
10476            Validate::validate_at(value, path, out);
10477        }
10478        path.pop();
10479        path.push_key("customData");
10480        if let Some(value) = &self.custom_data {
10481            Validate::validate_at(value, path, out);
10482        }
10483        path.pop();
10484    }
10485}
10486
10487impl Sealed for SetMonitoringBaseResponse {}
10488impl Response for SetMonitoringBaseResponse {}
10489
10490/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10491#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10492pub struct SetMonitoringLevelRequest {
10493    /// The Charging Station SHALL only report events with a severity number lower than or equal to this severity.
10494    /// The severity range is 0-9, with 0 as the highest and 9 as the lowest severity level.
10495    ///
10496    /// The severity levels have the following meaning: +
10497    /// *0-Danger* +
10498    /// Indicates lives are potentially in danger. Urgent attention is needed and action should be taken immediately. +
10499    /// *1-Hardware Failure* +
10500    /// Indicates that the Charging Station is unable to continue regular operations due to Hardware issues. Action is required. +
10501    /// *2-System Failure* +
10502    /// Indicates that the Charging Station is unable to continue regular operations due to software or minor hardware issues. Action is required. +
10503    /// *3-Critical* +
10504    /// Indicates a critical error. Action is required. +
10505    /// *4-Error* +
10506    /// Indicates a non-urgent error. Action is required. +
10507    /// *5-Alert* +
10508    /// Indicates an alert event. Default severity for any type of monitoring event.  +
10509    /// *6-Warning* +
10510    /// Indicates a warning event. Action may be required. +
10511    /// *7-Notice* +
10512    /// Indicates an unusual event. No immediate action is required. +
10513    /// *8-Informational* +
10514    /// Indicates a regular operational event. May be used for reporting, measuring throughput, etc. No action is required. +
10515    /// *9-Debug* +
10516    /// Indicates information useful to developers for debugging, not useful during operations.
10517    pub severity: i32,
10518    /// The `customData` member.
10519    #[serde(rename = "customData")]
10520    #[serde(default, skip_serializing_if = "Option::is_none")]
10521    pub custom_data: Option<crate::types::CustomData>,
10522}
10523
10524impl SetMonitoringLevelRequest {
10525    /// Creates a `SetMonitoringLevelRequest` from its required fields.
10526    #[must_use]
10527    pub fn new(severity: i32) -> Self {
10528        Self {
10529            severity,
10530            custom_data: None,
10531        }
10532    }
10533
10534    /// Sets the optional `customData` field.
10535    #[must_use]
10536    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10537        self.custom_data = Some(value);
10538        self
10539    }
10540}
10541
10542impl Validate for SetMonitoringLevelRequest {
10543    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10544        path.push_key("severity");
10545        validate::int_range(i64::from(self.severity), Some(0.0), None, path, out);
10546        path.pop();
10547        path.push_key("customData");
10548        if let Some(value) = &self.custom_data {
10549            Validate::validate_at(value, path, out);
10550        }
10551        path.pop();
10552    }
10553}
10554
10555impl Sealed for SetMonitoringLevelRequest {}
10556impl Request for SetMonitoringLevelRequest {
10557    type Action = Action;
10558    const ACTION: Action = Action::SetMonitoringLevel;
10559    const KIND: MessageKind = MessageKind::Call;
10560    const ORIGIN: Origin = Origin::Csms;
10561    type Response = SetMonitoringLevelResponse;
10562}
10563
10564impl Confirmed for SetMonitoringLevelRequest {}
10565
10566/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10567#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10568pub struct SetMonitoringLevelResponse {
10569    /// The `status` member.
10570    pub status: GenericStatus,
10571    /// The `statusInfo` member.
10572    #[serde(rename = "statusInfo")]
10573    #[serde(default, skip_serializing_if = "Option::is_none")]
10574    pub status_info: Option<StatusInfo>,
10575    /// The `customData` member.
10576    #[serde(rename = "customData")]
10577    #[serde(default, skip_serializing_if = "Option::is_none")]
10578    pub custom_data: Option<crate::types::CustomData>,
10579}
10580
10581impl SetMonitoringLevelResponse {
10582    /// Creates a `SetMonitoringLevelResponse` from its required fields.
10583    #[must_use]
10584    pub fn new(status: GenericStatus) -> Self {
10585        Self {
10586            status,
10587            status_info: None,
10588            custom_data: None,
10589        }
10590    }
10591
10592    /// Sets the optional `statusInfo` field.
10593    #[must_use]
10594    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10595        self.status_info = Some(value);
10596        self
10597    }
10598
10599    /// Sets the optional `customData` field.
10600    #[must_use]
10601    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10602        self.custom_data = Some(value);
10603        self
10604    }
10605}
10606
10607impl Validate for SetMonitoringLevelResponse {
10608    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10609        path.push_key("status");
10610        Validate::validate_at(&self.status, path, out);
10611        path.pop();
10612        path.push_key("statusInfo");
10613        if let Some(value) = &self.status_info {
10614            Validate::validate_at(value, path, out);
10615        }
10616        path.pop();
10617        path.push_key("customData");
10618        if let Some(value) = &self.custom_data {
10619            Validate::validate_at(value, path, out);
10620        }
10621        path.pop();
10622    }
10623}
10624
10625impl Sealed for SetMonitoringLevelResponse {}
10626impl Response for SetMonitoringLevelResponse {}
10627
10628/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10629#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10630pub struct SetNetworkProfileRequest {
10631    /// Slot in which the configuration should be stored.
10632    #[serde(rename = "configurationSlot")]
10633    pub configuration_slot: i32,
10634    /// The `connectionData` member.
10635    #[serde(rename = "connectionData")]
10636    pub connection_data: NetworkConnectionProfile,
10637    /// The `customData` member.
10638    #[serde(rename = "customData")]
10639    #[serde(default, skip_serializing_if = "Option::is_none")]
10640    pub custom_data: Option<crate::types::CustomData>,
10641}
10642
10643impl SetNetworkProfileRequest {
10644    /// Creates a `SetNetworkProfileRequest` from its required fields.
10645    #[must_use]
10646    pub fn new(configuration_slot: i32, connection_data: NetworkConnectionProfile) -> Self {
10647        Self {
10648            configuration_slot,
10649            connection_data,
10650            custom_data: None,
10651        }
10652    }
10653
10654    /// Sets the optional `customData` field.
10655    #[must_use]
10656    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10657        self.custom_data = Some(value);
10658        self
10659    }
10660}
10661
10662impl Validate for SetNetworkProfileRequest {
10663    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10664        path.push_key("connectionData");
10665        Validate::validate_at(&self.connection_data, path, out);
10666        path.pop();
10667        path.push_key("customData");
10668        if let Some(value) = &self.custom_data {
10669            Validate::validate_at(value, path, out);
10670        }
10671        path.pop();
10672    }
10673}
10674
10675impl Sealed for SetNetworkProfileRequest {}
10676impl Request for SetNetworkProfileRequest {
10677    type Action = Action;
10678    const ACTION: Action = Action::SetNetworkProfile;
10679    const KIND: MessageKind = MessageKind::Call;
10680    const ORIGIN: Origin = Origin::Csms;
10681    type Response = SetNetworkProfileResponse;
10682}
10683
10684impl Confirmed for SetNetworkProfileRequest {}
10685
10686/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10687#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10688pub struct SetNetworkProfileResponse {
10689    /// The `status` member.
10690    pub status: SetNetworkProfileStatus,
10691    /// The `statusInfo` member.
10692    #[serde(rename = "statusInfo")]
10693    #[serde(default, skip_serializing_if = "Option::is_none")]
10694    pub status_info: Option<StatusInfo>,
10695    /// The `customData` member.
10696    #[serde(rename = "customData")]
10697    #[serde(default, skip_serializing_if = "Option::is_none")]
10698    pub custom_data: Option<crate::types::CustomData>,
10699}
10700
10701impl SetNetworkProfileResponse {
10702    /// Creates a `SetNetworkProfileResponse` from its required fields.
10703    #[must_use]
10704    pub fn new(status: SetNetworkProfileStatus) -> Self {
10705        Self {
10706            status,
10707            status_info: None,
10708            custom_data: None,
10709        }
10710    }
10711
10712    /// Sets the optional `statusInfo` field.
10713    #[must_use]
10714    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
10715        self.status_info = Some(value);
10716        self
10717    }
10718
10719    /// Sets the optional `customData` field.
10720    #[must_use]
10721    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10722        self.custom_data = Some(value);
10723        self
10724    }
10725}
10726
10727impl Validate for SetNetworkProfileResponse {
10728    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10729        path.push_key("status");
10730        Validate::validate_at(&self.status, path, out);
10731        path.pop();
10732        path.push_key("statusInfo");
10733        if let Some(value) = &self.status_info {
10734            Validate::validate_at(value, path, out);
10735        }
10736        path.pop();
10737        path.push_key("customData");
10738        if let Some(value) = &self.custom_data {
10739            Validate::validate_at(value, path, out);
10740        }
10741        path.pop();
10742    }
10743}
10744
10745impl Sealed for SetNetworkProfileResponse {}
10746impl Response for SetNetworkProfileResponse {}
10747
10748/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10749#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10750pub struct SetVariableMonitoringRequest {
10751    /// The `setMonitoringData` member.
10752    #[serde(rename = "setMonitoringData")]
10753    pub set_monitoring_data: Vec<SetMonitoringData>,
10754    /// The `customData` member.
10755    #[serde(rename = "customData")]
10756    #[serde(default, skip_serializing_if = "Option::is_none")]
10757    pub custom_data: Option<crate::types::CustomData>,
10758}
10759
10760impl SetVariableMonitoringRequest {
10761    /// Creates a `SetVariableMonitoringRequest` from its required fields.
10762    #[must_use]
10763    pub fn new(set_monitoring_data: Vec<SetMonitoringData>) -> Self {
10764        Self {
10765            set_monitoring_data,
10766            custom_data: None,
10767        }
10768    }
10769
10770    /// Sets the optional `customData` field.
10771    #[must_use]
10772    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10773        self.custom_data = Some(value);
10774        self
10775    }
10776}
10777
10778impl Validate for SetVariableMonitoringRequest {
10779    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10780        path.push_key("setMonitoringData");
10781        validate::list_len(self.set_monitoring_data.len(), Some(1), None, path, out);
10782        for (index, item) in self.set_monitoring_data.iter().enumerate() {
10783            path.push_index(index);
10784            Validate::validate_at(item, path, out);
10785            path.pop();
10786        }
10787        path.pop();
10788        path.push_key("customData");
10789        if let Some(value) = &self.custom_data {
10790            Validate::validate_at(value, path, out);
10791        }
10792        path.pop();
10793    }
10794}
10795
10796impl Sealed for SetVariableMonitoringRequest {}
10797impl Request for SetVariableMonitoringRequest {
10798    type Action = Action;
10799    const ACTION: Action = Action::SetVariableMonitoring;
10800    const KIND: MessageKind = MessageKind::Call;
10801    const ORIGIN: Origin = Origin::Csms;
10802    type Response = SetVariableMonitoringResponse;
10803}
10804
10805impl Confirmed for SetVariableMonitoringRequest {}
10806
10807/// Spec: OCPP 2.1 · N — Diagnostics · CSMS → Charging Station · CALL.
10808#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10809pub struct SetVariableMonitoringResponse {
10810    /// The `setMonitoringResult` member.
10811    #[serde(rename = "setMonitoringResult")]
10812    pub set_monitoring_result: Vec<SetMonitoringResult>,
10813    /// The `customData` member.
10814    #[serde(rename = "customData")]
10815    #[serde(default, skip_serializing_if = "Option::is_none")]
10816    pub custom_data: Option<crate::types::CustomData>,
10817}
10818
10819impl SetVariableMonitoringResponse {
10820    /// Creates a `SetVariableMonitoringResponse` from its required fields.
10821    #[must_use]
10822    pub fn new(set_monitoring_result: Vec<SetMonitoringResult>) -> Self {
10823        Self {
10824            set_monitoring_result,
10825            custom_data: None,
10826        }
10827    }
10828
10829    /// Sets the optional `customData` field.
10830    #[must_use]
10831    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10832        self.custom_data = Some(value);
10833        self
10834    }
10835}
10836
10837impl Validate for SetVariableMonitoringResponse {
10838    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10839        path.push_key("setMonitoringResult");
10840        validate::list_len(self.set_monitoring_result.len(), Some(1), None, path, out);
10841        for (index, item) in self.set_monitoring_result.iter().enumerate() {
10842            path.push_index(index);
10843            Validate::validate_at(item, path, out);
10844            path.pop();
10845        }
10846        path.pop();
10847        path.push_key("customData");
10848        if let Some(value) = &self.custom_data {
10849            Validate::validate_at(value, path, out);
10850        }
10851        path.pop();
10852    }
10853}
10854
10855impl Sealed for SetVariableMonitoringResponse {}
10856impl Response for SetVariableMonitoringResponse {}
10857
10858/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10859#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10860pub struct SetVariablesRequest {
10861    /// The `setVariableData` member.
10862    #[serde(rename = "setVariableData")]
10863    pub set_variable_data: Vec<SetVariableData>,
10864    /// The `customData` member.
10865    #[serde(rename = "customData")]
10866    #[serde(default, skip_serializing_if = "Option::is_none")]
10867    pub custom_data: Option<crate::types::CustomData>,
10868}
10869
10870impl SetVariablesRequest {
10871    /// Creates a `SetVariablesRequest` from its required fields.
10872    #[must_use]
10873    pub fn new(set_variable_data: Vec<SetVariableData>) -> Self {
10874        Self {
10875            set_variable_data,
10876            custom_data: None,
10877        }
10878    }
10879
10880    /// Sets the optional `customData` field.
10881    #[must_use]
10882    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10883        self.custom_data = Some(value);
10884        self
10885    }
10886}
10887
10888impl Validate for SetVariablesRequest {
10889    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10890        path.push_key("setVariableData");
10891        validate::list_len(self.set_variable_data.len(), Some(1), None, path, out);
10892        for (index, item) in self.set_variable_data.iter().enumerate() {
10893            path.push_index(index);
10894            Validate::validate_at(item, path, out);
10895            path.pop();
10896        }
10897        path.pop();
10898        path.push_key("customData");
10899        if let Some(value) = &self.custom_data {
10900            Validate::validate_at(value, path, out);
10901        }
10902        path.pop();
10903    }
10904}
10905
10906impl Sealed for SetVariablesRequest {}
10907impl Request for SetVariablesRequest {
10908    type Action = Action;
10909    const ACTION: Action = Action::SetVariables;
10910    const KIND: MessageKind = MessageKind::Call;
10911    const ORIGIN: Origin = Origin::Csms;
10912    type Response = SetVariablesResponse;
10913}
10914
10915impl Confirmed for SetVariablesRequest {}
10916
10917/// Spec: OCPP 2.1 · B — Provisioning · CSMS → Charging Station · CALL.
10918#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10919pub struct SetVariablesResponse {
10920    /// The `setVariableResult` member.
10921    #[serde(rename = "setVariableResult")]
10922    pub set_variable_result: Vec<SetVariableResult>,
10923    /// The `customData` member.
10924    #[serde(rename = "customData")]
10925    #[serde(default, skip_serializing_if = "Option::is_none")]
10926    pub custom_data: Option<crate::types::CustomData>,
10927}
10928
10929impl SetVariablesResponse {
10930    /// Creates a `SetVariablesResponse` from its required fields.
10931    #[must_use]
10932    pub fn new(set_variable_result: Vec<SetVariableResult>) -> Self {
10933        Self {
10934            set_variable_result,
10935            custom_data: None,
10936        }
10937    }
10938
10939    /// Sets the optional `customData` field.
10940    #[must_use]
10941    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
10942        self.custom_data = Some(value);
10943        self
10944    }
10945}
10946
10947impl Validate for SetVariablesResponse {
10948    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
10949        path.push_key("setVariableResult");
10950        validate::list_len(self.set_variable_result.len(), Some(1), None, path, out);
10951        for (index, item) in self.set_variable_result.iter().enumerate() {
10952            path.push_index(index);
10953            Validate::validate_at(item, path, out);
10954            path.pop();
10955        }
10956        path.pop();
10957        path.push_key("customData");
10958        if let Some(value) = &self.custom_data {
10959            Validate::validate_at(value, path, out);
10960        }
10961        path.pop();
10962    }
10963}
10964
10965impl Sealed for SetVariablesResponse {}
10966impl Response for SetVariablesResponse {}
10967
10968/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
10969#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
10970pub struct SignCertificateRequest {
10971    /// 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.
10972    pub csr: String,
10973    /// The `certificateType` member.
10974    #[serde(rename = "certificateType")]
10975    #[serde(default, skip_serializing_if = "Option::is_none")]
10976    pub certificate_type: Option<CertificateSigningUse>,
10977    /// The `hashRootCertificate` member.
10978    #[serde(rename = "hashRootCertificate")]
10979    #[serde(default, skip_serializing_if = "Option::is_none")]
10980    pub hash_root_certificate: Option<CertificateHashData>,
10981    /// *(2.1)* RequestId to match this message with the CertificateSignedRequest.
10982    #[serde(rename = "requestId")]
10983    #[serde(default, skip_serializing_if = "Option::is_none")]
10984    pub request_id: Option<i32>,
10985    /// The `customData` member.
10986    #[serde(rename = "customData")]
10987    #[serde(default, skip_serializing_if = "Option::is_none")]
10988    pub custom_data: Option<crate::types::CustomData>,
10989}
10990
10991impl SignCertificateRequest {
10992    /// Creates a `SignCertificateRequest` from its required fields.
10993    #[must_use]
10994    pub fn new(csr: impl Into<String>) -> Self {
10995        Self {
10996            csr: csr.into(),
10997            certificate_type: None,
10998            hash_root_certificate: None,
10999            request_id: None,
11000            custom_data: None,
11001        }
11002    }
11003
11004    /// Sets the optional `certificateType` field.
11005    #[must_use]
11006    pub fn with_certificate_type(mut self, value: CertificateSigningUse) -> Self {
11007        self.certificate_type = Some(value);
11008        self
11009    }
11010
11011    /// Sets the optional `hashRootCertificate` field.
11012    #[must_use]
11013    pub fn with_hash_root_certificate(mut self, value: CertificateHashData) -> Self {
11014        self.hash_root_certificate = Some(value);
11015        self
11016    }
11017
11018    /// Sets the optional `requestId` field.
11019    #[must_use]
11020    pub fn with_request_id(mut self, value: i32) -> Self {
11021        self.request_id = Some(value);
11022        self
11023    }
11024
11025    /// Sets the optional `customData` field.
11026    #[must_use]
11027    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11028        self.custom_data = Some(value);
11029        self
11030    }
11031}
11032
11033impl Validate for SignCertificateRequest {
11034    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11035        path.push_key("csr");
11036        validate::string(self.csr.as_str(), None, Some(5500), path, out);
11037        path.pop();
11038        path.push_key("certificateType");
11039        if let Some(value) = &self.certificate_type {
11040            Validate::validate_at(value, path, out);
11041        }
11042        path.pop();
11043        path.push_key("hashRootCertificate");
11044        if let Some(value) = &self.hash_root_certificate {
11045            Validate::validate_at(value, path, out);
11046        }
11047        path.pop();
11048        path.push_key("customData");
11049        if let Some(value) = &self.custom_data {
11050            Validate::validate_at(value, path, out);
11051        }
11052        path.pop();
11053    }
11054}
11055
11056impl Sealed for SignCertificateRequest {}
11057impl Request for SignCertificateRequest {
11058    type Action = Action;
11059    const ACTION: Action = Action::SignCertificate;
11060    const KIND: MessageKind = MessageKind::Call;
11061    const ORIGIN: Origin = Origin::ChargingStation;
11062    type Response = SignCertificateResponse;
11063}
11064
11065impl Confirmed for SignCertificateRequest {}
11066
11067/// Spec: OCPP 2.1 · A — Security · Charging Station → CSMS · CALL.
11068#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11069pub struct SignCertificateResponse {
11070    /// The `status` member.
11071    pub status: GenericStatus,
11072    /// The `statusInfo` member.
11073    #[serde(rename = "statusInfo")]
11074    #[serde(default, skip_serializing_if = "Option::is_none")]
11075    pub status_info: Option<StatusInfo>,
11076    /// The `customData` member.
11077    #[serde(rename = "customData")]
11078    #[serde(default, skip_serializing_if = "Option::is_none")]
11079    pub custom_data: Option<crate::types::CustomData>,
11080}
11081
11082impl SignCertificateResponse {
11083    /// Creates a `SignCertificateResponse` from its required fields.
11084    #[must_use]
11085    pub fn new(status: GenericStatus) -> Self {
11086        Self {
11087            status,
11088            status_info: None,
11089            custom_data: None,
11090        }
11091    }
11092
11093    /// Sets the optional `statusInfo` field.
11094    #[must_use]
11095    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11096        self.status_info = Some(value);
11097        self
11098    }
11099
11100    /// Sets the optional `customData` field.
11101    #[must_use]
11102    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11103        self.custom_data = Some(value);
11104        self
11105    }
11106}
11107
11108impl Validate for SignCertificateResponse {
11109    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11110        path.push_key("status");
11111        Validate::validate_at(&self.status, path, out);
11112        path.pop();
11113        path.push_key("statusInfo");
11114        if let Some(value) = &self.status_info {
11115            Validate::validate_at(value, path, out);
11116        }
11117        path.pop();
11118        path.push_key("customData");
11119        if let Some(value) = &self.custom_data {
11120            Validate::validate_at(value, path, out);
11121        }
11122        path.pop();
11123    }
11124}
11125
11126impl Sealed for SignCertificateResponse {}
11127impl Response for SignCertificateResponse {}
11128
11129/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
11130#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11131pub struct StatusNotificationRequest {
11132    /// The time for which the status is reported.
11133    pub timestamp: crate::types::DateTime,
11134    /// The `connectorStatus` member.
11135    #[serde(rename = "connectorStatus")]
11136    pub connector_status: ConnectorStatus,
11137    /// The id of the EVSE to which the connector belongs for which the the status is reported.
11138    #[serde(rename = "evseId")]
11139    pub evse_id: i32,
11140    /// The id of the connector within the EVSE for which the status is reported.
11141    #[serde(rename = "connectorId")]
11142    pub connector_id: i32,
11143    /// The `customData` member.
11144    #[serde(rename = "customData")]
11145    #[serde(default, skip_serializing_if = "Option::is_none")]
11146    pub custom_data: Option<crate::types::CustomData>,
11147}
11148
11149impl StatusNotificationRequest {
11150    /// Creates a `StatusNotificationRequest` from its required fields.
11151    #[must_use]
11152    pub fn new(
11153        timestamp: impl Into<crate::types::DateTime>,
11154        connector_status: ConnectorStatus,
11155        evse_id: i32,
11156        connector_id: i32,
11157    ) -> Self {
11158        Self {
11159            timestamp: timestamp.into(),
11160            connector_status,
11161            evse_id,
11162            connector_id,
11163            custom_data: None,
11164        }
11165    }
11166
11167    /// Sets the optional `customData` field.
11168    #[must_use]
11169    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11170        self.custom_data = Some(value);
11171        self
11172    }
11173}
11174
11175impl Validate for StatusNotificationRequest {
11176    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11177        path.push_key("connectorStatus");
11178        Validate::validate_at(&self.connector_status, path, out);
11179        path.pop();
11180        path.push_key("evseId");
11181        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
11182        path.pop();
11183        path.push_key("connectorId");
11184        validate::int_range(i64::from(self.connector_id), Some(0.0), None, path, out);
11185        path.pop();
11186        path.push_key("customData");
11187        if let Some(value) = &self.custom_data {
11188            Validate::validate_at(value, path, out);
11189        }
11190        path.pop();
11191    }
11192}
11193
11194impl Sealed for StatusNotificationRequest {}
11195impl Request for StatusNotificationRequest {
11196    type Action = Action;
11197    const ACTION: Action = Action::StatusNotification;
11198    const KIND: MessageKind = MessageKind::Call;
11199    const ORIGIN: Origin = Origin::ChargingStation;
11200    type Response = StatusNotificationResponse;
11201}
11202
11203impl Confirmed for StatusNotificationRequest {}
11204
11205/// Spec: OCPP 2.1 · G — Availability · Charging Station → CSMS · CALL.
11206#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11207pub struct StatusNotificationResponse {
11208    /// The `customData` member.
11209    #[serde(rename = "customData")]
11210    #[serde(default, skip_serializing_if = "Option::is_none")]
11211    pub custom_data: Option<crate::types::CustomData>,
11212}
11213
11214impl StatusNotificationResponse {
11215    /// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
11216    #[must_use]
11217    pub fn new() -> Self {
11218        Self::default()
11219    }
11220
11221    /// Sets the optional `customData` field.
11222    #[must_use]
11223    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11224        self.custom_data = Some(value);
11225        self
11226    }
11227}
11228
11229impl Validate for StatusNotificationResponse {
11230    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11231        path.push_key("customData");
11232        if let Some(value) = &self.custom_data {
11233            Validate::validate_at(value, path, out);
11234        }
11235        path.pop();
11236    }
11237}
11238
11239impl Sealed for StatusNotificationResponse {}
11240impl Response for StatusNotificationResponse {}
11241
11242/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
11243#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11244pub struct TransactionEventRequest {
11245    /// The `eventType` member.
11246    #[serde(rename = "eventType")]
11247    pub event_type: TransactionEventEnum,
11248    /// The date and time at which this transaction event occurred.
11249    pub timestamp: crate::types::DateTime,
11250    /// The `triggerReason` member.
11251    #[serde(rename = "triggerReason")]
11252    pub trigger_reason: TriggerReason,
11253    /// Incremental sequence number, helps with determining if all messages of a transaction have been received.
11254    #[serde(rename = "seqNo")]
11255    pub seq_no: i32,
11256    /// The `transactionInfo` member.
11257    #[serde(rename = "transactionInfo")]
11258    pub transaction_info: Transaction,
11259    /// The `costDetails` member.
11260    #[serde(rename = "costDetails")]
11261    #[serde(default, skip_serializing_if = "Option::is_none")]
11262    pub cost_details: Option<CostDetails>,
11263    /// The `meterValue` member.
11264    #[serde(rename = "meterValue")]
11265    #[serde(default, skip_serializing_if = "Option::is_none")]
11266    pub meter_value: Option<Vec<MeterValue>>,
11267    /// Indication that this transaction event happened when the Charging Station was offline. Default = false, meaning: the event occurred when the Charging Station was online.
11268    /// Schema default: `false`.
11269    #[serde(default, skip_serializing_if = "Option::is_none")]
11270    pub offline: Option<bool>,
11271    /// If the Charging Station is able to report the number of phases used, then it SHALL provide it.
11272    /// When omitted the CSMS may be able to determine the number of phases used as follows: +
11273    /// 1: The numberPhases in the currently used ChargingSchedule. +
11274    /// 2: The number of phases provided via device management.
11275    #[serde(rename = "numberOfPhasesUsed")]
11276    #[serde(default, skip_serializing_if = "Option::is_none")]
11277    pub number_of_phases_used: Option<i32>,
11278    /// The maximum current of the connected cable in Ampere (A).
11279    #[serde(rename = "cableMaxCurrent")]
11280    #[serde(default, skip_serializing_if = "Option::is_none")]
11281    pub cable_max_current: Option<i32>,
11282    /// This contains the Id of the reservation that terminates as a result of this transaction.
11283    #[serde(rename = "reservationId")]
11284    #[serde(default, skip_serializing_if = "Option::is_none")]
11285    pub reservation_id: Option<i32>,
11286    /// The `preconditioningStatus` member.
11287    #[serde(rename = "preconditioningStatus")]
11288    #[serde(default, skip_serializing_if = "Option::is_none")]
11289    pub preconditioning_status: Option<PreconditioningStatus>,
11290    /// *(2.1)* True when EVSE electronics are in sleep mode for this transaction. Default value (when absent) is false.
11291    #[serde(rename = "evseSleep")]
11292    #[serde(default, skip_serializing_if = "Option::is_none")]
11293    pub evse_sleep: Option<bool>,
11294    /// The `evse` member.
11295    #[serde(default, skip_serializing_if = "Option::is_none")]
11296    pub evse: Option<EVSE>,
11297    /// The `idToken` member.
11298    #[serde(rename = "idToken")]
11299    #[serde(default, skip_serializing_if = "Option::is_none")]
11300    pub id_token: Option<IdToken>,
11301    /// The `customData` member.
11302    #[serde(rename = "customData")]
11303    #[serde(default, skip_serializing_if = "Option::is_none")]
11304    pub custom_data: Option<crate::types::CustomData>,
11305}
11306
11307impl TransactionEventRequest {
11308    /// Creates a `TransactionEventRequest` from its required fields.
11309    #[must_use]
11310    pub fn new(
11311        event_type: TransactionEventEnum,
11312        timestamp: impl Into<crate::types::DateTime>,
11313        trigger_reason: TriggerReason,
11314        seq_no: i32,
11315        transaction_info: Transaction,
11316    ) -> Self {
11317        Self {
11318            event_type,
11319            timestamp: timestamp.into(),
11320            trigger_reason,
11321            seq_no,
11322            transaction_info,
11323            cost_details: None,
11324            meter_value: None,
11325            offline: None,
11326            number_of_phases_used: None,
11327            cable_max_current: None,
11328            reservation_id: None,
11329            preconditioning_status: None,
11330            evse_sleep: None,
11331            evse: None,
11332            id_token: None,
11333            custom_data: None,
11334        }
11335    }
11336
11337    /// Sets the optional `costDetails` field.
11338    #[must_use]
11339    pub fn with_cost_details(mut self, value: CostDetails) -> Self {
11340        self.cost_details = Some(value);
11341        self
11342    }
11343
11344    /// Sets the optional `meterValue` field.
11345    #[must_use]
11346    pub fn with_meter_value(mut self, value: Vec<MeterValue>) -> Self {
11347        self.meter_value = Some(value);
11348        self
11349    }
11350
11351    /// Sets the optional `offline` field.
11352    #[must_use]
11353    pub fn with_offline(mut self, value: bool) -> Self {
11354        self.offline = Some(value);
11355        self
11356    }
11357
11358    /// Sets the optional `numberOfPhasesUsed` field.
11359    #[must_use]
11360    pub fn with_number_of_phases_used(mut self, value: i32) -> Self {
11361        self.number_of_phases_used = Some(value);
11362        self
11363    }
11364
11365    /// Sets the optional `cableMaxCurrent` field.
11366    #[must_use]
11367    pub fn with_cable_max_current(mut self, value: i32) -> Self {
11368        self.cable_max_current = Some(value);
11369        self
11370    }
11371
11372    /// Sets the optional `reservationId` field.
11373    #[must_use]
11374    pub fn with_reservation_id(mut self, value: i32) -> Self {
11375        self.reservation_id = Some(value);
11376        self
11377    }
11378
11379    /// Sets the optional `preconditioningStatus` field.
11380    #[must_use]
11381    pub fn with_preconditioning_status(mut self, value: PreconditioningStatus) -> Self {
11382        self.preconditioning_status = Some(value);
11383        self
11384    }
11385
11386    /// Sets the optional `evseSleep` field.
11387    #[must_use]
11388    pub fn with_evse_sleep(mut self, value: bool) -> Self {
11389        self.evse_sleep = Some(value);
11390        self
11391    }
11392
11393    /// Sets the optional `evse` field.
11394    #[must_use]
11395    pub fn with_evse(mut self, value: EVSE) -> Self {
11396        self.evse = Some(value);
11397        self
11398    }
11399
11400    /// Sets the optional `idToken` field.
11401    #[must_use]
11402    pub fn with_id_token(mut self, value: IdToken) -> Self {
11403        self.id_token = Some(value);
11404        self
11405    }
11406
11407    /// Sets the optional `customData` field.
11408    #[must_use]
11409    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11410        self.custom_data = Some(value);
11411        self
11412    }
11413}
11414
11415impl Validate for TransactionEventRequest {
11416    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11417        path.push_key("eventType");
11418        Validate::validate_at(&self.event_type, path, out);
11419        path.pop();
11420        path.push_key("triggerReason");
11421        Validate::validate_at(&self.trigger_reason, path, out);
11422        path.pop();
11423        path.push_key("seqNo");
11424        validate::int_range(i64::from(self.seq_no), Some(0.0), None, path, out);
11425        path.pop();
11426        path.push_key("transactionInfo");
11427        Validate::validate_at(&self.transaction_info, path, out);
11428        path.pop();
11429        path.push_key("costDetails");
11430        if let Some(value) = &self.cost_details {
11431            Validate::validate_at(value, path, out);
11432        }
11433        path.pop();
11434        path.push_key("meterValue");
11435        if let Some(value) = &self.meter_value {
11436            validate::list_len(value.len(), Some(1), None, path, out);
11437            for (index, item) in value.iter().enumerate() {
11438                path.push_index(index);
11439                Validate::validate_at(item, path, out);
11440                path.pop();
11441            }
11442        }
11443        path.pop();
11444        path.push_key("numberOfPhasesUsed");
11445        if let Some(value) = &self.number_of_phases_used {
11446            validate::int_range(i64::from(*value), Some(0.0), Some(3.0), path, out);
11447        }
11448        path.pop();
11449        path.push_key("reservationId");
11450        if let Some(value) = &self.reservation_id {
11451            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
11452        }
11453        path.pop();
11454        path.push_key("preconditioningStatus");
11455        if let Some(value) = &self.preconditioning_status {
11456            Validate::validate_at(value, path, out);
11457        }
11458        path.pop();
11459        path.push_key("evse");
11460        if let Some(value) = &self.evse {
11461            Validate::validate_at(value, path, out);
11462        }
11463        path.pop();
11464        path.push_key("idToken");
11465        if let Some(value) = &self.id_token {
11466            Validate::validate_at(value, path, out);
11467        }
11468        path.pop();
11469        path.push_key("customData");
11470        if let Some(value) = &self.custom_data {
11471            Validate::validate_at(value, path, out);
11472        }
11473        path.pop();
11474    }
11475}
11476
11477impl Sealed for TransactionEventRequest {}
11478impl Request for TransactionEventRequest {
11479    type Action = Action;
11480    const ACTION: Action = Action::TransactionEvent;
11481    const KIND: MessageKind = MessageKind::Call;
11482    const ORIGIN: Origin = Origin::ChargingStation;
11483    type Response = TransactionEventResponse;
11484}
11485
11486impl Confirmed for TransactionEventRequest {}
11487
11488/// Spec: OCPP 2.1 · E — Transactions · Charging Station → CSMS · CALL.
11489#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
11490pub struct TransactionEventResponse {
11491    /// When _eventType_ of TransactionEventRequest is Updated, then this value contains the running cost. When _eventType_ of TransactionEventRequest is Ended, then this contains the final total cost of this transaction, including taxes, in the currency configured with the Configuration Variable: Currency. Absence of this value does not imply that the transaction was free. To indicate a free transaction, the CSMS SHALL send a value of 0.00.
11492    #[serde(rename = "totalCost")]
11493    #[serde(default, skip_serializing_if = "Option::is_none")]
11494    pub total_cost: Option<crate::types::Decimal>,
11495    /// Priority from a business point of view. Default priority is 0, The range is from -9 to 9. Higher values indicate a higher priority. The chargingPriority in &lt;&lt;transactioneventresponse,TransactionEventResponse&gt;&gt; is temporarily, so it may not be set in the &lt;&lt;cmn_idtokeninfotype,IdTokenInfoType&gt;&gt; afterwards. Also the chargingPriority in &lt;&lt;transactioneventresponse,TransactionEventResponse&gt;&gt; has a higher priority than the one in &lt;&lt;cmn_idtokeninfotype,IdTokenInfoType&gt;&gt;.
11496    #[serde(rename = "chargingPriority")]
11497    #[serde(default, skip_serializing_if = "Option::is_none")]
11498    pub charging_priority: Option<i32>,
11499    /// The `idTokenInfo` member.
11500    #[serde(rename = "idTokenInfo")]
11501    #[serde(default, skip_serializing_if = "Option::is_none")]
11502    pub id_token_info: Option<IdTokenInfo>,
11503    /// The `transactionLimit` member.
11504    #[serde(rename = "transactionLimit")]
11505    #[serde(default, skip_serializing_if = "Option::is_none")]
11506    pub transaction_limit: Option<TransactionLimit>,
11507    /// The `updatedPersonalMessage` member.
11508    #[serde(rename = "updatedPersonalMessage")]
11509    #[serde(default, skip_serializing_if = "Option::is_none")]
11510    pub updated_personal_message: Option<MessageContent>,
11511    /// The `updatedPersonalMessageExtra` member.
11512    #[serde(rename = "updatedPersonalMessageExtra")]
11513    #[serde(default, skip_serializing_if = "Option::is_none")]
11514    pub updated_personal_message_extra: Option<Vec<MessageContent>>,
11515    /// The `customData` member.
11516    #[serde(rename = "customData")]
11517    #[serde(default, skip_serializing_if = "Option::is_none")]
11518    pub custom_data: Option<crate::types::CustomData>,
11519}
11520
11521impl TransactionEventResponse {
11522    /// Creates an empty `TransactionEventResponse`. Every field of this type is optional.
11523    #[must_use]
11524    pub fn new() -> Self {
11525        Self::default()
11526    }
11527
11528    /// Sets the optional `totalCost` field.
11529    #[must_use]
11530    pub fn with_total_cost(mut self, value: impl Into<crate::types::Decimal>) -> Self {
11531        self.total_cost = Some(value.into());
11532        self
11533    }
11534
11535    /// Sets the optional `chargingPriority` field.
11536    #[must_use]
11537    pub fn with_charging_priority(mut self, value: i32) -> Self {
11538        self.charging_priority = Some(value);
11539        self
11540    }
11541
11542    /// Sets the optional `idTokenInfo` field.
11543    #[must_use]
11544    pub fn with_id_token_info(mut self, value: IdTokenInfo) -> Self {
11545        self.id_token_info = Some(value);
11546        self
11547    }
11548
11549    /// Sets the optional `transactionLimit` field.
11550    #[must_use]
11551    pub fn with_transaction_limit(mut self, value: TransactionLimit) -> Self {
11552        self.transaction_limit = Some(value);
11553        self
11554    }
11555
11556    /// Sets the optional `updatedPersonalMessage` field.
11557    #[must_use]
11558    pub fn with_updated_personal_message(mut self, value: MessageContent) -> Self {
11559        self.updated_personal_message = Some(value);
11560        self
11561    }
11562
11563    /// Sets the optional `updatedPersonalMessageExtra` field.
11564    #[must_use]
11565    pub fn with_updated_personal_message_extra(mut self, value: Vec<MessageContent>) -> Self {
11566        self.updated_personal_message_extra = Some(value);
11567        self
11568    }
11569
11570    /// Sets the optional `customData` field.
11571    #[must_use]
11572    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11573        self.custom_data = Some(value);
11574        self
11575    }
11576}
11577
11578impl Validate for TransactionEventResponse {
11579    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11580        path.push_key("idTokenInfo");
11581        if let Some(value) = &self.id_token_info {
11582            Validate::validate_at(value, path, out);
11583        }
11584        path.pop();
11585        path.push_key("transactionLimit");
11586        if let Some(value) = &self.transaction_limit {
11587            Validate::validate_at(value, path, out);
11588        }
11589        path.pop();
11590        path.push_key("updatedPersonalMessage");
11591        if let Some(value) = &self.updated_personal_message {
11592            Validate::validate_at(value, path, out);
11593        }
11594        path.pop();
11595        path.push_key("updatedPersonalMessageExtra");
11596        if let Some(value) = &self.updated_personal_message_extra {
11597            validate::list_len(value.len(), Some(1), Some(4), path, out);
11598            for (index, item) in value.iter().enumerate() {
11599                path.push_index(index);
11600                Validate::validate_at(item, path, out);
11601                path.pop();
11602            }
11603        }
11604        path.pop();
11605        path.push_key("customData");
11606        if let Some(value) = &self.custom_data {
11607            Validate::validate_at(value, path, out);
11608        }
11609        path.pop();
11610    }
11611}
11612
11613impl Sealed for TransactionEventResponse {}
11614impl Response for TransactionEventResponse {}
11615
11616/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11617#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11618pub struct TriggerMessageRequest {
11619    /// The `requestedMessage` member.
11620    #[serde(rename = "requestedMessage")]
11621    pub requested_message: MessageTrigger,
11622    /// The `evse` member.
11623    #[serde(default, skip_serializing_if = "Option::is_none")]
11624    pub evse: Option<EVSE>,
11625    /// *(2.1)* When _requestedMessage_ = `CustomTrigger` this will trigger sending the corresponding message in field _customTrigger_, if supported by Charging Station.
11626    #[serde(rename = "customTrigger")]
11627    #[serde(default, skip_serializing_if = "Option::is_none")]
11628    pub custom_trigger: Option<String>,
11629    /// The `customData` member.
11630    #[serde(rename = "customData")]
11631    #[serde(default, skip_serializing_if = "Option::is_none")]
11632    pub custom_data: Option<crate::types::CustomData>,
11633}
11634
11635impl TriggerMessageRequest {
11636    /// Creates a `TriggerMessageRequest` from its required fields.
11637    #[must_use]
11638    pub fn new(requested_message: MessageTrigger) -> Self {
11639        Self {
11640            requested_message,
11641            evse: None,
11642            custom_trigger: None,
11643            custom_data: None,
11644        }
11645    }
11646
11647    /// Sets the optional `evse` field.
11648    #[must_use]
11649    pub fn with_evse(mut self, value: EVSE) -> Self {
11650        self.evse = Some(value);
11651        self
11652    }
11653
11654    /// Sets the optional `customTrigger` field.
11655    #[must_use]
11656    pub fn with_custom_trigger(mut self, value: impl Into<String>) -> Self {
11657        self.custom_trigger = Some(value.into());
11658        self
11659    }
11660
11661    /// Sets the optional `customData` field.
11662    #[must_use]
11663    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11664        self.custom_data = Some(value);
11665        self
11666    }
11667}
11668
11669impl Validate for TriggerMessageRequest {
11670    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11671        path.push_key("requestedMessage");
11672        Validate::validate_at(&self.requested_message, path, out);
11673        path.pop();
11674        path.push_key("evse");
11675        if let Some(value) = &self.evse {
11676            Validate::validate_at(value, path, out);
11677        }
11678        path.pop();
11679        path.push_key("customTrigger");
11680        if let Some(value) = &self.custom_trigger {
11681            validate::string(value.as_str(), None, Some(50), path, out);
11682        }
11683        path.pop();
11684        path.push_key("customData");
11685        if let Some(value) = &self.custom_data {
11686            Validate::validate_at(value, path, out);
11687        }
11688        path.pop();
11689    }
11690}
11691
11692impl Sealed for TriggerMessageRequest {}
11693impl Request for TriggerMessageRequest {
11694    type Action = Action;
11695    const ACTION: Action = Action::TriggerMessage;
11696    const KIND: MessageKind = MessageKind::Call;
11697    const ORIGIN: Origin = Origin::Csms;
11698    type Response = TriggerMessageResponse;
11699}
11700
11701impl Confirmed for TriggerMessageRequest {}
11702
11703/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11704#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11705pub struct TriggerMessageResponse {
11706    /// The `status` member.
11707    pub status: TriggerMessageStatus,
11708    /// The `statusInfo` member.
11709    #[serde(rename = "statusInfo")]
11710    #[serde(default, skip_serializing_if = "Option::is_none")]
11711    pub status_info: Option<StatusInfo>,
11712    /// The `customData` member.
11713    #[serde(rename = "customData")]
11714    #[serde(default, skip_serializing_if = "Option::is_none")]
11715    pub custom_data: Option<crate::types::CustomData>,
11716}
11717
11718impl TriggerMessageResponse {
11719    /// Creates a `TriggerMessageResponse` from its required fields.
11720    #[must_use]
11721    pub fn new(status: TriggerMessageStatus) -> Self {
11722        Self {
11723            status,
11724            status_info: None,
11725            custom_data: None,
11726        }
11727    }
11728
11729    /// Sets the optional `statusInfo` field.
11730    #[must_use]
11731    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11732        self.status_info = Some(value);
11733        self
11734    }
11735
11736    /// Sets the optional `customData` field.
11737    #[must_use]
11738    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11739        self.custom_data = Some(value);
11740        self
11741    }
11742}
11743
11744impl Validate for TriggerMessageResponse {
11745    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11746        path.push_key("status");
11747        Validate::validate_at(&self.status, path, out);
11748        path.pop();
11749        path.push_key("statusInfo");
11750        if let Some(value) = &self.status_info {
11751            Validate::validate_at(value, path, out);
11752        }
11753        path.pop();
11754        path.push_key("customData");
11755        if let Some(value) = &self.custom_data {
11756            Validate::validate_at(value, path, out);
11757        }
11758        path.pop();
11759    }
11760}
11761
11762impl Sealed for TriggerMessageResponse {}
11763impl Response for TriggerMessageResponse {}
11764
11765/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11766#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11767pub struct UnlockConnectorRequest {
11768    /// This contains the identifier of the EVSE for which a connector needs to be unlocked.
11769    #[serde(rename = "evseId")]
11770    pub evse_id: i32,
11771    /// This contains the identifier of the connector that needs to be unlocked.
11772    #[serde(rename = "connectorId")]
11773    pub connector_id: i32,
11774    /// The `customData` member.
11775    #[serde(rename = "customData")]
11776    #[serde(default, skip_serializing_if = "Option::is_none")]
11777    pub custom_data: Option<crate::types::CustomData>,
11778}
11779
11780impl UnlockConnectorRequest {
11781    /// Creates a `UnlockConnectorRequest` from its required fields.
11782    #[must_use]
11783    pub fn new(evse_id: i32, connector_id: i32) -> Self {
11784        Self {
11785            evse_id,
11786            connector_id,
11787            custom_data: None,
11788        }
11789    }
11790
11791    /// Sets the optional `customData` field.
11792    #[must_use]
11793    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11794        self.custom_data = Some(value);
11795        self
11796    }
11797}
11798
11799impl Validate for UnlockConnectorRequest {
11800    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11801        path.push_key("evseId");
11802        validate::int_range(i64::from(self.evse_id), Some(0.0), None, path, out);
11803        path.pop();
11804        path.push_key("connectorId");
11805        validate::int_range(i64::from(self.connector_id), Some(0.0), None, path, out);
11806        path.pop();
11807        path.push_key("customData");
11808        if let Some(value) = &self.custom_data {
11809            Validate::validate_at(value, path, out);
11810        }
11811        path.pop();
11812    }
11813}
11814
11815impl Sealed for UnlockConnectorRequest {}
11816impl Request for UnlockConnectorRequest {
11817    type Action = Action;
11818    const ACTION: Action = Action::UnlockConnector;
11819    const KIND: MessageKind = MessageKind::Call;
11820    const ORIGIN: Origin = Origin::Csms;
11821    type Response = UnlockConnectorResponse;
11822}
11823
11824impl Confirmed for UnlockConnectorRequest {}
11825
11826/// Spec: OCPP 2.1 · F — Remote Control · CSMS → Charging Station · CALL.
11827#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11828pub struct UnlockConnectorResponse {
11829    /// The `status` member.
11830    pub status: UnlockStatus,
11831    /// The `statusInfo` member.
11832    #[serde(rename = "statusInfo")]
11833    #[serde(default, skip_serializing_if = "Option::is_none")]
11834    pub status_info: Option<StatusInfo>,
11835    /// The `customData` member.
11836    #[serde(rename = "customData")]
11837    #[serde(default, skip_serializing_if = "Option::is_none")]
11838    pub custom_data: Option<crate::types::CustomData>,
11839}
11840
11841impl UnlockConnectorResponse {
11842    /// Creates a `UnlockConnectorResponse` from its required fields.
11843    #[must_use]
11844    pub fn new(status: UnlockStatus) -> Self {
11845        Self {
11846            status,
11847            status_info: None,
11848            custom_data: None,
11849        }
11850    }
11851
11852    /// Sets the optional `statusInfo` field.
11853    #[must_use]
11854    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
11855        self.status_info = Some(value);
11856        self
11857    }
11858
11859    /// Sets the optional `customData` field.
11860    #[must_use]
11861    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11862        self.custom_data = Some(value);
11863        self
11864    }
11865}
11866
11867impl Validate for UnlockConnectorResponse {
11868    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11869        path.push_key("status");
11870        Validate::validate_at(&self.status, path, out);
11871        path.pop();
11872        path.push_key("statusInfo");
11873        if let Some(value) = &self.status_info {
11874            Validate::validate_at(value, path, out);
11875        }
11876        path.pop();
11877        path.push_key("customData");
11878        if let Some(value) = &self.custom_data {
11879            Validate::validate_at(value, path, out);
11880        }
11881        path.pop();
11882    }
11883}
11884
11885impl Sealed for UnlockConnectorResponse {}
11886impl Response for UnlockConnectorResponse {}
11887
11888/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
11889#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11890pub struct UnpublishFirmwareRequest {
11891    /// The MD5 checksum over the entire firmware file as a hexadecimal string of length 32.
11892    pub checksum: String,
11893    /// The `customData` member.
11894    #[serde(rename = "customData")]
11895    #[serde(default, skip_serializing_if = "Option::is_none")]
11896    pub custom_data: Option<crate::types::CustomData>,
11897}
11898
11899impl UnpublishFirmwareRequest {
11900    /// Creates a `UnpublishFirmwareRequest` from its required fields.
11901    #[must_use]
11902    pub fn new(checksum: impl Into<String>) -> Self {
11903        Self {
11904            checksum: checksum.into(),
11905            custom_data: None,
11906        }
11907    }
11908
11909    /// Sets the optional `customData` field.
11910    #[must_use]
11911    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11912        self.custom_data = Some(value);
11913        self
11914    }
11915}
11916
11917impl Validate for UnpublishFirmwareRequest {
11918    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11919        path.push_key("checksum");
11920        validate::string(self.checksum.as_str(), None, Some(32), path, out);
11921        path.pop();
11922        path.push_key("customData");
11923        if let Some(value) = &self.custom_data {
11924            Validate::validate_at(value, path, out);
11925        }
11926        path.pop();
11927    }
11928}
11929
11930impl Sealed for UnpublishFirmwareRequest {}
11931impl Request for UnpublishFirmwareRequest {
11932    type Action = Action;
11933    const ACTION: Action = Action::UnpublishFirmware;
11934    const KIND: MessageKind = MessageKind::Call;
11935    const ORIGIN: Origin = Origin::Csms;
11936    type Response = UnpublishFirmwareResponse;
11937}
11938
11939impl Confirmed for UnpublishFirmwareRequest {}
11940
11941/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
11942#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11943pub struct UnpublishFirmwareResponse {
11944    /// The `status` member.
11945    pub status: UnpublishFirmwareStatus,
11946    /// The `customData` member.
11947    #[serde(rename = "customData")]
11948    #[serde(default, skip_serializing_if = "Option::is_none")]
11949    pub custom_data: Option<crate::types::CustomData>,
11950}
11951
11952impl UnpublishFirmwareResponse {
11953    /// Creates a `UnpublishFirmwareResponse` from its required fields.
11954    #[must_use]
11955    pub fn new(status: UnpublishFirmwareStatus) -> Self {
11956        Self {
11957            status,
11958            custom_data: None,
11959        }
11960    }
11961
11962    /// Sets the optional `customData` field.
11963    #[must_use]
11964    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
11965        self.custom_data = Some(value);
11966        self
11967    }
11968}
11969
11970impl Validate for UnpublishFirmwareResponse {
11971    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
11972        path.push_key("status");
11973        Validate::validate_at(&self.status, path, out);
11974        path.pop();
11975        path.push_key("customData");
11976        if let Some(value) = &self.custom_data {
11977            Validate::validate_at(value, path, out);
11978        }
11979        path.pop();
11980    }
11981}
11982
11983impl Sealed for UnpublishFirmwareResponse {}
11984impl Response for UnpublishFirmwareResponse {}
11985
11986/// Id of dynamic charging profile to update.
11987///
11988/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
11989#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11990pub struct UpdateDynamicScheduleRequest {
11991    /// Id of charging profile to update.
11992    #[serde(rename = "chargingProfileId")]
11993    pub charging_profile_id: i32,
11994    /// The `scheduleUpdate` member.
11995    #[serde(rename = "scheduleUpdate")]
11996    pub schedule_update: ChargingScheduleUpdate,
11997    /// The `customData` member.
11998    #[serde(rename = "customData")]
11999    #[serde(default, skip_serializing_if = "Option::is_none")]
12000    pub custom_data: Option<crate::types::CustomData>,
12001}
12002
12003impl UpdateDynamicScheduleRequest {
12004    /// Creates a `UpdateDynamicScheduleRequest` from its required fields.
12005    #[must_use]
12006    pub fn new(charging_profile_id: i32, schedule_update: ChargingScheduleUpdate) -> Self {
12007        Self {
12008            charging_profile_id,
12009            schedule_update,
12010            custom_data: None,
12011        }
12012    }
12013
12014    /// Sets the optional `customData` field.
12015    #[must_use]
12016    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12017        self.custom_data = Some(value);
12018        self
12019    }
12020}
12021
12022impl Validate for UpdateDynamicScheduleRequest {
12023    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12024        path.push_key("scheduleUpdate");
12025        Validate::validate_at(&self.schedule_update, path, out);
12026        path.pop();
12027        path.push_key("customData");
12028        if let Some(value) = &self.custom_data {
12029            Validate::validate_at(value, path, out);
12030        }
12031        path.pop();
12032    }
12033}
12034
12035impl Sealed for UpdateDynamicScheduleRequest {}
12036impl Request for UpdateDynamicScheduleRequest {
12037    type Action = Action;
12038    const ACTION: Action = Action::UpdateDynamicSchedule;
12039    const KIND: MessageKind = MessageKind::Call;
12040    const ORIGIN: Origin = Origin::Csms;
12041    type Response = UpdateDynamicScheduleResponse;
12042}
12043
12044impl Confirmed for UpdateDynamicScheduleRequest {}
12045
12046/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12047#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12048pub struct UpdateDynamicScheduleResponse {
12049    /// The `status` member.
12050    pub status: ChargingProfileStatus,
12051    /// The `statusInfo` member.
12052    #[serde(rename = "statusInfo")]
12053    #[serde(default, skip_serializing_if = "Option::is_none")]
12054    pub status_info: Option<StatusInfo>,
12055    /// The `customData` member.
12056    #[serde(rename = "customData")]
12057    #[serde(default, skip_serializing_if = "Option::is_none")]
12058    pub custom_data: Option<crate::types::CustomData>,
12059}
12060
12061impl UpdateDynamicScheduleResponse {
12062    /// Creates a `UpdateDynamicScheduleResponse` from its required fields.
12063    #[must_use]
12064    pub fn new(status: ChargingProfileStatus) -> Self {
12065        Self {
12066            status,
12067            status_info: None,
12068            custom_data: None,
12069        }
12070    }
12071
12072    /// Sets the optional `statusInfo` field.
12073    #[must_use]
12074    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12075        self.status_info = Some(value);
12076        self
12077    }
12078
12079    /// Sets the optional `customData` field.
12080    #[must_use]
12081    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12082        self.custom_data = Some(value);
12083        self
12084    }
12085}
12086
12087impl Validate for UpdateDynamicScheduleResponse {
12088    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12089        path.push_key("status");
12090        Validate::validate_at(&self.status, path, out);
12091        path.pop();
12092        path.push_key("statusInfo");
12093        if let Some(value) = &self.status_info {
12094            Validate::validate_at(value, path, out);
12095        }
12096        path.pop();
12097        path.push_key("customData");
12098        if let Some(value) = &self.custom_data {
12099            Validate::validate_at(value, path, out);
12100        }
12101        path.pop();
12102    }
12103}
12104
12105impl Sealed for UpdateDynamicScheduleResponse {}
12106impl Response for UpdateDynamicScheduleResponse {}
12107
12108/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
12109#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12110pub struct UpdateFirmwareRequest {
12111    /// The Id of this request
12112    #[serde(rename = "requestId")]
12113    pub request_id: i32,
12114    /// The `firmware` member.
12115    pub firmware: Firmware,
12116    /// This specifies how many times Charging Station must retry to download the firmware before giving up. If this field is not present, it is left to Charging Station to decide how many times it wants to retry.
12117    /// If the value is 0, it means: no retries.
12118    #[serde(default, skip_serializing_if = "Option::is_none")]
12119    pub retries: Option<i32>,
12120    /// 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.
12121    #[serde(rename = "retryInterval")]
12122    #[serde(default, skip_serializing_if = "Option::is_none")]
12123    pub retry_interval: Option<i32>,
12124    /// The `customData` member.
12125    #[serde(rename = "customData")]
12126    #[serde(default, skip_serializing_if = "Option::is_none")]
12127    pub custom_data: Option<crate::types::CustomData>,
12128}
12129
12130impl UpdateFirmwareRequest {
12131    /// Creates a `UpdateFirmwareRequest` from its required fields.
12132    #[must_use]
12133    pub fn new(request_id: i32, firmware: Firmware) -> Self {
12134        Self {
12135            request_id,
12136            firmware,
12137            retries: None,
12138            retry_interval: None,
12139            custom_data: None,
12140        }
12141    }
12142
12143    /// Sets the optional `retries` field.
12144    #[must_use]
12145    pub fn with_retries(mut self, value: i32) -> Self {
12146        self.retries = Some(value);
12147        self
12148    }
12149
12150    /// Sets the optional `retryInterval` field.
12151    #[must_use]
12152    pub fn with_retry_interval(mut self, value: i32) -> Self {
12153        self.retry_interval = Some(value);
12154        self
12155    }
12156
12157    /// Sets the optional `customData` field.
12158    #[must_use]
12159    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12160        self.custom_data = Some(value);
12161        self
12162    }
12163}
12164
12165impl Validate for UpdateFirmwareRequest {
12166    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12167        path.push_key("firmware");
12168        Validate::validate_at(&self.firmware, path, out);
12169        path.pop();
12170        path.push_key("retries");
12171        if let Some(value) = &self.retries {
12172            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
12173        }
12174        path.pop();
12175        path.push_key("customData");
12176        if let Some(value) = &self.custom_data {
12177            Validate::validate_at(value, path, out);
12178        }
12179        path.pop();
12180    }
12181}
12182
12183impl Sealed for UpdateFirmwareRequest {}
12184impl Request for UpdateFirmwareRequest {
12185    type Action = Action;
12186    const ACTION: Action = Action::UpdateFirmware;
12187    const KIND: MessageKind = MessageKind::Call;
12188    const ORIGIN: Origin = Origin::Csms;
12189    type Response = UpdateFirmwareResponse;
12190}
12191
12192impl Confirmed for UpdateFirmwareRequest {}
12193
12194/// Spec: OCPP 2.1 · L — Firmware Management · CSMS → Charging Station · CALL.
12195#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12196pub struct UpdateFirmwareResponse {
12197    /// The `status` member.
12198    pub status: UpdateFirmwareStatus,
12199    /// The `statusInfo` member.
12200    #[serde(rename = "statusInfo")]
12201    #[serde(default, skip_serializing_if = "Option::is_none")]
12202    pub status_info: Option<StatusInfo>,
12203    /// The `customData` member.
12204    #[serde(rename = "customData")]
12205    #[serde(default, skip_serializing_if = "Option::is_none")]
12206    pub custom_data: Option<crate::types::CustomData>,
12207}
12208
12209impl UpdateFirmwareResponse {
12210    /// Creates a `UpdateFirmwareResponse` from its required fields.
12211    #[must_use]
12212    pub fn new(status: UpdateFirmwareStatus) -> Self {
12213        Self {
12214            status,
12215            status_info: None,
12216            custom_data: None,
12217        }
12218    }
12219
12220    /// Sets the optional `statusInfo` field.
12221    #[must_use]
12222    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12223        self.status_info = Some(value);
12224        self
12225    }
12226
12227    /// Sets the optional `customData` field.
12228    #[must_use]
12229    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12230        self.custom_data = Some(value);
12231        self
12232    }
12233}
12234
12235impl Validate for UpdateFirmwareResponse {
12236    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12237        path.push_key("status");
12238        Validate::validate_at(&self.status, path, out);
12239        path.pop();
12240        path.push_key("statusInfo");
12241        if let Some(value) = &self.status_info {
12242            Validate::validate_at(value, path, out);
12243        }
12244        path.pop();
12245        path.push_key("customData");
12246        if let Some(value) = &self.custom_data {
12247            Validate::validate_at(value, path, out);
12248        }
12249        path.pop();
12250    }
12251}
12252
12253impl Sealed for UpdateFirmwareResponse {}
12254impl Response for UpdateFirmwareResponse {}
12255
12256/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12257#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12258pub struct UsePriorityChargingRequest {
12259    /// The transaction for which priority charging is requested.
12260    #[serde(rename = "transactionId")]
12261    pub transaction_id: String,
12262    /// True to request priority charging.
12263    /// False to request stopping priority charging.
12264    pub activate: bool,
12265    /// The `customData` member.
12266    #[serde(rename = "customData")]
12267    #[serde(default, skip_serializing_if = "Option::is_none")]
12268    pub custom_data: Option<crate::types::CustomData>,
12269}
12270
12271impl UsePriorityChargingRequest {
12272    /// Creates a `UsePriorityChargingRequest` from its required fields.
12273    #[must_use]
12274    pub fn new(transaction_id: impl Into<String>, activate: bool) -> Self {
12275        Self {
12276            transaction_id: transaction_id.into(),
12277            activate,
12278            custom_data: None,
12279        }
12280    }
12281
12282    /// Sets the optional `customData` field.
12283    #[must_use]
12284    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12285        self.custom_data = Some(value);
12286        self
12287    }
12288}
12289
12290impl Validate for UsePriorityChargingRequest {
12291    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12292        path.push_key("transactionId");
12293        validate::string(self.transaction_id.as_str(), None, Some(36), path, out);
12294        path.pop();
12295        path.push_key("customData");
12296        if let Some(value) = &self.custom_data {
12297            Validate::validate_at(value, path, out);
12298        }
12299        path.pop();
12300    }
12301}
12302
12303impl Sealed for UsePriorityChargingRequest {}
12304impl Request for UsePriorityChargingRequest {
12305    type Action = Action;
12306    const ACTION: Action = Action::UsePriorityCharging;
12307    const KIND: MessageKind = MessageKind::Call;
12308    const ORIGIN: Origin = Origin::Csms;
12309    type Response = UsePriorityChargingResponse;
12310}
12311
12312impl Confirmed for UsePriorityChargingRequest {}
12313
12314/// Spec: OCPP 2.1 · K — Smart Charging · CSMS → Charging Station · CALL.
12315#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12316pub struct UsePriorityChargingResponse {
12317    /// The `status` member.
12318    pub status: PriorityChargingStatus,
12319    /// The `statusInfo` member.
12320    #[serde(rename = "statusInfo")]
12321    #[serde(default, skip_serializing_if = "Option::is_none")]
12322    pub status_info: Option<StatusInfo>,
12323    /// The `customData` member.
12324    #[serde(rename = "customData")]
12325    #[serde(default, skip_serializing_if = "Option::is_none")]
12326    pub custom_data: Option<crate::types::CustomData>,
12327}
12328
12329impl UsePriorityChargingResponse {
12330    /// Creates a `UsePriorityChargingResponse` from its required fields.
12331    #[must_use]
12332    pub fn new(status: PriorityChargingStatus) -> Self {
12333        Self {
12334            status,
12335            status_info: None,
12336            custom_data: None,
12337        }
12338    }
12339
12340    /// Sets the optional `statusInfo` field.
12341    #[must_use]
12342    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12343        self.status_info = Some(value);
12344        self
12345    }
12346
12347    /// Sets the optional `customData` field.
12348    #[must_use]
12349    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12350        self.custom_data = Some(value);
12351        self
12352    }
12353}
12354
12355impl Validate for UsePriorityChargingResponse {
12356    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12357        path.push_key("status");
12358        Validate::validate_at(&self.status, path, out);
12359        path.pop();
12360        path.push_key("statusInfo");
12361        if let Some(value) = &self.status_info {
12362            Validate::validate_at(value, path, out);
12363        }
12364        path.pop();
12365        path.push_key("customData");
12366        if let Some(value) = &self.custom_data {
12367            Validate::validate_at(value, path, out);
12368        }
12369        path.pop();
12370    }
12371}
12372
12373impl Sealed for UsePriorityChargingResponse {}
12374impl Response for UsePriorityChargingResponse {}
12375
12376/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
12377#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12378pub struct VatNumberValidationRequest {
12379    /// VAT number to check.
12380    #[serde(rename = "vatNumber")]
12381    pub vat_number: String,
12382    /// EVSE id for which check is done
12383    #[serde(rename = "evseId")]
12384    #[serde(default, skip_serializing_if = "Option::is_none")]
12385    pub evse_id: Option<i32>,
12386    /// The `customData` member.
12387    #[serde(rename = "customData")]
12388    #[serde(default, skip_serializing_if = "Option::is_none")]
12389    pub custom_data: Option<crate::types::CustomData>,
12390}
12391
12392impl VatNumberValidationRequest {
12393    /// Creates a `VatNumberValidationRequest` from its required fields.
12394    #[must_use]
12395    pub fn new(vat_number: impl Into<String>) -> Self {
12396        Self {
12397            vat_number: vat_number.into(),
12398            evse_id: None,
12399            custom_data: None,
12400        }
12401    }
12402
12403    /// Sets the optional `evseId` field.
12404    #[must_use]
12405    pub fn with_evse_id(mut self, value: i32) -> Self {
12406        self.evse_id = Some(value);
12407        self
12408    }
12409
12410    /// Sets the optional `customData` field.
12411    #[must_use]
12412    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12413        self.custom_data = Some(value);
12414        self
12415    }
12416}
12417
12418impl Validate for VatNumberValidationRequest {
12419    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12420        path.push_key("vatNumber");
12421        validate::string(self.vat_number.as_str(), None, Some(20), path, out);
12422        path.pop();
12423        path.push_key("evseId");
12424        if let Some(value) = &self.evse_id {
12425            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
12426        }
12427        path.pop();
12428        path.push_key("customData");
12429        if let Some(value) = &self.custom_data {
12430            Validate::validate_at(value, path, out);
12431        }
12432        path.pop();
12433    }
12434}
12435
12436impl Sealed for VatNumberValidationRequest {}
12437impl Request for VatNumberValidationRequest {
12438    type Action = Action;
12439    const ACTION: Action = Action::VatNumberValidation;
12440    const KIND: MessageKind = MessageKind::Call;
12441    const ORIGIN: Origin = Origin::ChargingStation;
12442    type Response = VatNumberValidationResponse;
12443}
12444
12445impl Confirmed for VatNumberValidationRequest {}
12446
12447/// Spec: OCPP 2.1 · I — Tariff and Cost · Charging Station → CSMS · CALL.
12448#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12449pub struct VatNumberValidationResponse {
12450    /// VAT number that was requested.
12451    #[serde(rename = "vatNumber")]
12452    pub vat_number: String,
12453    /// The `status` member.
12454    pub status: GenericStatus,
12455    /// The `company` member.
12456    #[serde(default, skip_serializing_if = "Option::is_none")]
12457    pub company: Option<Address>,
12458    /// The `statusInfo` member.
12459    #[serde(rename = "statusInfo")]
12460    #[serde(default, skip_serializing_if = "Option::is_none")]
12461    pub status_info: Option<StatusInfo>,
12462    /// EVSE id for which check was requested.
12463    #[serde(rename = "evseId")]
12464    #[serde(default, skip_serializing_if = "Option::is_none")]
12465    pub evse_id: Option<i32>,
12466    /// The `customData` member.
12467    #[serde(rename = "customData")]
12468    #[serde(default, skip_serializing_if = "Option::is_none")]
12469    pub custom_data: Option<crate::types::CustomData>,
12470}
12471
12472impl VatNumberValidationResponse {
12473    /// Creates a `VatNumberValidationResponse` from its required fields.
12474    #[must_use]
12475    pub fn new(vat_number: impl Into<String>, status: GenericStatus) -> Self {
12476        Self {
12477            vat_number: vat_number.into(),
12478            status,
12479            company: None,
12480            status_info: None,
12481            evse_id: None,
12482            custom_data: None,
12483        }
12484    }
12485
12486    /// Sets the optional `company` field.
12487    #[must_use]
12488    pub fn with_company(mut self, value: Address) -> Self {
12489        self.company = Some(value);
12490        self
12491    }
12492
12493    /// Sets the optional `statusInfo` field.
12494    #[must_use]
12495    pub fn with_status_info(mut self, value: StatusInfo) -> Self {
12496        self.status_info = Some(value);
12497        self
12498    }
12499
12500    /// Sets the optional `evseId` field.
12501    #[must_use]
12502    pub fn with_evse_id(mut self, value: i32) -> Self {
12503        self.evse_id = Some(value);
12504        self
12505    }
12506
12507    /// Sets the optional `customData` field.
12508    #[must_use]
12509    pub fn with_custom_data(mut self, value: crate::types::CustomData) -> Self {
12510        self.custom_data = Some(value);
12511        self
12512    }
12513}
12514
12515impl Validate for VatNumberValidationResponse {
12516    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
12517        path.push_key("vatNumber");
12518        validate::string(self.vat_number.as_str(), None, Some(20), path, out);
12519        path.pop();
12520        path.push_key("status");
12521        Validate::validate_at(&self.status, path, out);
12522        path.pop();
12523        path.push_key("company");
12524        if let Some(value) = &self.company {
12525            Validate::validate_at(value, path, out);
12526        }
12527        path.pop();
12528        path.push_key("statusInfo");
12529        if let Some(value) = &self.status_info {
12530            Validate::validate_at(value, path, out);
12531        }
12532        path.pop();
12533        path.push_key("evseId");
12534        if let Some(value) = &self.evse_id {
12535            validate::int_range(i64::from(*value), Some(0.0), None, path, out);
12536        }
12537        path.pop();
12538        path.push_key("customData");
12539        if let Some(value) = &self.custom_data {
12540            Validate::validate_at(value, path, out);
12541        }
12542        path.pop();
12543    }
12544}
12545
12546impl Sealed for VatNumberValidationResponse {}
12547impl Response for VatNumberValidationResponse {}