Skip to main content

ocpp_kit/v1_6/
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 1.6 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 1.6 · Core · Charging Station → CSMS · CALL.
26#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
27pub struct AuthorizeRequest {
28    /// The `idTag` member.
29    #[serde(rename = "idTag")]
30    pub id_tag: String,
31}
32
33impl AuthorizeRequest {
34    /// Creates a `AuthorizeRequest` from its required fields.
35    #[must_use]
36    pub fn new(id_tag: impl Into<String>) -> Self {
37        Self {
38            id_tag: id_tag.into(),
39        }
40    }
41}
42
43impl Validate for AuthorizeRequest {
44    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
45        path.push_key("idTag");
46        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
47        path.pop();
48    }
49}
50
51impl Sealed for AuthorizeRequest {}
52impl Request for AuthorizeRequest {
53    type Action = Action;
54    const ACTION: Action = Action::Authorize;
55    const KIND: MessageKind = MessageKind::Call;
56    const ORIGIN: Origin = Origin::ChargingStation;
57    type Response = AuthorizeResponse;
58}
59
60impl Confirmed for AuthorizeRequest {}
61
62/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
63#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
64pub struct AuthorizeResponse {
65    /// The `idTagInfo` member.
66    #[serde(rename = "idTagInfo")]
67    pub id_tag_info: IdTagInfo,
68}
69
70impl AuthorizeResponse {
71    /// Creates a `AuthorizeResponse` from its required fields.
72    #[must_use]
73    pub fn new(id_tag_info: IdTagInfo) -> Self {
74        Self { id_tag_info }
75    }
76}
77
78impl Validate for AuthorizeResponse {
79    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
80        path.push_key("idTagInfo");
81        Validate::validate_at(&self.id_tag_info, path, out);
82        path.pop();
83    }
84}
85
86impl Sealed for AuthorizeResponse {}
87impl Response for AuthorizeResponse {}
88
89/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
90#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
91pub struct BootNotificationRequest {
92    /// The `chargePointVendor` member.
93    #[serde(rename = "chargePointVendor")]
94    pub charge_point_vendor: String,
95    /// The `chargePointModel` member.
96    #[serde(rename = "chargePointModel")]
97    pub charge_point_model: String,
98    /// The `chargePointSerialNumber` member.
99    #[serde(rename = "chargePointSerialNumber")]
100    #[serde(default, skip_serializing_if = "Option::is_none")]
101    pub charge_point_serial_number: Option<String>,
102    /// The `chargeBoxSerialNumber` member.
103    #[serde(rename = "chargeBoxSerialNumber")]
104    #[serde(default, skip_serializing_if = "Option::is_none")]
105    pub charge_box_serial_number: Option<String>,
106    /// The `firmwareVersion` member.
107    #[serde(rename = "firmwareVersion")]
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub firmware_version: Option<String>,
110    /// The `iccid` member.
111    #[serde(default, skip_serializing_if = "Option::is_none")]
112    pub iccid: Option<String>,
113    /// The `imsi` member.
114    #[serde(default, skip_serializing_if = "Option::is_none")]
115    pub imsi: Option<String>,
116    /// The `meterType` member.
117    #[serde(rename = "meterType")]
118    #[serde(default, skip_serializing_if = "Option::is_none")]
119    pub meter_type: Option<String>,
120    /// The `meterSerialNumber` member.
121    #[serde(rename = "meterSerialNumber")]
122    #[serde(default, skip_serializing_if = "Option::is_none")]
123    pub meter_serial_number: Option<String>,
124}
125
126impl BootNotificationRequest {
127    /// Creates a `BootNotificationRequest` from its required fields.
128    #[must_use]
129    pub fn new(
130        charge_point_vendor: impl Into<String>,
131        charge_point_model: impl Into<String>,
132    ) -> Self {
133        Self {
134            charge_point_vendor: charge_point_vendor.into(),
135            charge_point_model: charge_point_model.into(),
136            charge_point_serial_number: None,
137            charge_box_serial_number: None,
138            firmware_version: None,
139            iccid: None,
140            imsi: None,
141            meter_type: None,
142            meter_serial_number: None,
143        }
144    }
145
146    /// Sets the optional `chargePointSerialNumber` field.
147    #[must_use]
148    pub fn with_charge_point_serial_number(mut self, value: impl Into<String>) -> Self {
149        self.charge_point_serial_number = Some(value.into());
150        self
151    }
152
153    /// Sets the optional `chargeBoxSerialNumber` field.
154    #[must_use]
155    pub fn with_charge_box_serial_number(mut self, value: impl Into<String>) -> Self {
156        self.charge_box_serial_number = Some(value.into());
157        self
158    }
159
160    /// Sets the optional `firmwareVersion` field.
161    #[must_use]
162    pub fn with_firmware_version(mut self, value: impl Into<String>) -> Self {
163        self.firmware_version = Some(value.into());
164        self
165    }
166
167    /// Sets the optional `iccid` field.
168    #[must_use]
169    pub fn with_iccid(mut self, value: impl Into<String>) -> Self {
170        self.iccid = Some(value.into());
171        self
172    }
173
174    /// Sets the optional `imsi` field.
175    #[must_use]
176    pub fn with_imsi(mut self, value: impl Into<String>) -> Self {
177        self.imsi = Some(value.into());
178        self
179    }
180
181    /// Sets the optional `meterType` field.
182    #[must_use]
183    pub fn with_meter_type(mut self, value: impl Into<String>) -> Self {
184        self.meter_type = Some(value.into());
185        self
186    }
187
188    /// Sets the optional `meterSerialNumber` field.
189    #[must_use]
190    pub fn with_meter_serial_number(mut self, value: impl Into<String>) -> Self {
191        self.meter_serial_number = Some(value.into());
192        self
193    }
194}
195
196impl Validate for BootNotificationRequest {
197    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
198        path.push_key("chargePointVendor");
199        validate::string(self.charge_point_vendor.as_str(), None, Some(20), path, out);
200        path.pop();
201        path.push_key("chargePointModel");
202        validate::string(self.charge_point_model.as_str(), None, Some(20), path, out);
203        path.pop();
204        path.push_key("chargePointSerialNumber");
205        if let Some(value) = &self.charge_point_serial_number {
206            validate::string(value.as_str(), None, Some(25), path, out);
207        }
208        path.pop();
209        path.push_key("chargeBoxSerialNumber");
210        if let Some(value) = &self.charge_box_serial_number {
211            validate::string(value.as_str(), None, Some(25), path, out);
212        }
213        path.pop();
214        path.push_key("firmwareVersion");
215        if let Some(value) = &self.firmware_version {
216            validate::string(value.as_str(), None, Some(50), path, out);
217        }
218        path.pop();
219        path.push_key("iccid");
220        if let Some(value) = &self.iccid {
221            validate::string(value.as_str(), None, Some(20), path, out);
222        }
223        path.pop();
224        path.push_key("imsi");
225        if let Some(value) = &self.imsi {
226            validate::string(value.as_str(), None, Some(20), path, out);
227        }
228        path.pop();
229        path.push_key("meterType");
230        if let Some(value) = &self.meter_type {
231            validate::string(value.as_str(), None, Some(25), path, out);
232        }
233        path.pop();
234        path.push_key("meterSerialNumber");
235        if let Some(value) = &self.meter_serial_number {
236            validate::string(value.as_str(), None, Some(25), path, out);
237        }
238        path.pop();
239    }
240}
241
242impl Sealed for BootNotificationRequest {}
243impl Request for BootNotificationRequest {
244    type Action = Action;
245    const ACTION: Action = Action::BootNotification;
246    const KIND: MessageKind = MessageKind::Call;
247    const ORIGIN: Origin = Origin::ChargingStation;
248    type Response = BootNotificationResponse;
249}
250
251impl Confirmed for BootNotificationRequest {}
252
253/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
254#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
255pub struct BootNotificationResponse {
256    /// The `status` member.
257    pub status: RegistrationStatus,
258    /// The `currentTime` member.
259    #[serde(rename = "currentTime")]
260    pub current_time: crate::types::DateTime,
261    /// The `interval` member.
262    pub interval: i32,
263}
264
265impl BootNotificationResponse {
266    /// Creates a `BootNotificationResponse` from its required fields.
267    #[must_use]
268    pub fn new(
269        status: RegistrationStatus,
270        current_time: impl Into<crate::types::DateTime>,
271        interval: i32,
272    ) -> Self {
273        Self {
274            status,
275            current_time: current_time.into(),
276            interval,
277        }
278    }
279}
280
281impl Validate for BootNotificationResponse {
282    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
283        path.push_key("status");
284        Validate::validate_at(&self.status, path, out);
285        path.pop();
286    }
287}
288
289impl Sealed for BootNotificationResponse {}
290impl Response for BootNotificationResponse {}
291
292/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
293#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
294pub struct CancelReservationRequest {
295    /// The `reservationId` member.
296    #[serde(rename = "reservationId")]
297    pub reservation_id: i32,
298}
299
300impl CancelReservationRequest {
301    /// Creates a `CancelReservationRequest` from its required fields.
302    #[must_use]
303    pub fn new(reservation_id: i32) -> Self {
304        Self { reservation_id }
305    }
306}
307
308impl Validate for CancelReservationRequest {
309    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
310}
311
312impl Sealed for CancelReservationRequest {}
313impl Request for CancelReservationRequest {
314    type Action = Action;
315    const ACTION: Action = Action::CancelReservation;
316    const KIND: MessageKind = MessageKind::Call;
317    const ORIGIN: Origin = Origin::Csms;
318    type Response = CancelReservationResponse;
319}
320
321impl Confirmed for CancelReservationRequest {}
322
323/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
324#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
325pub struct CancelReservationResponse {
326    /// The `status` member.
327    pub status: CancelReservationStatus,
328}
329
330impl CancelReservationResponse {
331    /// Creates a `CancelReservationResponse` from its required fields.
332    #[must_use]
333    pub fn new(status: CancelReservationStatus) -> Self {
334        Self { status }
335    }
336}
337
338impl Validate for CancelReservationResponse {
339    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
340        path.push_key("status");
341        Validate::validate_at(&self.status, path, out);
342        path.pop();
343    }
344}
345
346impl Sealed for CancelReservationResponse {}
347impl Response for CancelReservationResponse {}
348
349/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
350#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
351pub struct CertificateSignedRequest {
352    /// The `certificateChain` member.
353    #[serde(rename = "certificateChain")]
354    pub certificate_chain: String,
355}
356
357impl CertificateSignedRequest {
358    /// Creates a `CertificateSignedRequest` from its required fields.
359    #[must_use]
360    pub fn new(certificate_chain: impl Into<String>) -> Self {
361        Self {
362            certificate_chain: certificate_chain.into(),
363        }
364    }
365}
366
367impl Validate for CertificateSignedRequest {
368    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
369        path.push_key("certificateChain");
370        validate::string(
371            self.certificate_chain.as_str(),
372            None,
373            Some(10000),
374            path,
375            out,
376        );
377        path.pop();
378    }
379}
380
381impl Sealed for CertificateSignedRequest {}
382impl Request for CertificateSignedRequest {
383    type Action = Action;
384    const ACTION: Action = Action::CertificateSigned;
385    const KIND: MessageKind = MessageKind::Call;
386    const ORIGIN: Origin = Origin::Csms;
387    type Response = CertificateSignedResponse;
388}
389
390impl Confirmed for CertificateSignedRequest {}
391
392/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
393#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
394pub struct CertificateSignedResponse {
395    /// The `status` member.
396    pub status: CertificateSignedStatus,
397}
398
399impl CertificateSignedResponse {
400    /// Creates a `CertificateSignedResponse` from its required fields.
401    #[must_use]
402    pub fn new(status: CertificateSignedStatus) -> Self {
403        Self { status }
404    }
405}
406
407impl Validate for CertificateSignedResponse {
408    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
409        path.push_key("status");
410        Validate::validate_at(&self.status, path, out);
411        path.pop();
412    }
413}
414
415impl Sealed for CertificateSignedResponse {}
416impl Response for CertificateSignedResponse {}
417
418/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
419#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
420pub struct ChangeAvailabilityRequest {
421    /// The `connectorId` member.
422    #[serde(rename = "connectorId")]
423    pub connector_id: i32,
424    /// The `type` member.
425    pub r#type: AvailabilityType,
426}
427
428impl ChangeAvailabilityRequest {
429    /// Creates a `ChangeAvailabilityRequest` from its required fields.
430    #[must_use]
431    pub fn new(connector_id: i32, r#type: AvailabilityType) -> Self {
432        Self {
433            connector_id,
434            r#type,
435        }
436    }
437}
438
439impl Validate for ChangeAvailabilityRequest {
440    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
441        path.push_key("type");
442        Validate::validate_at(&self.r#type, path, out);
443        path.pop();
444    }
445}
446
447impl Sealed for ChangeAvailabilityRequest {}
448impl Request for ChangeAvailabilityRequest {
449    type Action = Action;
450    const ACTION: Action = Action::ChangeAvailability;
451    const KIND: MessageKind = MessageKind::Call;
452    const ORIGIN: Origin = Origin::Csms;
453    type Response = ChangeAvailabilityResponse;
454}
455
456impl Confirmed for ChangeAvailabilityRequest {}
457
458/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
459#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
460pub struct ChangeAvailabilityResponse {
461    /// The `status` member.
462    pub status: AvailabilityStatus,
463}
464
465impl ChangeAvailabilityResponse {
466    /// Creates a `ChangeAvailabilityResponse` from its required fields.
467    #[must_use]
468    pub fn new(status: AvailabilityStatus) -> Self {
469        Self { status }
470    }
471}
472
473impl Validate for ChangeAvailabilityResponse {
474    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
475        path.push_key("status");
476        Validate::validate_at(&self.status, path, out);
477        path.pop();
478    }
479}
480
481impl Sealed for ChangeAvailabilityResponse {}
482impl Response for ChangeAvailabilityResponse {}
483
484/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
485#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
486pub struct ChangeConfigurationRequest {
487    /// The `key` member.
488    pub key: String,
489    /// The `value` member.
490    pub value: String,
491}
492
493impl ChangeConfigurationRequest {
494    /// Creates a `ChangeConfigurationRequest` from its required fields.
495    #[must_use]
496    pub fn new(key: impl Into<String>, value: impl Into<String>) -> Self {
497        Self {
498            key: key.into(),
499            value: value.into(),
500        }
501    }
502}
503
504impl Validate for ChangeConfigurationRequest {
505    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
506        path.push_key("key");
507        validate::string(self.key.as_str(), None, Some(50), path, out);
508        path.pop();
509        path.push_key("value");
510        validate::string(self.value.as_str(), None, Some(500), path, out);
511        path.pop();
512    }
513}
514
515impl Sealed for ChangeConfigurationRequest {}
516impl Request for ChangeConfigurationRequest {
517    type Action = Action;
518    const ACTION: Action = Action::ChangeConfiguration;
519    const KIND: MessageKind = MessageKind::Call;
520    const ORIGIN: Origin = Origin::Csms;
521    type Response = ChangeConfigurationResponse;
522}
523
524impl Confirmed for ChangeConfigurationRequest {}
525
526/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
527#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
528pub struct ChangeConfigurationResponse {
529    /// The `status` member.
530    pub status: ConfigurationStatus,
531}
532
533impl ChangeConfigurationResponse {
534    /// Creates a `ChangeConfigurationResponse` from its required fields.
535    #[must_use]
536    pub fn new(status: ConfigurationStatus) -> Self {
537        Self { status }
538    }
539}
540
541impl Validate for ChangeConfigurationResponse {
542    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
543        path.push_key("status");
544        Validate::validate_at(&self.status, path, out);
545        path.pop();
546    }
547}
548
549impl Sealed for ChangeConfigurationResponse {}
550impl Response for ChangeConfigurationResponse {}
551
552/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
553#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
554pub struct ClearCacheRequest {}
555
556impl ClearCacheRequest {
557    /// Creates an empty `ClearCacheRequest`. Every field of this type is optional.
558    #[must_use]
559    pub fn new() -> Self {
560        Self::default()
561    }
562}
563
564impl Validate for ClearCacheRequest {
565    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
566}
567
568impl Sealed for ClearCacheRequest {}
569impl Request for ClearCacheRequest {
570    type Action = Action;
571    const ACTION: Action = Action::ClearCache;
572    const KIND: MessageKind = MessageKind::Call;
573    const ORIGIN: Origin = Origin::Csms;
574    type Response = ClearCacheResponse;
575}
576
577impl Confirmed for ClearCacheRequest {}
578
579/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
580#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
581pub struct ClearCacheResponse {
582    /// The `status` member.
583    pub status: ClearCacheStatus,
584}
585
586impl ClearCacheResponse {
587    /// Creates a `ClearCacheResponse` from its required fields.
588    #[must_use]
589    pub fn new(status: ClearCacheStatus) -> Self {
590        Self { status }
591    }
592}
593
594impl Validate for ClearCacheResponse {
595    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
596        path.push_key("status");
597        Validate::validate_at(&self.status, path, out);
598        path.pop();
599    }
600}
601
602impl Sealed for ClearCacheResponse {}
603impl Response for ClearCacheResponse {}
604
605/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
606#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
607pub struct ClearChargingProfileRequest {
608    /// The `id` member.
609    #[serde(default, skip_serializing_if = "Option::is_none")]
610    pub id: Option<i32>,
611    /// The `connectorId` member.
612    #[serde(rename = "connectorId")]
613    #[serde(default, skip_serializing_if = "Option::is_none")]
614    pub connector_id: Option<i32>,
615    /// The `chargingProfilePurpose` member.
616    #[serde(rename = "chargingProfilePurpose")]
617    #[serde(default, skip_serializing_if = "Option::is_none")]
618    pub charging_profile_purpose: Option<ChargingProfilePurpose>,
619    /// The `stackLevel` member.
620    #[serde(rename = "stackLevel")]
621    #[serde(default, skip_serializing_if = "Option::is_none")]
622    pub stack_level: Option<i32>,
623}
624
625impl ClearChargingProfileRequest {
626    /// Creates an empty `ClearChargingProfileRequest`. Every field of this type is optional.
627    #[must_use]
628    pub fn new() -> Self {
629        Self::default()
630    }
631
632    /// Sets the optional `id` field.
633    #[must_use]
634    pub fn with_id(mut self, value: i32) -> Self {
635        self.id = Some(value);
636        self
637    }
638
639    /// Sets the optional `connectorId` field.
640    #[must_use]
641    pub fn with_connector_id(mut self, value: i32) -> Self {
642        self.connector_id = Some(value);
643        self
644    }
645
646    /// Sets the optional `chargingProfilePurpose` field.
647    #[must_use]
648    pub fn with_charging_profile_purpose(mut self, value: ChargingProfilePurpose) -> Self {
649        self.charging_profile_purpose = Some(value);
650        self
651    }
652
653    /// Sets the optional `stackLevel` field.
654    #[must_use]
655    pub fn with_stack_level(mut self, value: i32) -> Self {
656        self.stack_level = Some(value);
657        self
658    }
659}
660
661impl Validate for ClearChargingProfileRequest {
662    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
663        path.push_key("chargingProfilePurpose");
664        if let Some(value) = &self.charging_profile_purpose {
665            Validate::validate_at(value, path, out);
666        }
667        path.pop();
668    }
669}
670
671impl Sealed for ClearChargingProfileRequest {}
672impl Request for ClearChargingProfileRequest {
673    type Action = Action;
674    const ACTION: Action = Action::ClearChargingProfile;
675    const KIND: MessageKind = MessageKind::Call;
676    const ORIGIN: Origin = Origin::Csms;
677    type Response = ClearChargingProfileResponse;
678}
679
680impl Confirmed for ClearChargingProfileRequest {}
681
682/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
683#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
684pub struct ClearChargingProfileResponse {
685    /// The `status` member.
686    pub status: ClearChargingProfileStatus,
687}
688
689impl ClearChargingProfileResponse {
690    /// Creates a `ClearChargingProfileResponse` from its required fields.
691    #[must_use]
692    pub fn new(status: ClearChargingProfileStatus) -> Self {
693        Self { status }
694    }
695}
696
697impl Validate for ClearChargingProfileResponse {
698    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
699        path.push_key("status");
700        Validate::validate_at(&self.status, path, out);
701        path.pop();
702    }
703}
704
705impl Sealed for ClearChargingProfileResponse {}
706impl Response for ClearChargingProfileResponse {}
707
708/// Spec: OCPP 1.6 · Core · either direction · CALL.
709#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
710pub struct DataTransferRequest {
711    /// The `vendorId` member.
712    #[serde(rename = "vendorId")]
713    pub vendor_id: String,
714    /// The `messageId` member.
715    #[serde(rename = "messageId")]
716    #[serde(default, skip_serializing_if = "Option::is_none")]
717    pub message_id: Option<String>,
718    /// The `data` member.
719    #[serde(default, skip_serializing_if = "Option::is_none")]
720    pub data: Option<String>,
721}
722
723impl DataTransferRequest {
724    /// Creates a `DataTransferRequest` from its required fields.
725    #[must_use]
726    pub fn new(vendor_id: impl Into<String>) -> Self {
727        Self {
728            vendor_id: vendor_id.into(),
729            message_id: None,
730            data: None,
731        }
732    }
733
734    /// Sets the optional `messageId` field.
735    #[must_use]
736    pub fn with_message_id(mut self, value: impl Into<String>) -> Self {
737        self.message_id = Some(value.into());
738        self
739    }
740
741    /// Sets the optional `data` field.
742    #[must_use]
743    pub fn with_data(mut self, value: impl Into<String>) -> Self {
744        self.data = Some(value.into());
745        self
746    }
747}
748
749impl Validate for DataTransferRequest {
750    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
751        path.push_key("vendorId");
752        validate::string(self.vendor_id.as_str(), None, Some(255), path, out);
753        path.pop();
754        path.push_key("messageId");
755        if let Some(value) = &self.message_id {
756            validate::string(value.as_str(), None, Some(50), path, out);
757        }
758        path.pop();
759    }
760}
761
762impl Sealed for DataTransferRequest {}
763impl Request for DataTransferRequest {
764    type Action = Action;
765    const ACTION: Action = Action::DataTransfer;
766    const KIND: MessageKind = MessageKind::Call;
767    const ORIGIN: Origin = Origin::Both;
768    type Response = DataTransferResponse;
769}
770
771impl Confirmed for DataTransferRequest {}
772
773/// Spec: OCPP 1.6 · Core · either direction · CALL.
774#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
775pub struct DataTransferResponse {
776    /// The `status` member.
777    pub status: DataTransferStatus,
778    /// The `data` member.
779    #[serde(default, skip_serializing_if = "Option::is_none")]
780    pub data: Option<String>,
781}
782
783impl DataTransferResponse {
784    /// Creates a `DataTransferResponse` from its required fields.
785    #[must_use]
786    pub fn new(status: DataTransferStatus) -> Self {
787        Self { status, data: None }
788    }
789
790    /// Sets the optional `data` field.
791    #[must_use]
792    pub fn with_data(mut self, value: impl Into<String>) -> Self {
793        self.data = Some(value.into());
794        self
795    }
796}
797
798impl Validate for DataTransferResponse {
799    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
800        path.push_key("status");
801        Validate::validate_at(&self.status, path, out);
802        path.pop();
803    }
804}
805
806impl Sealed for DataTransferResponse {}
807impl Response for DataTransferResponse {}
808
809/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
810#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
811pub struct DeleteCertificateRequest {
812    /// The `certificateHashData` member.
813    #[serde(rename = "certificateHashData")]
814    pub certificate_hash_data: CertificateHashData,
815}
816
817impl DeleteCertificateRequest {
818    /// Creates a `DeleteCertificateRequest` from its required fields.
819    #[must_use]
820    pub fn new(certificate_hash_data: CertificateHashData) -> Self {
821        Self {
822            certificate_hash_data,
823        }
824    }
825}
826
827impl Validate for DeleteCertificateRequest {
828    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
829        path.push_key("certificateHashData");
830        Validate::validate_at(&self.certificate_hash_data, path, out);
831        path.pop();
832    }
833}
834
835impl Sealed for DeleteCertificateRequest {}
836impl Request for DeleteCertificateRequest {
837    type Action = Action;
838    const ACTION: Action = Action::DeleteCertificate;
839    const KIND: MessageKind = MessageKind::Call;
840    const ORIGIN: Origin = Origin::Csms;
841    type Response = DeleteCertificateResponse;
842}
843
844impl Confirmed for DeleteCertificateRequest {}
845
846/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
847#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
848pub struct DeleteCertificateResponse {
849    /// The `status` member.
850    pub status: DeleteCertificateStatus,
851}
852
853impl DeleteCertificateResponse {
854    /// Creates a `DeleteCertificateResponse` from its required fields.
855    #[must_use]
856    pub fn new(status: DeleteCertificateStatus) -> Self {
857        Self { status }
858    }
859}
860
861impl Validate for DeleteCertificateResponse {
862    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
863        path.push_key("status");
864        Validate::validate_at(&self.status, path, out);
865        path.pop();
866    }
867}
868
869impl Sealed for DeleteCertificateResponse {}
870impl Response for DeleteCertificateResponse {}
871
872/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
873#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
874pub struct DiagnosticsStatusNotificationRequest {
875    /// The `status` member.
876    pub status: DiagnosticsStatus,
877}
878
879impl DiagnosticsStatusNotificationRequest {
880    /// Creates a `DiagnosticsStatusNotificationRequest` from its required fields.
881    #[must_use]
882    pub fn new(status: DiagnosticsStatus) -> Self {
883        Self { status }
884    }
885}
886
887impl Validate for DiagnosticsStatusNotificationRequest {
888    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
889        path.push_key("status");
890        Validate::validate_at(&self.status, path, out);
891        path.pop();
892    }
893}
894
895impl Sealed for DiagnosticsStatusNotificationRequest {}
896impl Request for DiagnosticsStatusNotificationRequest {
897    type Action = Action;
898    const ACTION: Action = Action::DiagnosticsStatusNotification;
899    const KIND: MessageKind = MessageKind::Call;
900    const ORIGIN: Origin = Origin::ChargingStation;
901    type Response = DiagnosticsStatusNotificationResponse;
902}
903
904impl Confirmed for DiagnosticsStatusNotificationRequest {}
905
906/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
907#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
908pub struct DiagnosticsStatusNotificationResponse {}
909
910impl DiagnosticsStatusNotificationResponse {
911    /// Creates an empty `DiagnosticsStatusNotificationResponse`. Every field of this type is optional.
912    #[must_use]
913    pub fn new() -> Self {
914        Self::default()
915    }
916}
917
918impl Validate for DiagnosticsStatusNotificationResponse {
919    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
920}
921
922impl Sealed for DiagnosticsStatusNotificationResponse {}
923impl Response for DiagnosticsStatusNotificationResponse {}
924
925/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
926#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
927pub struct ExtendedTriggerMessageRequest {
928    /// The `requestedMessage` member.
929    #[serde(rename = "requestedMessage")]
930    pub requested_message: ExtendedMessageTrigger,
931    /// The `connectorId` member.
932    #[serde(rename = "connectorId")]
933    #[serde(default, skip_serializing_if = "Option::is_none")]
934    #[serde(deserialize_with = "crate::types::integer::option")]
935    pub connector_id: Option<i32>,
936}
937
938impl ExtendedTriggerMessageRequest {
939    /// Creates a `ExtendedTriggerMessageRequest` from its required fields.
940    #[must_use]
941    pub fn new(requested_message: ExtendedMessageTrigger) -> Self {
942        Self {
943            requested_message,
944            connector_id: None,
945        }
946    }
947
948    /// Sets the optional `connectorId` field.
949    #[must_use]
950    pub fn with_connector_id(mut self, value: i32) -> Self {
951        self.connector_id = Some(value);
952        self
953    }
954}
955
956impl Validate for ExtendedTriggerMessageRequest {
957    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
958        path.push_key("requestedMessage");
959        Validate::validate_at(&self.requested_message, path, out);
960        path.pop();
961    }
962}
963
964impl Sealed for ExtendedTriggerMessageRequest {}
965impl Request for ExtendedTriggerMessageRequest {
966    type Action = Action;
967    const ACTION: Action = Action::ExtendedTriggerMessage;
968    const KIND: MessageKind = MessageKind::Call;
969    const ORIGIN: Origin = Origin::Csms;
970    type Response = ExtendedTriggerMessageResponse;
971}
972
973impl Confirmed for ExtendedTriggerMessageRequest {}
974
975/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
976#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
977pub struct ExtendedTriggerMessageResponse {
978    /// The `status` member.
979    pub status: TriggerMessageStatus,
980}
981
982impl ExtendedTriggerMessageResponse {
983    /// Creates a `ExtendedTriggerMessageResponse` from its required fields.
984    #[must_use]
985    pub fn new(status: TriggerMessageStatus) -> Self {
986        Self { status }
987    }
988}
989
990impl Validate for ExtendedTriggerMessageResponse {
991    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
992        path.push_key("status");
993        Validate::validate_at(&self.status, path, out);
994        path.pop();
995    }
996}
997
998impl Sealed for ExtendedTriggerMessageResponse {}
999impl Response for ExtendedTriggerMessageResponse {}
1000
1001/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
1002#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1003pub struct FirmwareStatusNotificationRequest {
1004    /// The `status` member.
1005    pub status: FirmwareStatus,
1006}
1007
1008impl FirmwareStatusNotificationRequest {
1009    /// Creates a `FirmwareStatusNotificationRequest` from its required fields.
1010    #[must_use]
1011    pub fn new(status: FirmwareStatus) -> Self {
1012        Self { status }
1013    }
1014}
1015
1016impl Validate for FirmwareStatusNotificationRequest {
1017    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1018        path.push_key("status");
1019        Validate::validate_at(&self.status, path, out);
1020        path.pop();
1021    }
1022}
1023
1024impl Sealed for FirmwareStatusNotificationRequest {}
1025impl Request for FirmwareStatusNotificationRequest {
1026    type Action = Action;
1027    const ACTION: Action = Action::FirmwareStatusNotification;
1028    const KIND: MessageKind = MessageKind::Call;
1029    const ORIGIN: Origin = Origin::ChargingStation;
1030    type Response = FirmwareStatusNotificationResponse;
1031}
1032
1033impl Confirmed for FirmwareStatusNotificationRequest {}
1034
1035/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
1036#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1037pub struct FirmwareStatusNotificationResponse {}
1038
1039impl FirmwareStatusNotificationResponse {
1040    /// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
1041    #[must_use]
1042    pub fn new() -> Self {
1043        Self::default()
1044    }
1045}
1046
1047impl Validate for FirmwareStatusNotificationResponse {
1048    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1049}
1050
1051impl Sealed for FirmwareStatusNotificationResponse {}
1052impl Response for FirmwareStatusNotificationResponse {}
1053
1054/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
1055#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1056pub struct GetCompositeScheduleRequest {
1057    /// The `connectorId` member.
1058    #[serde(rename = "connectorId")]
1059    pub connector_id: i32,
1060    /// The `duration` member.
1061    pub duration: i32,
1062    /// The `chargingRateUnit` member.
1063    #[serde(rename = "chargingRateUnit")]
1064    #[serde(default, skip_serializing_if = "Option::is_none")]
1065    pub charging_rate_unit: Option<ChargingRateUnit>,
1066}
1067
1068impl GetCompositeScheduleRequest {
1069    /// Creates a `GetCompositeScheduleRequest` from its required fields.
1070    #[must_use]
1071    pub fn new(connector_id: i32, duration: i32) -> Self {
1072        Self {
1073            connector_id,
1074            duration,
1075            charging_rate_unit: None,
1076        }
1077    }
1078
1079    /// Sets the optional `chargingRateUnit` field.
1080    #[must_use]
1081    pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
1082        self.charging_rate_unit = Some(value);
1083        self
1084    }
1085}
1086
1087impl Validate for GetCompositeScheduleRequest {
1088    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1089        path.push_key("chargingRateUnit");
1090        if let Some(value) = &self.charging_rate_unit {
1091            Validate::validate_at(value, path, out);
1092        }
1093        path.pop();
1094    }
1095}
1096
1097impl Sealed for GetCompositeScheduleRequest {}
1098impl Request for GetCompositeScheduleRequest {
1099    type Action = Action;
1100    const ACTION: Action = Action::GetCompositeSchedule;
1101    const KIND: MessageKind = MessageKind::Call;
1102    const ORIGIN: Origin = Origin::Csms;
1103    type Response = GetCompositeScheduleResponse;
1104}
1105
1106impl Confirmed for GetCompositeScheduleRequest {}
1107
1108/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
1109#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1110pub struct GetCompositeScheduleResponse {
1111    /// The `status` member.
1112    pub status: GetCompositeScheduleStatus,
1113    /// The `connectorId` member.
1114    #[serde(rename = "connectorId")]
1115    #[serde(default, skip_serializing_if = "Option::is_none")]
1116    pub connector_id: Option<i32>,
1117    /// The `scheduleStart` member.
1118    #[serde(rename = "scheduleStart")]
1119    #[serde(default, skip_serializing_if = "Option::is_none")]
1120    pub schedule_start: Option<crate::types::DateTime>,
1121    /// The `chargingSchedule` member.
1122    #[serde(rename = "chargingSchedule")]
1123    #[serde(default, skip_serializing_if = "Option::is_none")]
1124    pub charging_schedule: Option<ChargingSchedule>,
1125}
1126
1127impl GetCompositeScheduleResponse {
1128    /// Creates a `GetCompositeScheduleResponse` from its required fields.
1129    #[must_use]
1130    pub fn new(status: GetCompositeScheduleStatus) -> Self {
1131        Self {
1132            status,
1133            connector_id: None,
1134            schedule_start: None,
1135            charging_schedule: None,
1136        }
1137    }
1138
1139    /// Sets the optional `connectorId` field.
1140    #[must_use]
1141    pub fn with_connector_id(mut self, value: i32) -> Self {
1142        self.connector_id = Some(value);
1143        self
1144    }
1145
1146    /// Sets the optional `scheduleStart` field.
1147    #[must_use]
1148    pub fn with_schedule_start(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1149        self.schedule_start = Some(value.into());
1150        self
1151    }
1152
1153    /// Sets the optional `chargingSchedule` field.
1154    #[must_use]
1155    pub fn with_charging_schedule(mut self, value: ChargingSchedule) -> Self {
1156        self.charging_schedule = Some(value);
1157        self
1158    }
1159}
1160
1161impl Validate for GetCompositeScheduleResponse {
1162    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1163        path.push_key("status");
1164        Validate::validate_at(&self.status, path, out);
1165        path.pop();
1166        path.push_key("chargingSchedule");
1167        if let Some(value) = &self.charging_schedule {
1168            Validate::validate_at(value, path, out);
1169        }
1170        path.pop();
1171    }
1172}
1173
1174impl Sealed for GetCompositeScheduleResponse {}
1175impl Response for GetCompositeScheduleResponse {}
1176
1177/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1178#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1179pub struct GetConfigurationRequest {
1180    /// The `key` member.
1181    #[serde(default, skip_serializing_if = "Option::is_none")]
1182    pub key: Option<Vec<String>>,
1183}
1184
1185impl GetConfigurationRequest {
1186    /// Creates an empty `GetConfigurationRequest`. Every field of this type is optional.
1187    #[must_use]
1188    pub fn new() -> Self {
1189        Self::default()
1190    }
1191
1192    /// Sets the optional `key` field.
1193    #[must_use]
1194    pub fn with_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1195        self.key = Some(value.into_iter().map(Into::into).collect());
1196        self
1197    }
1198}
1199
1200impl Validate for GetConfigurationRequest {
1201    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1202        path.push_key("key");
1203        if let Some(value) = &self.key {
1204            for (index, item) in value.iter().enumerate() {
1205                path.push_index(index);
1206                validate::string(item.as_str(), None, Some(50), path, out);
1207                path.pop();
1208            }
1209        }
1210        path.pop();
1211    }
1212}
1213
1214impl Sealed for GetConfigurationRequest {}
1215impl Request for GetConfigurationRequest {
1216    type Action = Action;
1217    const ACTION: Action = Action::GetConfiguration;
1218    const KIND: MessageKind = MessageKind::Call;
1219    const ORIGIN: Origin = Origin::Csms;
1220    type Response = GetConfigurationResponse;
1221}
1222
1223impl Confirmed for GetConfigurationRequest {}
1224
1225/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1226#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1227pub struct GetConfigurationResponse {
1228    /// The `configurationKey` member.
1229    #[serde(rename = "configurationKey")]
1230    #[serde(default, skip_serializing_if = "Option::is_none")]
1231    pub configuration_key: Option<Vec<KeyValue>>,
1232    /// The `unknownKey` member.
1233    #[serde(rename = "unknownKey")]
1234    #[serde(default, skip_serializing_if = "Option::is_none")]
1235    pub unknown_key: Option<Vec<String>>,
1236}
1237
1238impl GetConfigurationResponse {
1239    /// Creates an empty `GetConfigurationResponse`. Every field of this type is optional.
1240    #[must_use]
1241    pub fn new() -> Self {
1242        Self::default()
1243    }
1244
1245    /// Sets the optional `configurationKey` field.
1246    #[must_use]
1247    pub fn with_configuration_key(mut self, value: Vec<KeyValue>) -> Self {
1248        self.configuration_key = Some(value);
1249        self
1250    }
1251
1252    /// Sets the optional `unknownKey` field.
1253    #[must_use]
1254    pub fn with_unknown_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1255        self.unknown_key = Some(value.into_iter().map(Into::into).collect());
1256        self
1257    }
1258}
1259
1260impl Validate for GetConfigurationResponse {
1261    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1262        path.push_key("configurationKey");
1263        if let Some(value) = &self.configuration_key {
1264            for (index, item) in value.iter().enumerate() {
1265                path.push_index(index);
1266                Validate::validate_at(item, path, out);
1267                path.pop();
1268            }
1269        }
1270        path.pop();
1271        path.push_key("unknownKey");
1272        if let Some(value) = &self.unknown_key {
1273            for (index, item) in value.iter().enumerate() {
1274                path.push_index(index);
1275                validate::string(item.as_str(), None, Some(50), path, out);
1276                path.pop();
1277            }
1278        }
1279        path.pop();
1280    }
1281}
1282
1283impl Sealed for GetConfigurationResponse {}
1284impl Response for GetConfigurationResponse {}
1285
1286/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
1287#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1288pub struct GetDiagnosticsRequest {
1289    /// The `location` member.
1290    pub location: String,
1291    /// The `retries` member.
1292    #[serde(default, skip_serializing_if = "Option::is_none")]
1293    pub retries: Option<i32>,
1294    /// The `retryInterval` member.
1295    #[serde(rename = "retryInterval")]
1296    #[serde(default, skip_serializing_if = "Option::is_none")]
1297    pub retry_interval: Option<i32>,
1298    /// The `startTime` member.
1299    #[serde(rename = "startTime")]
1300    #[serde(default, skip_serializing_if = "Option::is_none")]
1301    pub start_time: Option<crate::types::DateTime>,
1302    /// The `stopTime` member.
1303    #[serde(rename = "stopTime")]
1304    #[serde(default, skip_serializing_if = "Option::is_none")]
1305    pub stop_time: Option<crate::types::DateTime>,
1306}
1307
1308impl GetDiagnosticsRequest {
1309    /// Creates a `GetDiagnosticsRequest` from its required fields.
1310    #[must_use]
1311    pub fn new(location: impl Into<String>) -> Self {
1312        Self {
1313            location: location.into(),
1314            retries: None,
1315            retry_interval: None,
1316            start_time: None,
1317            stop_time: None,
1318        }
1319    }
1320
1321    /// Sets the optional `retries` field.
1322    #[must_use]
1323    pub fn with_retries(mut self, value: i32) -> Self {
1324        self.retries = Some(value);
1325        self
1326    }
1327
1328    /// Sets the optional `retryInterval` field.
1329    #[must_use]
1330    pub fn with_retry_interval(mut self, value: i32) -> Self {
1331        self.retry_interval = Some(value);
1332        self
1333    }
1334
1335    /// Sets the optional `startTime` field.
1336    #[must_use]
1337    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1338        self.start_time = Some(value.into());
1339        self
1340    }
1341
1342    /// Sets the optional `stopTime` field.
1343    #[must_use]
1344    pub fn with_stop_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1345        self.stop_time = Some(value.into());
1346        self
1347    }
1348}
1349
1350impl Validate for GetDiagnosticsRequest {
1351    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1352}
1353
1354impl Sealed for GetDiagnosticsRequest {}
1355impl Request for GetDiagnosticsRequest {
1356    type Action = Action;
1357    const ACTION: Action = Action::GetDiagnostics;
1358    const KIND: MessageKind = MessageKind::Call;
1359    const ORIGIN: Origin = Origin::Csms;
1360    type Response = GetDiagnosticsResponse;
1361}
1362
1363impl Confirmed for GetDiagnosticsRequest {}
1364
1365/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
1366#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1367pub struct GetDiagnosticsResponse {
1368    /// The `fileName` member.
1369    #[serde(rename = "fileName")]
1370    #[serde(default, skip_serializing_if = "Option::is_none")]
1371    pub file_name: Option<String>,
1372}
1373
1374impl GetDiagnosticsResponse {
1375    /// Creates an empty `GetDiagnosticsResponse`. Every field of this type is optional.
1376    #[must_use]
1377    pub fn new() -> Self {
1378        Self::default()
1379    }
1380
1381    /// Sets the optional `fileName` field.
1382    #[must_use]
1383    pub fn with_file_name(mut self, value: impl Into<String>) -> Self {
1384        self.file_name = Some(value.into());
1385        self
1386    }
1387}
1388
1389impl Validate for GetDiagnosticsResponse {
1390    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1391        path.push_key("fileName");
1392        if let Some(value) = &self.file_name {
1393            validate::string(value.as_str(), None, Some(255), path, out);
1394        }
1395        path.pop();
1396    }
1397}
1398
1399impl Sealed for GetDiagnosticsResponse {}
1400impl Response for GetDiagnosticsResponse {}
1401
1402/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1403#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1404pub struct GetInstalledCertificateIdsRequest {
1405    /// The `certificateType` member.
1406    #[serde(rename = "certificateType")]
1407    pub certificate_type: CertificateUse,
1408}
1409
1410impl GetInstalledCertificateIdsRequest {
1411    /// Creates a `GetInstalledCertificateIdsRequest` from its required fields.
1412    #[must_use]
1413    pub fn new(certificate_type: CertificateUse) -> Self {
1414        Self { certificate_type }
1415    }
1416}
1417
1418impl Validate for GetInstalledCertificateIdsRequest {
1419    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1420        path.push_key("certificateType");
1421        Validate::validate_at(&self.certificate_type, path, out);
1422        path.pop();
1423    }
1424}
1425
1426impl Sealed for GetInstalledCertificateIdsRequest {}
1427impl Request for GetInstalledCertificateIdsRequest {
1428    type Action = Action;
1429    const ACTION: Action = Action::GetInstalledCertificateIds;
1430    const KIND: MessageKind = MessageKind::Call;
1431    const ORIGIN: Origin = Origin::Csms;
1432    type Response = GetInstalledCertificateIdsResponse;
1433}
1434
1435impl Confirmed for GetInstalledCertificateIdsRequest {}
1436
1437/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1438#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1439pub struct GetInstalledCertificateIdsResponse {
1440    /// The `status` member.
1441    pub status: GetInstalledCertificateStatus,
1442    /// The `certificateHashData` member.
1443    #[serde(rename = "certificateHashData")]
1444    #[serde(default, skip_serializing_if = "Option::is_none")]
1445    pub certificate_hash_data: Option<Vec<CertificateHashData>>,
1446}
1447
1448impl GetInstalledCertificateIdsResponse {
1449    /// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
1450    #[must_use]
1451    pub fn new(status: GetInstalledCertificateStatus) -> Self {
1452        Self {
1453            status,
1454            certificate_hash_data: None,
1455        }
1456    }
1457
1458    /// Sets the optional `certificateHashData` field.
1459    #[must_use]
1460    pub fn with_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
1461        self.certificate_hash_data = Some(value);
1462        self
1463    }
1464}
1465
1466impl Validate for GetInstalledCertificateIdsResponse {
1467    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1468        path.push_key("status");
1469        Validate::validate_at(&self.status, path, out);
1470        path.pop();
1471        path.push_key("certificateHashData");
1472        if let Some(value) = &self.certificate_hash_data {
1473            validate::list_len(value.len(), Some(1), None, path, out);
1474            for (index, item) in value.iter().enumerate() {
1475                path.push_index(index);
1476                Validate::validate_at(item, path, out);
1477                path.pop();
1478            }
1479        }
1480        path.pop();
1481    }
1482}
1483
1484impl Sealed for GetInstalledCertificateIdsResponse {}
1485impl Response for GetInstalledCertificateIdsResponse {}
1486
1487/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
1488#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1489pub struct GetLocalListVersionRequest {}
1490
1491impl GetLocalListVersionRequest {
1492    /// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
1493    #[must_use]
1494    pub fn new() -> Self {
1495        Self::default()
1496    }
1497}
1498
1499impl Validate for GetLocalListVersionRequest {
1500    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1501}
1502
1503impl Sealed for GetLocalListVersionRequest {}
1504impl Request for GetLocalListVersionRequest {
1505    type Action = Action;
1506    const ACTION: Action = Action::GetLocalListVersion;
1507    const KIND: MessageKind = MessageKind::Call;
1508    const ORIGIN: Origin = Origin::Csms;
1509    type Response = GetLocalListVersionResponse;
1510}
1511
1512impl Confirmed for GetLocalListVersionRequest {}
1513
1514/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
1515#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1516pub struct GetLocalListVersionResponse {
1517    /// The `listVersion` member.
1518    #[serde(rename = "listVersion")]
1519    pub list_version: i32,
1520}
1521
1522impl GetLocalListVersionResponse {
1523    /// Creates a `GetLocalListVersionResponse` from its required fields.
1524    #[must_use]
1525    pub fn new(list_version: i32) -> Self {
1526        Self { list_version }
1527    }
1528}
1529
1530impl Validate for GetLocalListVersionResponse {
1531    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1532}
1533
1534impl Sealed for GetLocalListVersionResponse {}
1535impl Response for GetLocalListVersionResponse {}
1536
1537/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1538#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1539pub struct GetLogRequest {
1540    /// The `log` member.
1541    pub log: LogParameters,
1542    /// The `logType` member.
1543    #[serde(rename = "logType")]
1544    pub log_type: LogType,
1545    /// The `requestId` member.
1546    #[serde(rename = "requestId")]
1547    #[serde(deserialize_with = "crate::types::integer::one")]
1548    pub request_id: i32,
1549    /// The `retries` member.
1550    #[serde(default, skip_serializing_if = "Option::is_none")]
1551    #[serde(deserialize_with = "crate::types::integer::option")]
1552    pub retries: Option<i32>,
1553    /// The `retryInterval` member.
1554    #[serde(rename = "retryInterval")]
1555    #[serde(default, skip_serializing_if = "Option::is_none")]
1556    #[serde(deserialize_with = "crate::types::integer::option")]
1557    pub retry_interval: Option<i32>,
1558}
1559
1560impl GetLogRequest {
1561    /// Creates a `GetLogRequest` from its required fields.
1562    #[must_use]
1563    pub fn new(log: LogParameters, log_type: LogType, request_id: i32) -> Self {
1564        Self {
1565            log,
1566            log_type,
1567            request_id,
1568            retries: None,
1569            retry_interval: None,
1570        }
1571    }
1572
1573    /// Sets the optional `retries` field.
1574    #[must_use]
1575    pub fn with_retries(mut self, value: i32) -> Self {
1576        self.retries = Some(value);
1577        self
1578    }
1579
1580    /// Sets the optional `retryInterval` field.
1581    #[must_use]
1582    pub fn with_retry_interval(mut self, value: i32) -> Self {
1583        self.retry_interval = Some(value);
1584        self
1585    }
1586}
1587
1588impl Validate for GetLogRequest {
1589    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1590        path.push_key("log");
1591        Validate::validate_at(&self.log, path, out);
1592        path.pop();
1593        path.push_key("logType");
1594        Validate::validate_at(&self.log_type, path, out);
1595        path.pop();
1596    }
1597}
1598
1599impl Sealed for GetLogRequest {}
1600impl Request for GetLogRequest {
1601    type Action = Action;
1602    const ACTION: Action = Action::GetLog;
1603    const KIND: MessageKind = MessageKind::Call;
1604    const ORIGIN: Origin = Origin::Csms;
1605    type Response = GetLogResponse;
1606}
1607
1608impl Confirmed for GetLogRequest {}
1609
1610/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1611#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1612pub struct GetLogResponse {
1613    /// The `status` member.
1614    pub status: LogStatus,
1615    /// The `filename` member.
1616    #[serde(default, skip_serializing_if = "Option::is_none")]
1617    pub filename: Option<String>,
1618}
1619
1620impl GetLogResponse {
1621    /// Creates a `GetLogResponse` from its required fields.
1622    #[must_use]
1623    pub fn new(status: LogStatus) -> Self {
1624        Self {
1625            status,
1626            filename: None,
1627        }
1628    }
1629
1630    /// Sets the optional `filename` field.
1631    #[must_use]
1632    pub fn with_filename(mut self, value: impl Into<String>) -> Self {
1633        self.filename = Some(value.into());
1634        self
1635    }
1636}
1637
1638impl Validate for GetLogResponse {
1639    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1640        path.push_key("status");
1641        Validate::validate_at(&self.status, path, out);
1642        path.pop();
1643        path.push_key("filename");
1644        if let Some(value) = &self.filename {
1645            validate::string(value.as_str(), None, Some(255), path, out);
1646        }
1647        path.pop();
1648    }
1649}
1650
1651impl Sealed for GetLogResponse {}
1652impl Response for GetLogResponse {}
1653
1654/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1655#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1656pub struct HeartbeatRequest {}
1657
1658impl HeartbeatRequest {
1659    /// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
1660    #[must_use]
1661    pub fn new() -> Self {
1662        Self::default()
1663    }
1664}
1665
1666impl Validate for HeartbeatRequest {
1667    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1668}
1669
1670impl Sealed for HeartbeatRequest {}
1671impl Request for HeartbeatRequest {
1672    type Action = Action;
1673    const ACTION: Action = Action::Heartbeat;
1674    const KIND: MessageKind = MessageKind::Call;
1675    const ORIGIN: Origin = Origin::ChargingStation;
1676    type Response = HeartbeatResponse;
1677}
1678
1679impl Confirmed for HeartbeatRequest {}
1680
1681/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1682#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1683pub struct HeartbeatResponse {
1684    /// The `currentTime` member.
1685    #[serde(rename = "currentTime")]
1686    pub current_time: crate::types::DateTime,
1687}
1688
1689impl HeartbeatResponse {
1690    /// Creates a `HeartbeatResponse` from its required fields.
1691    #[must_use]
1692    pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
1693        Self {
1694            current_time: current_time.into(),
1695        }
1696    }
1697}
1698
1699impl Validate for HeartbeatResponse {
1700    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1701}
1702
1703impl Sealed for HeartbeatResponse {}
1704impl Response for HeartbeatResponse {}
1705
1706/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1707#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1708pub struct InstallCertificateRequest {
1709    /// The `certificateType` member.
1710    #[serde(rename = "certificateType")]
1711    pub certificate_type: CertificateUse,
1712    /// The `certificate` member.
1713    pub certificate: String,
1714}
1715
1716impl InstallCertificateRequest {
1717    /// Creates a `InstallCertificateRequest` from its required fields.
1718    #[must_use]
1719    pub fn new(certificate_type: CertificateUse, certificate: impl Into<String>) -> Self {
1720        Self {
1721            certificate_type,
1722            certificate: certificate.into(),
1723        }
1724    }
1725}
1726
1727impl Validate for InstallCertificateRequest {
1728    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1729        path.push_key("certificateType");
1730        Validate::validate_at(&self.certificate_type, path, out);
1731        path.pop();
1732        path.push_key("certificate");
1733        validate::string(self.certificate.as_str(), None, Some(5500), path, out);
1734        path.pop();
1735    }
1736}
1737
1738impl Sealed for InstallCertificateRequest {}
1739impl Request for InstallCertificateRequest {
1740    type Action = Action;
1741    const ACTION: Action = Action::InstallCertificate;
1742    const KIND: MessageKind = MessageKind::Call;
1743    const ORIGIN: Origin = Origin::Csms;
1744    type Response = InstallCertificateResponse;
1745}
1746
1747impl Confirmed for InstallCertificateRequest {}
1748
1749/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1750#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1751pub struct InstallCertificateResponse {
1752    /// The `status` member.
1753    pub status: InstallCertificateStatus,
1754}
1755
1756impl InstallCertificateResponse {
1757    /// Creates a `InstallCertificateResponse` from its required fields.
1758    #[must_use]
1759    pub fn new(status: InstallCertificateStatus) -> Self {
1760        Self { status }
1761    }
1762}
1763
1764impl Validate for InstallCertificateResponse {
1765    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1766        path.push_key("status");
1767        Validate::validate_at(&self.status, path, out);
1768        path.pop();
1769    }
1770}
1771
1772impl Sealed for InstallCertificateResponse {}
1773impl Response for InstallCertificateResponse {}
1774
1775/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
1776#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1777pub struct LogStatusNotificationRequest {
1778    /// The `status` member.
1779    pub status: UploadLogStatus,
1780    /// The `requestId` member.
1781    #[serde(rename = "requestId")]
1782    #[serde(default, skip_serializing_if = "Option::is_none")]
1783    #[serde(deserialize_with = "crate::types::integer::option")]
1784    pub request_id: Option<i32>,
1785}
1786
1787impl LogStatusNotificationRequest {
1788    /// Creates a `LogStatusNotificationRequest` from its required fields.
1789    #[must_use]
1790    pub fn new(status: UploadLogStatus) -> Self {
1791        Self {
1792            status,
1793            request_id: None,
1794        }
1795    }
1796
1797    /// Sets the optional `requestId` field.
1798    #[must_use]
1799    pub fn with_request_id(mut self, value: i32) -> Self {
1800        self.request_id = Some(value);
1801        self
1802    }
1803}
1804
1805impl Validate for LogStatusNotificationRequest {
1806    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1807        path.push_key("status");
1808        Validate::validate_at(&self.status, path, out);
1809        path.pop();
1810    }
1811}
1812
1813impl Sealed for LogStatusNotificationRequest {}
1814impl Request for LogStatusNotificationRequest {
1815    type Action = Action;
1816    const ACTION: Action = Action::LogStatusNotification;
1817    const KIND: MessageKind = MessageKind::Call;
1818    const ORIGIN: Origin = Origin::ChargingStation;
1819    type Response = LogStatusNotificationResponse;
1820}
1821
1822impl Confirmed for LogStatusNotificationRequest {}
1823
1824/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
1825#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1826pub struct LogStatusNotificationResponse {}
1827
1828impl LogStatusNotificationResponse {
1829    /// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
1830    #[must_use]
1831    pub fn new() -> Self {
1832        Self::default()
1833    }
1834}
1835
1836impl Validate for LogStatusNotificationResponse {
1837    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1838}
1839
1840impl Sealed for LogStatusNotificationResponse {}
1841impl Response for LogStatusNotificationResponse {}
1842
1843/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1845pub struct MeterValuesRequest {
1846    /// The `connectorId` member.
1847    #[serde(rename = "connectorId")]
1848    pub connector_id: i32,
1849    /// The `meterValue` member.
1850    #[serde(rename = "meterValue")]
1851    pub meter_value: Vec<MeterValue>,
1852    /// The `transactionId` member.
1853    #[serde(rename = "transactionId")]
1854    #[serde(default, skip_serializing_if = "Option::is_none")]
1855    pub transaction_id: Option<i32>,
1856}
1857
1858impl MeterValuesRequest {
1859    /// Creates a `MeterValuesRequest` from its required fields.
1860    #[must_use]
1861    pub fn new(connector_id: i32, meter_value: Vec<MeterValue>) -> Self {
1862        Self {
1863            connector_id,
1864            meter_value,
1865            transaction_id: None,
1866        }
1867    }
1868
1869    /// Sets the optional `transactionId` field.
1870    #[must_use]
1871    pub fn with_transaction_id(mut self, value: i32) -> Self {
1872        self.transaction_id = Some(value);
1873        self
1874    }
1875}
1876
1877impl Validate for MeterValuesRequest {
1878    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1879        path.push_key("meterValue");
1880        validate::list_len(self.meter_value.len(), Some(1), None, path, out);
1881        for (index, item) in self.meter_value.iter().enumerate() {
1882            path.push_index(index);
1883            Validate::validate_at(item, path, out);
1884            path.pop();
1885        }
1886        path.pop();
1887    }
1888}
1889
1890impl Sealed for MeterValuesRequest {}
1891impl Request for MeterValuesRequest {
1892    type Action = Action;
1893    const ACTION: Action = Action::MeterValues;
1894    const KIND: MessageKind = MessageKind::Call;
1895    const ORIGIN: Origin = Origin::ChargingStation;
1896    type Response = MeterValuesResponse;
1897}
1898
1899impl Confirmed for MeterValuesRequest {}
1900
1901/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1902#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1903pub struct MeterValuesResponse {}
1904
1905impl MeterValuesResponse {
1906    /// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
1907    #[must_use]
1908    pub fn new() -> Self {
1909        Self::default()
1910    }
1911}
1912
1913impl Validate for MeterValuesResponse {
1914    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1915}
1916
1917impl Sealed for MeterValuesResponse {}
1918impl Response for MeterValuesResponse {}
1919
1920/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1921#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1922pub struct RemoteStartTransactionRequest {
1923    /// The `idTag` member.
1924    #[serde(rename = "idTag")]
1925    pub id_tag: String,
1926    /// The `connectorId` member.
1927    #[serde(rename = "connectorId")]
1928    #[serde(default, skip_serializing_if = "Option::is_none")]
1929    pub connector_id: Option<i32>,
1930    /// The `chargingProfile` member.
1931    #[serde(rename = "chargingProfile")]
1932    #[serde(default, skip_serializing_if = "Option::is_none")]
1933    pub charging_profile: Option<ChargingProfile>,
1934}
1935
1936impl RemoteStartTransactionRequest {
1937    /// Creates a `RemoteStartTransactionRequest` from its required fields.
1938    #[must_use]
1939    pub fn new(id_tag: impl Into<String>) -> Self {
1940        Self {
1941            id_tag: id_tag.into(),
1942            connector_id: None,
1943            charging_profile: None,
1944        }
1945    }
1946
1947    /// Sets the optional `connectorId` field.
1948    #[must_use]
1949    pub fn with_connector_id(mut self, value: i32) -> Self {
1950        self.connector_id = Some(value);
1951        self
1952    }
1953
1954    /// Sets the optional `chargingProfile` field.
1955    #[must_use]
1956    pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
1957        self.charging_profile = Some(value);
1958        self
1959    }
1960}
1961
1962impl Validate for RemoteStartTransactionRequest {
1963    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1964        path.push_key("idTag");
1965        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
1966        path.pop();
1967        path.push_key("chargingProfile");
1968        if let Some(value) = &self.charging_profile {
1969            Validate::validate_at(value, path, out);
1970        }
1971        path.pop();
1972    }
1973}
1974
1975impl Sealed for RemoteStartTransactionRequest {}
1976impl Request for RemoteStartTransactionRequest {
1977    type Action = Action;
1978    const ACTION: Action = Action::RemoteStartTransaction;
1979    const KIND: MessageKind = MessageKind::Call;
1980    const ORIGIN: Origin = Origin::Csms;
1981    type Response = RemoteStartTransactionResponse;
1982}
1983
1984impl Confirmed for RemoteStartTransactionRequest {}
1985
1986/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1987#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1988pub struct RemoteStartTransactionResponse {
1989    /// The `status` member.
1990    pub status: RemoteStartStopStatus,
1991}
1992
1993impl RemoteStartTransactionResponse {
1994    /// Creates a `RemoteStartTransactionResponse` from its required fields.
1995    #[must_use]
1996    pub fn new(status: RemoteStartStopStatus) -> Self {
1997        Self { status }
1998    }
1999}
2000
2001impl Validate for RemoteStartTransactionResponse {
2002    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2003        path.push_key("status");
2004        Validate::validate_at(&self.status, path, out);
2005        path.pop();
2006    }
2007}
2008
2009impl Sealed for RemoteStartTransactionResponse {}
2010impl Response for RemoteStartTransactionResponse {}
2011
2012/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2013#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2014pub struct RemoteStopTransactionRequest {
2015    /// The `transactionId` member.
2016    #[serde(rename = "transactionId")]
2017    pub transaction_id: i32,
2018}
2019
2020impl RemoteStopTransactionRequest {
2021    /// Creates a `RemoteStopTransactionRequest` from its required fields.
2022    #[must_use]
2023    pub fn new(transaction_id: i32) -> Self {
2024        Self { transaction_id }
2025    }
2026}
2027
2028impl Validate for RemoteStopTransactionRequest {
2029    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2030}
2031
2032impl Sealed for RemoteStopTransactionRequest {}
2033impl Request for RemoteStopTransactionRequest {
2034    type Action = Action;
2035    const ACTION: Action = Action::RemoteStopTransaction;
2036    const KIND: MessageKind = MessageKind::Call;
2037    const ORIGIN: Origin = Origin::Csms;
2038    type Response = RemoteStopTransactionResponse;
2039}
2040
2041impl Confirmed for RemoteStopTransactionRequest {}
2042
2043/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2044#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2045pub struct RemoteStopTransactionResponse {
2046    /// The `status` member.
2047    pub status: RemoteStartStopStatus,
2048}
2049
2050impl RemoteStopTransactionResponse {
2051    /// Creates a `RemoteStopTransactionResponse` from its required fields.
2052    #[must_use]
2053    pub fn new(status: RemoteStartStopStatus) -> Self {
2054        Self { status }
2055    }
2056}
2057
2058impl Validate for RemoteStopTransactionResponse {
2059    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2060        path.push_key("status");
2061        Validate::validate_at(&self.status, path, out);
2062        path.pop();
2063    }
2064}
2065
2066impl Sealed for RemoteStopTransactionResponse {}
2067impl Response for RemoteStopTransactionResponse {}
2068
2069/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
2070#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2071pub struct ReserveNowRequest {
2072    /// The `connectorId` member.
2073    #[serde(rename = "connectorId")]
2074    pub connector_id: i32,
2075    /// The `expiryDate` member.
2076    #[serde(rename = "expiryDate")]
2077    pub expiry_date: crate::types::DateTime,
2078    /// The `idTag` member.
2079    #[serde(rename = "idTag")]
2080    pub id_tag: String,
2081    /// The `reservationId` member.
2082    #[serde(rename = "reservationId")]
2083    pub reservation_id: i32,
2084    /// The `parentIdTag` member.
2085    #[serde(rename = "parentIdTag")]
2086    #[serde(default, skip_serializing_if = "Option::is_none")]
2087    pub parent_id_tag: Option<String>,
2088}
2089
2090impl ReserveNowRequest {
2091    /// Creates a `ReserveNowRequest` from its required fields.
2092    #[must_use]
2093    pub fn new(
2094        connector_id: i32,
2095        expiry_date: impl Into<crate::types::DateTime>,
2096        id_tag: impl Into<String>,
2097        reservation_id: i32,
2098    ) -> Self {
2099        Self {
2100            connector_id,
2101            expiry_date: expiry_date.into(),
2102            id_tag: id_tag.into(),
2103            reservation_id,
2104            parent_id_tag: None,
2105        }
2106    }
2107
2108    /// Sets the optional `parentIdTag` field.
2109    #[must_use]
2110    pub fn with_parent_id_tag(mut self, value: impl Into<String>) -> Self {
2111        self.parent_id_tag = Some(value.into());
2112        self
2113    }
2114}
2115
2116impl Validate for ReserveNowRequest {
2117    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2118        path.push_key("idTag");
2119        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
2120        path.pop();
2121        path.push_key("parentIdTag");
2122        if let Some(value) = &self.parent_id_tag {
2123            validate::string(value.as_str(), None, Some(20), path, out);
2124        }
2125        path.pop();
2126    }
2127}
2128
2129impl Sealed for ReserveNowRequest {}
2130impl Request for ReserveNowRequest {
2131    type Action = Action;
2132    const ACTION: Action = Action::ReserveNow;
2133    const KIND: MessageKind = MessageKind::Call;
2134    const ORIGIN: Origin = Origin::Csms;
2135    type Response = ReserveNowResponse;
2136}
2137
2138impl Confirmed for ReserveNowRequest {}
2139
2140/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
2141#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2142pub struct ReserveNowResponse {
2143    /// The `status` member.
2144    pub status: ReservationStatus,
2145}
2146
2147impl ReserveNowResponse {
2148    /// Creates a `ReserveNowResponse` from its required fields.
2149    #[must_use]
2150    pub fn new(status: ReservationStatus) -> Self {
2151        Self { status }
2152    }
2153}
2154
2155impl Validate for ReserveNowResponse {
2156    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2157        path.push_key("status");
2158        Validate::validate_at(&self.status, path, out);
2159        path.pop();
2160    }
2161}
2162
2163impl Sealed for ReserveNowResponse {}
2164impl Response for ReserveNowResponse {}
2165
2166/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2167#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2168pub struct ResetRequest {
2169    /// The `type` member.
2170    pub r#type: ResetType,
2171}
2172
2173impl ResetRequest {
2174    /// Creates a `ResetRequest` from its required fields.
2175    #[must_use]
2176    pub fn new(r#type: ResetType) -> Self {
2177        Self { r#type }
2178    }
2179}
2180
2181impl Validate for ResetRequest {
2182    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2183        path.push_key("type");
2184        Validate::validate_at(&self.r#type, path, out);
2185        path.pop();
2186    }
2187}
2188
2189impl Sealed for ResetRequest {}
2190impl Request for ResetRequest {
2191    type Action = Action;
2192    const ACTION: Action = Action::Reset;
2193    const KIND: MessageKind = MessageKind::Call;
2194    const ORIGIN: Origin = Origin::Csms;
2195    type Response = ResetResponse;
2196}
2197
2198impl Confirmed for ResetRequest {}
2199
2200/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2201#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2202pub struct ResetResponse {
2203    /// The `status` member.
2204    pub status: ResetStatus,
2205}
2206
2207impl ResetResponse {
2208    /// Creates a `ResetResponse` from its required fields.
2209    #[must_use]
2210    pub fn new(status: ResetStatus) -> Self {
2211        Self { status }
2212    }
2213}
2214
2215impl Validate for ResetResponse {
2216    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2217        path.push_key("status");
2218        Validate::validate_at(&self.status, path, out);
2219        path.pop();
2220    }
2221}
2222
2223impl Sealed for ResetResponse {}
2224impl Response for ResetResponse {}
2225
2226/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2227#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2228pub struct SecurityEventNotificationRequest {
2229    /// The `type` member.
2230    pub r#type: String,
2231    /// The `timestamp` member.
2232    pub timestamp: crate::types::DateTime,
2233    /// The `techInfo` member.
2234    #[serde(rename = "techInfo")]
2235    #[serde(default, skip_serializing_if = "Option::is_none")]
2236    pub tech_info: Option<String>,
2237}
2238
2239impl SecurityEventNotificationRequest {
2240    /// Creates a `SecurityEventNotificationRequest` from its required fields.
2241    #[must_use]
2242    pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
2243        Self {
2244            r#type: r#type.into(),
2245            timestamp: timestamp.into(),
2246            tech_info: None,
2247        }
2248    }
2249
2250    /// Sets the optional `techInfo` field.
2251    #[must_use]
2252    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
2253        self.tech_info = Some(value.into());
2254        self
2255    }
2256}
2257
2258impl Validate for SecurityEventNotificationRequest {
2259    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2260        path.push_key("type");
2261        validate::string(self.r#type.as_str(), None, Some(50), path, out);
2262        path.pop();
2263        path.push_key("techInfo");
2264        if let Some(value) = &self.tech_info {
2265            validate::string(value.as_str(), None, Some(255), path, out);
2266        }
2267        path.pop();
2268    }
2269}
2270
2271impl Sealed for SecurityEventNotificationRequest {}
2272impl Request for SecurityEventNotificationRequest {
2273    type Action = Action;
2274    const ACTION: Action = Action::SecurityEventNotification;
2275    const KIND: MessageKind = MessageKind::Call;
2276    const ORIGIN: Origin = Origin::ChargingStation;
2277    type Response = SecurityEventNotificationResponse;
2278}
2279
2280impl Confirmed for SecurityEventNotificationRequest {}
2281
2282/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2283#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2284pub struct SecurityEventNotificationResponse {}
2285
2286impl SecurityEventNotificationResponse {
2287    /// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
2288    #[must_use]
2289    pub fn new() -> Self {
2290        Self::default()
2291    }
2292}
2293
2294impl Validate for SecurityEventNotificationResponse {
2295    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2296}
2297
2298impl Sealed for SecurityEventNotificationResponse {}
2299impl Response for SecurityEventNotificationResponse {}
2300
2301/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
2302#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2303pub struct SendLocalListRequest {
2304    /// The `listVersion` member.
2305    #[serde(rename = "listVersion")]
2306    pub list_version: i32,
2307    /// The `updateType` member.
2308    #[serde(rename = "updateType")]
2309    pub update_type: UpdateType,
2310    /// The `localAuthorizationList` member.
2311    #[serde(rename = "localAuthorizationList")]
2312    #[serde(default, skip_serializing_if = "Option::is_none")]
2313    pub local_authorization_list: Option<Vec<AuthorizationData>>,
2314}
2315
2316impl SendLocalListRequest {
2317    /// Creates a `SendLocalListRequest` from its required fields.
2318    #[must_use]
2319    pub fn new(list_version: i32, update_type: UpdateType) -> Self {
2320        Self {
2321            list_version,
2322            update_type,
2323            local_authorization_list: None,
2324        }
2325    }
2326
2327    /// Sets the optional `localAuthorizationList` field.
2328    #[must_use]
2329    pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
2330        self.local_authorization_list = Some(value);
2331        self
2332    }
2333}
2334
2335impl Validate for SendLocalListRequest {
2336    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2337        path.push_key("updateType");
2338        Validate::validate_at(&self.update_type, path, out);
2339        path.pop();
2340        path.push_key("localAuthorizationList");
2341        if let Some(value) = &self.local_authorization_list {
2342            for (index, item) in value.iter().enumerate() {
2343                path.push_index(index);
2344                Validate::validate_at(item, path, out);
2345                path.pop();
2346            }
2347        }
2348        path.pop();
2349    }
2350}
2351
2352impl Sealed for SendLocalListRequest {}
2353impl Request for SendLocalListRequest {
2354    type Action = Action;
2355    const ACTION: Action = Action::SendLocalList;
2356    const KIND: MessageKind = MessageKind::Call;
2357    const ORIGIN: Origin = Origin::Csms;
2358    type Response = SendLocalListResponse;
2359}
2360
2361impl Confirmed for SendLocalListRequest {}
2362
2363/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
2364#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2365pub struct SendLocalListResponse {
2366    /// The `status` member.
2367    pub status: UpdateStatus,
2368}
2369
2370impl SendLocalListResponse {
2371    /// Creates a `SendLocalListResponse` from its required fields.
2372    #[must_use]
2373    pub fn new(status: UpdateStatus) -> Self {
2374        Self { status }
2375    }
2376}
2377
2378impl Validate for SendLocalListResponse {
2379    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2380        path.push_key("status");
2381        Validate::validate_at(&self.status, path, out);
2382        path.pop();
2383    }
2384}
2385
2386impl Sealed for SendLocalListResponse {}
2387impl Response for SendLocalListResponse {}
2388
2389/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
2390#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2391pub struct SetChargingProfileRequest {
2392    /// The `connectorId` member.
2393    #[serde(rename = "connectorId")]
2394    pub connector_id: i32,
2395    /// The `csChargingProfiles` member.
2396    #[serde(rename = "csChargingProfiles")]
2397    pub cs_charging_profiles: ChargingProfile,
2398}
2399
2400impl SetChargingProfileRequest {
2401    /// Creates a `SetChargingProfileRequest` from its required fields.
2402    #[must_use]
2403    pub fn new(connector_id: i32, cs_charging_profiles: ChargingProfile) -> Self {
2404        Self {
2405            connector_id,
2406            cs_charging_profiles,
2407        }
2408    }
2409}
2410
2411impl Validate for SetChargingProfileRequest {
2412    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2413        path.push_key("csChargingProfiles");
2414        Validate::validate_at(&self.cs_charging_profiles, path, out);
2415        path.pop();
2416    }
2417}
2418
2419impl Sealed for SetChargingProfileRequest {}
2420impl Request for SetChargingProfileRequest {
2421    type Action = Action;
2422    const ACTION: Action = Action::SetChargingProfile;
2423    const KIND: MessageKind = MessageKind::Call;
2424    const ORIGIN: Origin = Origin::Csms;
2425    type Response = SetChargingProfileResponse;
2426}
2427
2428impl Confirmed for SetChargingProfileRequest {}
2429
2430/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
2431#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2432pub struct SetChargingProfileResponse {
2433    /// The `status` member.
2434    pub status: ChargingProfileStatus,
2435}
2436
2437impl SetChargingProfileResponse {
2438    /// Creates a `SetChargingProfileResponse` from its required fields.
2439    #[must_use]
2440    pub fn new(status: ChargingProfileStatus) -> Self {
2441        Self { status }
2442    }
2443}
2444
2445impl Validate for SetChargingProfileResponse {
2446    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2447        path.push_key("status");
2448        Validate::validate_at(&self.status, path, out);
2449        path.pop();
2450    }
2451}
2452
2453impl Sealed for SetChargingProfileResponse {}
2454impl Response for SetChargingProfileResponse {}
2455
2456/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2457#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2458pub struct SignCertificateRequest {
2459    /// The `csr` member.
2460    pub csr: String,
2461}
2462
2463impl SignCertificateRequest {
2464    /// Creates a `SignCertificateRequest` from its required fields.
2465    #[must_use]
2466    pub fn new(csr: impl Into<String>) -> Self {
2467        Self { csr: csr.into() }
2468    }
2469}
2470
2471impl Validate for SignCertificateRequest {
2472    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2473        path.push_key("csr");
2474        validate::string(self.csr.as_str(), None, Some(5500), path, out);
2475        path.pop();
2476    }
2477}
2478
2479impl Sealed for SignCertificateRequest {}
2480impl Request for SignCertificateRequest {
2481    type Action = Action;
2482    const ACTION: Action = Action::SignCertificate;
2483    const KIND: MessageKind = MessageKind::Call;
2484    const ORIGIN: Origin = Origin::ChargingStation;
2485    type Response = SignCertificateResponse;
2486}
2487
2488impl Confirmed for SignCertificateRequest {}
2489
2490/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2491#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2492pub struct SignCertificateResponse {
2493    /// The `status` member.
2494    pub status: GenericStatus,
2495}
2496
2497impl SignCertificateResponse {
2498    /// Creates a `SignCertificateResponse` from its required fields.
2499    #[must_use]
2500    pub fn new(status: GenericStatus) -> Self {
2501        Self { status }
2502    }
2503}
2504
2505impl Validate for SignCertificateResponse {
2506    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2507        path.push_key("status");
2508        Validate::validate_at(&self.status, path, out);
2509        path.pop();
2510    }
2511}
2512
2513impl Sealed for SignCertificateResponse {}
2514impl Response for SignCertificateResponse {}
2515
2516/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2517#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2518pub struct SignedFirmwareStatusNotificationRequest {
2519    /// The `status` member.
2520    pub status: SignedFirmwareStatus,
2521    /// The `requestId` member.
2522    #[serde(rename = "requestId")]
2523    #[serde(default, skip_serializing_if = "Option::is_none")]
2524    #[serde(deserialize_with = "crate::types::integer::option")]
2525    pub request_id: Option<i32>,
2526}
2527
2528impl SignedFirmwareStatusNotificationRequest {
2529    /// Creates a `SignedFirmwareStatusNotificationRequest` from its required fields.
2530    #[must_use]
2531    pub fn new(status: SignedFirmwareStatus) -> Self {
2532        Self {
2533            status,
2534            request_id: None,
2535        }
2536    }
2537
2538    /// Sets the optional `requestId` field.
2539    #[must_use]
2540    pub fn with_request_id(mut self, value: i32) -> Self {
2541        self.request_id = Some(value);
2542        self
2543    }
2544}
2545
2546impl Validate for SignedFirmwareStatusNotificationRequest {
2547    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2548        path.push_key("status");
2549        Validate::validate_at(&self.status, path, out);
2550        path.pop();
2551    }
2552}
2553
2554impl Sealed for SignedFirmwareStatusNotificationRequest {}
2555impl Request for SignedFirmwareStatusNotificationRequest {
2556    type Action = Action;
2557    const ACTION: Action = Action::SignedFirmwareStatusNotification;
2558    const KIND: MessageKind = MessageKind::Call;
2559    const ORIGIN: Origin = Origin::ChargingStation;
2560    type Response = SignedFirmwareStatusNotificationResponse;
2561}
2562
2563impl Confirmed for SignedFirmwareStatusNotificationRequest {}
2564
2565/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2566#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2567pub struct SignedFirmwareStatusNotificationResponse {}
2568
2569impl SignedFirmwareStatusNotificationResponse {
2570    /// Creates an empty `SignedFirmwareStatusNotificationResponse`. Every field of this type is optional.
2571    #[must_use]
2572    pub fn new() -> Self {
2573        Self::default()
2574    }
2575}
2576
2577impl Validate for SignedFirmwareStatusNotificationResponse {
2578    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2579}
2580
2581impl Sealed for SignedFirmwareStatusNotificationResponse {}
2582impl Response for SignedFirmwareStatusNotificationResponse {}
2583
2584/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
2585#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2586pub struct SignedUpdateFirmwareRequest {
2587    /// The `requestId` member.
2588    #[serde(rename = "requestId")]
2589    #[serde(deserialize_with = "crate::types::integer::one")]
2590    pub request_id: i32,
2591    /// The `firmware` member.
2592    pub firmware: Firmware,
2593    /// The `retries` member.
2594    #[serde(default, skip_serializing_if = "Option::is_none")]
2595    #[serde(deserialize_with = "crate::types::integer::option")]
2596    pub retries: Option<i32>,
2597    /// The `retryInterval` member.
2598    #[serde(rename = "retryInterval")]
2599    #[serde(default, skip_serializing_if = "Option::is_none")]
2600    #[serde(deserialize_with = "crate::types::integer::option")]
2601    pub retry_interval: Option<i32>,
2602}
2603
2604impl SignedUpdateFirmwareRequest {
2605    /// Creates a `SignedUpdateFirmwareRequest` from its required fields.
2606    #[must_use]
2607    pub fn new(request_id: i32, firmware: Firmware) -> Self {
2608        Self {
2609            request_id,
2610            firmware,
2611            retries: None,
2612            retry_interval: None,
2613        }
2614    }
2615
2616    /// Sets the optional `retries` field.
2617    #[must_use]
2618    pub fn with_retries(mut self, value: i32) -> Self {
2619        self.retries = Some(value);
2620        self
2621    }
2622
2623    /// Sets the optional `retryInterval` field.
2624    #[must_use]
2625    pub fn with_retry_interval(mut self, value: i32) -> Self {
2626        self.retry_interval = Some(value);
2627        self
2628    }
2629}
2630
2631impl Validate for SignedUpdateFirmwareRequest {
2632    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2633        path.push_key("firmware");
2634        Validate::validate_at(&self.firmware, path, out);
2635        path.pop();
2636    }
2637}
2638
2639impl Sealed for SignedUpdateFirmwareRequest {}
2640impl Request for SignedUpdateFirmwareRequest {
2641    type Action = Action;
2642    const ACTION: Action = Action::SignedUpdateFirmware;
2643    const KIND: MessageKind = MessageKind::Call;
2644    const ORIGIN: Origin = Origin::Csms;
2645    type Response = SignedUpdateFirmwareResponse;
2646}
2647
2648impl Confirmed for SignedUpdateFirmwareRequest {}
2649
2650/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
2651#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2652pub struct SignedUpdateFirmwareResponse {
2653    /// The `status` member.
2654    pub status: UpdateFirmwareStatus,
2655}
2656
2657impl SignedUpdateFirmwareResponse {
2658    /// Creates a `SignedUpdateFirmwareResponse` from its required fields.
2659    #[must_use]
2660    pub fn new(status: UpdateFirmwareStatus) -> Self {
2661        Self { status }
2662    }
2663}
2664
2665impl Validate for SignedUpdateFirmwareResponse {
2666    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2667        path.push_key("status");
2668        Validate::validate_at(&self.status, path, out);
2669        path.pop();
2670    }
2671}
2672
2673impl Sealed for SignedUpdateFirmwareResponse {}
2674impl Response for SignedUpdateFirmwareResponse {}
2675
2676/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2677#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2678pub struct StartTransactionRequest {
2679    /// The `connectorId` member.
2680    #[serde(rename = "connectorId")]
2681    pub connector_id: i32,
2682    /// The `idTag` member.
2683    #[serde(rename = "idTag")]
2684    pub id_tag: String,
2685    /// The `meterStart` member.
2686    #[serde(rename = "meterStart")]
2687    pub meter_start: i32,
2688    /// The `timestamp` member.
2689    pub timestamp: crate::types::DateTime,
2690    /// The `reservationId` member.
2691    #[serde(rename = "reservationId")]
2692    #[serde(default, skip_serializing_if = "Option::is_none")]
2693    pub reservation_id: Option<i32>,
2694}
2695
2696impl StartTransactionRequest {
2697    /// Creates a `StartTransactionRequest` from its required fields.
2698    #[must_use]
2699    pub fn new(
2700        connector_id: i32,
2701        id_tag: impl Into<String>,
2702        meter_start: i32,
2703        timestamp: impl Into<crate::types::DateTime>,
2704    ) -> Self {
2705        Self {
2706            connector_id,
2707            id_tag: id_tag.into(),
2708            meter_start,
2709            timestamp: timestamp.into(),
2710            reservation_id: None,
2711        }
2712    }
2713
2714    /// Sets the optional `reservationId` field.
2715    #[must_use]
2716    pub fn with_reservation_id(mut self, value: i32) -> Self {
2717        self.reservation_id = Some(value);
2718        self
2719    }
2720}
2721
2722impl Validate for StartTransactionRequest {
2723    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2724        path.push_key("idTag");
2725        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
2726        path.pop();
2727    }
2728}
2729
2730impl Sealed for StartTransactionRequest {}
2731impl Request for StartTransactionRequest {
2732    type Action = Action;
2733    const ACTION: Action = Action::StartTransaction;
2734    const KIND: MessageKind = MessageKind::Call;
2735    const ORIGIN: Origin = Origin::ChargingStation;
2736    type Response = StartTransactionResponse;
2737}
2738
2739impl Confirmed for StartTransactionRequest {}
2740
2741/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2742#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2743pub struct StartTransactionResponse {
2744    /// The `idTagInfo` member.
2745    #[serde(rename = "idTagInfo")]
2746    pub id_tag_info: IdTagInfo,
2747    /// The `transactionId` member.
2748    #[serde(rename = "transactionId")]
2749    pub transaction_id: i32,
2750}
2751
2752impl StartTransactionResponse {
2753    /// Creates a `StartTransactionResponse` from its required fields.
2754    #[must_use]
2755    pub fn new(id_tag_info: IdTagInfo, transaction_id: i32) -> Self {
2756        Self {
2757            id_tag_info,
2758            transaction_id,
2759        }
2760    }
2761}
2762
2763impl Validate for StartTransactionResponse {
2764    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2765        path.push_key("idTagInfo");
2766        Validate::validate_at(&self.id_tag_info, path, out);
2767        path.pop();
2768    }
2769}
2770
2771impl Sealed for StartTransactionResponse {}
2772impl Response for StartTransactionResponse {}
2773
2774/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2775#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2776pub struct StatusNotificationRequest {
2777    /// The `connectorId` member.
2778    #[serde(rename = "connectorId")]
2779    pub connector_id: i32,
2780    /// The `errorCode` member.
2781    #[serde(rename = "errorCode")]
2782    pub error_code: ChargePointErrorCode,
2783    /// The `status` member.
2784    pub status: ChargePointStatus,
2785    /// The `info` member.
2786    #[serde(default, skip_serializing_if = "Option::is_none")]
2787    pub info: Option<String>,
2788    /// The `timestamp` member.
2789    #[serde(default, skip_serializing_if = "Option::is_none")]
2790    pub timestamp: Option<crate::types::DateTime>,
2791    /// The `vendorId` member.
2792    #[serde(rename = "vendorId")]
2793    #[serde(default, skip_serializing_if = "Option::is_none")]
2794    pub vendor_id: Option<String>,
2795    /// The `vendorErrorCode` member.
2796    #[serde(rename = "vendorErrorCode")]
2797    #[serde(default, skip_serializing_if = "Option::is_none")]
2798    pub vendor_error_code: Option<String>,
2799}
2800
2801impl StatusNotificationRequest {
2802    /// Creates a `StatusNotificationRequest` from its required fields.
2803    #[must_use]
2804    pub fn new(
2805        connector_id: i32,
2806        error_code: ChargePointErrorCode,
2807        status: ChargePointStatus,
2808    ) -> Self {
2809        Self {
2810            connector_id,
2811            error_code,
2812            status,
2813            info: None,
2814            timestamp: None,
2815            vendor_id: None,
2816            vendor_error_code: None,
2817        }
2818    }
2819
2820    /// Sets the optional `info` field.
2821    #[must_use]
2822    pub fn with_info(mut self, value: impl Into<String>) -> Self {
2823        self.info = Some(value.into());
2824        self
2825    }
2826
2827    /// Sets the optional `timestamp` field.
2828    #[must_use]
2829    pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
2830        self.timestamp = Some(value.into());
2831        self
2832    }
2833
2834    /// Sets the optional `vendorId` field.
2835    #[must_use]
2836    pub fn with_vendor_id(mut self, value: impl Into<String>) -> Self {
2837        self.vendor_id = Some(value.into());
2838        self
2839    }
2840
2841    /// Sets the optional `vendorErrorCode` field.
2842    #[must_use]
2843    pub fn with_vendor_error_code(mut self, value: impl Into<String>) -> Self {
2844        self.vendor_error_code = Some(value.into());
2845        self
2846    }
2847}
2848
2849impl Validate for StatusNotificationRequest {
2850    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2851        path.push_key("errorCode");
2852        Validate::validate_at(&self.error_code, path, out);
2853        path.pop();
2854        path.push_key("status");
2855        Validate::validate_at(&self.status, path, out);
2856        path.pop();
2857        path.push_key("info");
2858        if let Some(value) = &self.info {
2859            validate::string(value.as_str(), None, Some(50), path, out);
2860        }
2861        path.pop();
2862        path.push_key("vendorId");
2863        if let Some(value) = &self.vendor_id {
2864            validate::string(value.as_str(), None, Some(255), path, out);
2865        }
2866        path.pop();
2867        path.push_key("vendorErrorCode");
2868        if let Some(value) = &self.vendor_error_code {
2869            validate::string(value.as_str(), None, Some(50), path, out);
2870        }
2871        path.pop();
2872    }
2873}
2874
2875impl Sealed for StatusNotificationRequest {}
2876impl Request for StatusNotificationRequest {
2877    type Action = Action;
2878    const ACTION: Action = Action::StatusNotification;
2879    const KIND: MessageKind = MessageKind::Call;
2880    const ORIGIN: Origin = Origin::ChargingStation;
2881    type Response = StatusNotificationResponse;
2882}
2883
2884impl Confirmed for StatusNotificationRequest {}
2885
2886/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2887#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2888pub struct StatusNotificationResponse {}
2889
2890impl StatusNotificationResponse {
2891    /// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
2892    #[must_use]
2893    pub fn new() -> Self {
2894        Self::default()
2895    }
2896}
2897
2898impl Validate for StatusNotificationResponse {
2899    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2900}
2901
2902impl Sealed for StatusNotificationResponse {}
2903impl Response for StatusNotificationResponse {}
2904
2905/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2906#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2907pub struct StopTransactionRequest {
2908    /// The `meterStop` member.
2909    #[serde(rename = "meterStop")]
2910    pub meter_stop: i32,
2911    /// The `timestamp` member.
2912    pub timestamp: crate::types::DateTime,
2913    /// The `transactionId` member.
2914    #[serde(rename = "transactionId")]
2915    pub transaction_id: i32,
2916    /// The `idTag` member.
2917    #[serde(rename = "idTag")]
2918    #[serde(default, skip_serializing_if = "Option::is_none")]
2919    pub id_tag: Option<String>,
2920    /// The `reason` member.
2921    #[serde(default, skip_serializing_if = "Option::is_none")]
2922    pub reason: Option<Reason>,
2923    /// The `transactionData` member.
2924    #[serde(rename = "transactionData")]
2925    #[serde(default, skip_serializing_if = "Option::is_none")]
2926    pub transaction_data: Option<Vec<MeterValue>>,
2927}
2928
2929impl StopTransactionRequest {
2930    /// Creates a `StopTransactionRequest` from its required fields.
2931    #[must_use]
2932    pub fn new(
2933        meter_stop: i32,
2934        timestamp: impl Into<crate::types::DateTime>,
2935        transaction_id: i32,
2936    ) -> Self {
2937        Self {
2938            meter_stop,
2939            timestamp: timestamp.into(),
2940            transaction_id,
2941            id_tag: None,
2942            reason: None,
2943            transaction_data: None,
2944        }
2945    }
2946
2947    /// Sets the optional `idTag` field.
2948    #[must_use]
2949    pub fn with_id_tag(mut self, value: impl Into<String>) -> Self {
2950        self.id_tag = Some(value.into());
2951        self
2952    }
2953
2954    /// Sets the optional `reason` field.
2955    #[must_use]
2956    pub fn with_reason(mut self, value: Reason) -> Self {
2957        self.reason = Some(value);
2958        self
2959    }
2960
2961    /// Sets the optional `transactionData` field.
2962    #[must_use]
2963    pub fn with_transaction_data(mut self, value: Vec<MeterValue>) -> Self {
2964        self.transaction_data = Some(value);
2965        self
2966    }
2967}
2968
2969impl Validate for StopTransactionRequest {
2970    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2971        path.push_key("idTag");
2972        if let Some(value) = &self.id_tag {
2973            validate::string(value.as_str(), None, Some(20), path, out);
2974        }
2975        path.pop();
2976        path.push_key("reason");
2977        if let Some(value) = &self.reason {
2978            Validate::validate_at(value, path, out);
2979        }
2980        path.pop();
2981        path.push_key("transactionData");
2982        if let Some(value) = &self.transaction_data {
2983            for (index, item) in value.iter().enumerate() {
2984                path.push_index(index);
2985                Validate::validate_at(item, path, out);
2986                path.pop();
2987            }
2988        }
2989        path.pop();
2990    }
2991}
2992
2993impl Sealed for StopTransactionRequest {}
2994impl Request for StopTransactionRequest {
2995    type Action = Action;
2996    const ACTION: Action = Action::StopTransaction;
2997    const KIND: MessageKind = MessageKind::Call;
2998    const ORIGIN: Origin = Origin::ChargingStation;
2999    type Response = StopTransactionResponse;
3000}
3001
3002impl Confirmed for StopTransactionRequest {}
3003
3004/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
3005#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3006pub struct StopTransactionResponse {
3007    /// The `idTagInfo` member.
3008    #[serde(rename = "idTagInfo")]
3009    #[serde(default, skip_serializing_if = "Option::is_none")]
3010    pub id_tag_info: Option<IdTagInfo>,
3011}
3012
3013impl StopTransactionResponse {
3014    /// Creates an empty `StopTransactionResponse`. Every field of this type is optional.
3015    #[must_use]
3016    pub fn new() -> Self {
3017        Self::default()
3018    }
3019
3020    /// Sets the optional `idTagInfo` field.
3021    #[must_use]
3022    pub fn with_id_tag_info(mut self, value: IdTagInfo) -> Self {
3023        self.id_tag_info = Some(value);
3024        self
3025    }
3026}
3027
3028impl Validate for StopTransactionResponse {
3029    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3030        path.push_key("idTagInfo");
3031        if let Some(value) = &self.id_tag_info {
3032            Validate::validate_at(value, path, out);
3033        }
3034        path.pop();
3035    }
3036}
3037
3038impl Sealed for StopTransactionResponse {}
3039impl Response for StopTransactionResponse {}
3040
3041/// Spec: OCPP 1.6 · Remote Trigger · CSMS → Charging Station · CALL.
3042#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3043pub struct TriggerMessageRequest {
3044    /// The `requestedMessage` member.
3045    #[serde(rename = "requestedMessage")]
3046    pub requested_message: MessageTrigger,
3047    /// The `connectorId` member.
3048    #[serde(rename = "connectorId")]
3049    #[serde(default, skip_serializing_if = "Option::is_none")]
3050    pub connector_id: Option<i32>,
3051}
3052
3053impl TriggerMessageRequest {
3054    /// Creates a `TriggerMessageRequest` from its required fields.
3055    #[must_use]
3056    pub fn new(requested_message: MessageTrigger) -> Self {
3057        Self {
3058            requested_message,
3059            connector_id: None,
3060        }
3061    }
3062
3063    /// Sets the optional `connectorId` field.
3064    #[must_use]
3065    pub fn with_connector_id(mut self, value: i32) -> Self {
3066        self.connector_id = Some(value);
3067        self
3068    }
3069}
3070
3071impl Validate for TriggerMessageRequest {
3072    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3073        path.push_key("requestedMessage");
3074        Validate::validate_at(&self.requested_message, path, out);
3075        path.pop();
3076    }
3077}
3078
3079impl Sealed for TriggerMessageRequest {}
3080impl Request for TriggerMessageRequest {
3081    type Action = Action;
3082    const ACTION: Action = Action::TriggerMessage;
3083    const KIND: MessageKind = MessageKind::Call;
3084    const ORIGIN: Origin = Origin::Csms;
3085    type Response = TriggerMessageResponse;
3086}
3087
3088impl Confirmed for TriggerMessageRequest {}
3089
3090/// Spec: OCPP 1.6 · Remote Trigger · CSMS → Charging Station · CALL.
3091#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3092pub struct TriggerMessageResponse {
3093    /// The `status` member.
3094    pub status: TriggerMessageStatus,
3095}
3096
3097impl TriggerMessageResponse {
3098    /// Creates a `TriggerMessageResponse` from its required fields.
3099    #[must_use]
3100    pub fn new(status: TriggerMessageStatus) -> Self {
3101        Self { status }
3102    }
3103}
3104
3105impl Validate for TriggerMessageResponse {
3106    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3107        path.push_key("status");
3108        Validate::validate_at(&self.status, path, out);
3109        path.pop();
3110    }
3111}
3112
3113impl Sealed for TriggerMessageResponse {}
3114impl Response for TriggerMessageResponse {}
3115
3116/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
3117#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3118pub struct UnlockConnectorRequest {
3119    /// The `connectorId` member.
3120    #[serde(rename = "connectorId")]
3121    pub connector_id: i32,
3122}
3123
3124impl UnlockConnectorRequest {
3125    /// Creates a `UnlockConnectorRequest` from its required fields.
3126    #[must_use]
3127    pub fn new(connector_id: i32) -> Self {
3128        Self { connector_id }
3129    }
3130}
3131
3132impl Validate for UnlockConnectorRequest {
3133    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3134}
3135
3136impl Sealed for UnlockConnectorRequest {}
3137impl Request for UnlockConnectorRequest {
3138    type Action = Action;
3139    const ACTION: Action = Action::UnlockConnector;
3140    const KIND: MessageKind = MessageKind::Call;
3141    const ORIGIN: Origin = Origin::Csms;
3142    type Response = UnlockConnectorResponse;
3143}
3144
3145impl Confirmed for UnlockConnectorRequest {}
3146
3147/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
3148#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3149pub struct UnlockConnectorResponse {
3150    /// The `status` member.
3151    pub status: UnlockStatus,
3152}
3153
3154impl UnlockConnectorResponse {
3155    /// Creates a `UnlockConnectorResponse` from its required fields.
3156    #[must_use]
3157    pub fn new(status: UnlockStatus) -> Self {
3158        Self { status }
3159    }
3160}
3161
3162impl Validate for UnlockConnectorResponse {
3163    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3164        path.push_key("status");
3165        Validate::validate_at(&self.status, path, out);
3166        path.pop();
3167    }
3168}
3169
3170impl Sealed for UnlockConnectorResponse {}
3171impl Response for UnlockConnectorResponse {}
3172
3173/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
3174#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3175pub struct UpdateFirmwareRequest {
3176    /// The `location` member.
3177    pub location: String,
3178    /// The `retrieveDate` member.
3179    #[serde(rename = "retrieveDate")]
3180    pub retrieve_date: crate::types::DateTime,
3181    /// The `retries` member.
3182    #[serde(default, skip_serializing_if = "Option::is_none")]
3183    pub retries: Option<i32>,
3184    /// The `retryInterval` member.
3185    #[serde(rename = "retryInterval")]
3186    #[serde(default, skip_serializing_if = "Option::is_none")]
3187    pub retry_interval: Option<i32>,
3188}
3189
3190impl UpdateFirmwareRequest {
3191    /// Creates a `UpdateFirmwareRequest` from its required fields.
3192    #[must_use]
3193    pub fn new(
3194        location: impl Into<String>,
3195        retrieve_date: impl Into<crate::types::DateTime>,
3196    ) -> Self {
3197        Self {
3198            location: location.into(),
3199            retrieve_date: retrieve_date.into(),
3200            retries: None,
3201            retry_interval: None,
3202        }
3203    }
3204
3205    /// Sets the optional `retries` field.
3206    #[must_use]
3207    pub fn with_retries(mut self, value: i32) -> Self {
3208        self.retries = Some(value);
3209        self
3210    }
3211
3212    /// Sets the optional `retryInterval` field.
3213    #[must_use]
3214    pub fn with_retry_interval(mut self, value: i32) -> Self {
3215        self.retry_interval = Some(value);
3216        self
3217    }
3218}
3219
3220impl Validate for UpdateFirmwareRequest {
3221    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3222}
3223
3224impl Sealed for UpdateFirmwareRequest {}
3225impl Request for UpdateFirmwareRequest {
3226    type Action = Action;
3227    const ACTION: Action = Action::UpdateFirmware;
3228    const KIND: MessageKind = MessageKind::Call;
3229    const ORIGIN: Origin = Origin::Csms;
3230    type Response = UpdateFirmwareResponse;
3231}
3232
3233impl Confirmed for UpdateFirmwareRequest {}
3234
3235/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
3236#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3237pub struct UpdateFirmwareResponse {}
3238
3239impl UpdateFirmwareResponse {
3240    /// Creates an empty `UpdateFirmwareResponse`. Every field of this type is optional.
3241    #[must_use]
3242    pub fn new() -> Self {
3243        Self::default()
3244    }
3245}
3246
3247impl Validate for UpdateFirmwareResponse {
3248    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3249}
3250
3251impl Sealed for UpdateFirmwareResponse {}
3252impl Response for UpdateFirmwareResponse {}