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    pub connector_id: Option<i32>,
935}
936
937impl ExtendedTriggerMessageRequest {
938    /// Creates a `ExtendedTriggerMessageRequest` from its required fields.
939    #[must_use]
940    pub fn new(requested_message: ExtendedMessageTrigger) -> Self {
941        Self {
942            requested_message,
943            connector_id: None,
944        }
945    }
946
947    /// Sets the optional `connectorId` field.
948    #[must_use]
949    pub fn with_connector_id(mut self, value: i32) -> Self {
950        self.connector_id = Some(value);
951        self
952    }
953}
954
955impl Validate for ExtendedTriggerMessageRequest {
956    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
957        path.push_key("requestedMessage");
958        Validate::validate_at(&self.requested_message, path, out);
959        path.pop();
960    }
961}
962
963impl Sealed for ExtendedTriggerMessageRequest {}
964impl Request for ExtendedTriggerMessageRequest {
965    type Action = Action;
966    const ACTION: Action = Action::ExtendedTriggerMessage;
967    const KIND: MessageKind = MessageKind::Call;
968    const ORIGIN: Origin = Origin::Csms;
969    type Response = ExtendedTriggerMessageResponse;
970}
971
972impl Confirmed for ExtendedTriggerMessageRequest {}
973
974/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
975#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
976pub struct ExtendedTriggerMessageResponse {
977    /// The `status` member.
978    pub status: TriggerMessageStatus,
979}
980
981impl ExtendedTriggerMessageResponse {
982    /// Creates a `ExtendedTriggerMessageResponse` from its required fields.
983    #[must_use]
984    pub fn new(status: TriggerMessageStatus) -> Self {
985        Self { status }
986    }
987}
988
989impl Validate for ExtendedTriggerMessageResponse {
990    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
991        path.push_key("status");
992        Validate::validate_at(&self.status, path, out);
993        path.pop();
994    }
995}
996
997impl Sealed for ExtendedTriggerMessageResponse {}
998impl Response for ExtendedTriggerMessageResponse {}
999
1000/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
1001#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1002pub struct FirmwareStatusNotificationRequest {
1003    /// The `status` member.
1004    pub status: FirmwareStatus,
1005}
1006
1007impl FirmwareStatusNotificationRequest {
1008    /// Creates a `FirmwareStatusNotificationRequest` from its required fields.
1009    #[must_use]
1010    pub fn new(status: FirmwareStatus) -> Self {
1011        Self { status }
1012    }
1013}
1014
1015impl Validate for FirmwareStatusNotificationRequest {
1016    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1017        path.push_key("status");
1018        Validate::validate_at(&self.status, path, out);
1019        path.pop();
1020    }
1021}
1022
1023impl Sealed for FirmwareStatusNotificationRequest {}
1024impl Request for FirmwareStatusNotificationRequest {
1025    type Action = Action;
1026    const ACTION: Action = Action::FirmwareStatusNotification;
1027    const KIND: MessageKind = MessageKind::Call;
1028    const ORIGIN: Origin = Origin::ChargingStation;
1029    type Response = FirmwareStatusNotificationResponse;
1030}
1031
1032impl Confirmed for FirmwareStatusNotificationRequest {}
1033
1034/// Spec: OCPP 1.6 · Firmware Management · Charging Station → CSMS · CALL.
1035#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1036pub struct FirmwareStatusNotificationResponse {}
1037
1038impl FirmwareStatusNotificationResponse {
1039    /// Creates an empty `FirmwareStatusNotificationResponse`. Every field of this type is optional.
1040    #[must_use]
1041    pub fn new() -> Self {
1042        Self::default()
1043    }
1044}
1045
1046impl Validate for FirmwareStatusNotificationResponse {
1047    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1048}
1049
1050impl Sealed for FirmwareStatusNotificationResponse {}
1051impl Response for FirmwareStatusNotificationResponse {}
1052
1053/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
1054#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1055pub struct GetCompositeScheduleRequest {
1056    /// The `connectorId` member.
1057    #[serde(rename = "connectorId")]
1058    pub connector_id: i32,
1059    /// The `duration` member.
1060    pub duration: i32,
1061    /// The `chargingRateUnit` member.
1062    #[serde(rename = "chargingRateUnit")]
1063    #[serde(default, skip_serializing_if = "Option::is_none")]
1064    pub charging_rate_unit: Option<ChargingRateUnit>,
1065}
1066
1067impl GetCompositeScheduleRequest {
1068    /// Creates a `GetCompositeScheduleRequest` from its required fields.
1069    #[must_use]
1070    pub fn new(connector_id: i32, duration: i32) -> Self {
1071        Self {
1072            connector_id,
1073            duration,
1074            charging_rate_unit: None,
1075        }
1076    }
1077
1078    /// Sets the optional `chargingRateUnit` field.
1079    #[must_use]
1080    pub fn with_charging_rate_unit(mut self, value: ChargingRateUnit) -> Self {
1081        self.charging_rate_unit = Some(value);
1082        self
1083    }
1084}
1085
1086impl Validate for GetCompositeScheduleRequest {
1087    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1088        path.push_key("chargingRateUnit");
1089        if let Some(value) = &self.charging_rate_unit {
1090            Validate::validate_at(value, path, out);
1091        }
1092        path.pop();
1093    }
1094}
1095
1096impl Sealed for GetCompositeScheduleRequest {}
1097impl Request for GetCompositeScheduleRequest {
1098    type Action = Action;
1099    const ACTION: Action = Action::GetCompositeSchedule;
1100    const KIND: MessageKind = MessageKind::Call;
1101    const ORIGIN: Origin = Origin::Csms;
1102    type Response = GetCompositeScheduleResponse;
1103}
1104
1105impl Confirmed for GetCompositeScheduleRequest {}
1106
1107/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
1108#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1109pub struct GetCompositeScheduleResponse {
1110    /// The `status` member.
1111    pub status: GetCompositeScheduleStatus,
1112    /// The `connectorId` member.
1113    #[serde(rename = "connectorId")]
1114    #[serde(default, skip_serializing_if = "Option::is_none")]
1115    pub connector_id: Option<i32>,
1116    /// The `scheduleStart` member.
1117    #[serde(rename = "scheduleStart")]
1118    #[serde(default, skip_serializing_if = "Option::is_none")]
1119    pub schedule_start: Option<crate::types::DateTime>,
1120    /// The `chargingSchedule` member.
1121    #[serde(rename = "chargingSchedule")]
1122    #[serde(default, skip_serializing_if = "Option::is_none")]
1123    pub charging_schedule: Option<ChargingSchedule>,
1124}
1125
1126impl GetCompositeScheduleResponse {
1127    /// Creates a `GetCompositeScheduleResponse` from its required fields.
1128    #[must_use]
1129    pub fn new(status: GetCompositeScheduleStatus) -> Self {
1130        Self {
1131            status,
1132            connector_id: None,
1133            schedule_start: None,
1134            charging_schedule: None,
1135        }
1136    }
1137
1138    /// Sets the optional `connectorId` field.
1139    #[must_use]
1140    pub fn with_connector_id(mut self, value: i32) -> Self {
1141        self.connector_id = Some(value);
1142        self
1143    }
1144
1145    /// Sets the optional `scheduleStart` field.
1146    #[must_use]
1147    pub fn with_schedule_start(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1148        self.schedule_start = Some(value.into());
1149        self
1150    }
1151
1152    /// Sets the optional `chargingSchedule` field.
1153    #[must_use]
1154    pub fn with_charging_schedule(mut self, value: ChargingSchedule) -> Self {
1155        self.charging_schedule = Some(value);
1156        self
1157    }
1158}
1159
1160impl Validate for GetCompositeScheduleResponse {
1161    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1162        path.push_key("status");
1163        Validate::validate_at(&self.status, path, out);
1164        path.pop();
1165        path.push_key("chargingSchedule");
1166        if let Some(value) = &self.charging_schedule {
1167            Validate::validate_at(value, path, out);
1168        }
1169        path.pop();
1170    }
1171}
1172
1173impl Sealed for GetCompositeScheduleResponse {}
1174impl Response for GetCompositeScheduleResponse {}
1175
1176/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1177#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1178pub struct GetConfigurationRequest {
1179    /// The `key` member.
1180    #[serde(default, skip_serializing_if = "Option::is_none")]
1181    pub key: Option<Vec<String>>,
1182}
1183
1184impl GetConfigurationRequest {
1185    /// Creates an empty `GetConfigurationRequest`. Every field of this type is optional.
1186    #[must_use]
1187    pub fn new() -> Self {
1188        Self::default()
1189    }
1190
1191    /// Sets the optional `key` field.
1192    #[must_use]
1193    pub fn with_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1194        self.key = Some(value.into_iter().map(Into::into).collect());
1195        self
1196    }
1197}
1198
1199impl Validate for GetConfigurationRequest {
1200    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1201        path.push_key("key");
1202        if let Some(value) = &self.key {
1203            for (index, item) in value.iter().enumerate() {
1204                path.push_index(index);
1205                validate::string(item.as_str(), None, Some(50), path, out);
1206                path.pop();
1207            }
1208        }
1209        path.pop();
1210    }
1211}
1212
1213impl Sealed for GetConfigurationRequest {}
1214impl Request for GetConfigurationRequest {
1215    type Action = Action;
1216    const ACTION: Action = Action::GetConfiguration;
1217    const KIND: MessageKind = MessageKind::Call;
1218    const ORIGIN: Origin = Origin::Csms;
1219    type Response = GetConfigurationResponse;
1220}
1221
1222impl Confirmed for GetConfigurationRequest {}
1223
1224/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1225#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1226pub struct GetConfigurationResponse {
1227    /// The `configurationKey` member.
1228    #[serde(rename = "configurationKey")]
1229    #[serde(default, skip_serializing_if = "Option::is_none")]
1230    pub configuration_key: Option<Vec<KeyValue>>,
1231    /// The `unknownKey` member.
1232    #[serde(rename = "unknownKey")]
1233    #[serde(default, skip_serializing_if = "Option::is_none")]
1234    pub unknown_key: Option<Vec<String>>,
1235}
1236
1237impl GetConfigurationResponse {
1238    /// Creates an empty `GetConfigurationResponse`. Every field of this type is optional.
1239    #[must_use]
1240    pub fn new() -> Self {
1241        Self::default()
1242    }
1243
1244    /// Sets the optional `configurationKey` field.
1245    #[must_use]
1246    pub fn with_configuration_key(mut self, value: Vec<KeyValue>) -> Self {
1247        self.configuration_key = Some(value);
1248        self
1249    }
1250
1251    /// Sets the optional `unknownKey` field.
1252    #[must_use]
1253    pub fn with_unknown_key(mut self, value: impl IntoIterator<Item = impl Into<String>>) -> Self {
1254        self.unknown_key = Some(value.into_iter().map(Into::into).collect());
1255        self
1256    }
1257}
1258
1259impl Validate for GetConfigurationResponse {
1260    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1261        path.push_key("configurationKey");
1262        if let Some(value) = &self.configuration_key {
1263            for (index, item) in value.iter().enumerate() {
1264                path.push_index(index);
1265                Validate::validate_at(item, path, out);
1266                path.pop();
1267            }
1268        }
1269        path.pop();
1270        path.push_key("unknownKey");
1271        if let Some(value) = &self.unknown_key {
1272            for (index, item) in value.iter().enumerate() {
1273                path.push_index(index);
1274                validate::string(item.as_str(), None, Some(50), path, out);
1275                path.pop();
1276            }
1277        }
1278        path.pop();
1279    }
1280}
1281
1282impl Sealed for GetConfigurationResponse {}
1283impl Response for GetConfigurationResponse {}
1284
1285/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
1286#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1287pub struct GetDiagnosticsRequest {
1288    /// The `location` member.
1289    pub location: String,
1290    /// The `retries` member.
1291    #[serde(default, skip_serializing_if = "Option::is_none")]
1292    pub retries: Option<i32>,
1293    /// The `retryInterval` member.
1294    #[serde(rename = "retryInterval")]
1295    #[serde(default, skip_serializing_if = "Option::is_none")]
1296    pub retry_interval: Option<i32>,
1297    /// The `startTime` member.
1298    #[serde(rename = "startTime")]
1299    #[serde(default, skip_serializing_if = "Option::is_none")]
1300    pub start_time: Option<crate::types::DateTime>,
1301    /// The `stopTime` member.
1302    #[serde(rename = "stopTime")]
1303    #[serde(default, skip_serializing_if = "Option::is_none")]
1304    pub stop_time: Option<crate::types::DateTime>,
1305}
1306
1307impl GetDiagnosticsRequest {
1308    /// Creates a `GetDiagnosticsRequest` from its required fields.
1309    #[must_use]
1310    pub fn new(location: impl Into<String>) -> Self {
1311        Self {
1312            location: location.into(),
1313            retries: None,
1314            retry_interval: None,
1315            start_time: None,
1316            stop_time: None,
1317        }
1318    }
1319
1320    /// Sets the optional `retries` field.
1321    #[must_use]
1322    pub fn with_retries(mut self, value: i32) -> Self {
1323        self.retries = Some(value);
1324        self
1325    }
1326
1327    /// Sets the optional `retryInterval` field.
1328    #[must_use]
1329    pub fn with_retry_interval(mut self, value: i32) -> Self {
1330        self.retry_interval = Some(value);
1331        self
1332    }
1333
1334    /// Sets the optional `startTime` field.
1335    #[must_use]
1336    pub fn with_start_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1337        self.start_time = Some(value.into());
1338        self
1339    }
1340
1341    /// Sets the optional `stopTime` field.
1342    #[must_use]
1343    pub fn with_stop_time(mut self, value: impl Into<crate::types::DateTime>) -> Self {
1344        self.stop_time = Some(value.into());
1345        self
1346    }
1347}
1348
1349impl Validate for GetDiagnosticsRequest {
1350    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1351}
1352
1353impl Sealed for GetDiagnosticsRequest {}
1354impl Request for GetDiagnosticsRequest {
1355    type Action = Action;
1356    const ACTION: Action = Action::GetDiagnostics;
1357    const KIND: MessageKind = MessageKind::Call;
1358    const ORIGIN: Origin = Origin::Csms;
1359    type Response = GetDiagnosticsResponse;
1360}
1361
1362impl Confirmed for GetDiagnosticsRequest {}
1363
1364/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
1365#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1366pub struct GetDiagnosticsResponse {
1367    /// The `fileName` member.
1368    #[serde(rename = "fileName")]
1369    #[serde(default, skip_serializing_if = "Option::is_none")]
1370    pub file_name: Option<String>,
1371}
1372
1373impl GetDiagnosticsResponse {
1374    /// Creates an empty `GetDiagnosticsResponse`. Every field of this type is optional.
1375    #[must_use]
1376    pub fn new() -> Self {
1377        Self::default()
1378    }
1379
1380    /// Sets the optional `fileName` field.
1381    #[must_use]
1382    pub fn with_file_name(mut self, value: impl Into<String>) -> Self {
1383        self.file_name = Some(value.into());
1384        self
1385    }
1386}
1387
1388impl Validate for GetDiagnosticsResponse {
1389    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1390        path.push_key("fileName");
1391        if let Some(value) = &self.file_name {
1392            validate::string(value.as_str(), None, Some(255), path, out);
1393        }
1394        path.pop();
1395    }
1396}
1397
1398impl Sealed for GetDiagnosticsResponse {}
1399impl Response for GetDiagnosticsResponse {}
1400
1401/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1402#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1403pub struct GetInstalledCertificateIdsRequest {
1404    /// The `certificateType` member.
1405    #[serde(rename = "certificateType")]
1406    pub certificate_type: CertificateUse,
1407}
1408
1409impl GetInstalledCertificateIdsRequest {
1410    /// Creates a `GetInstalledCertificateIdsRequest` from its required fields.
1411    #[must_use]
1412    pub fn new(certificate_type: CertificateUse) -> Self {
1413        Self { certificate_type }
1414    }
1415}
1416
1417impl Validate for GetInstalledCertificateIdsRequest {
1418    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1419        path.push_key("certificateType");
1420        Validate::validate_at(&self.certificate_type, path, out);
1421        path.pop();
1422    }
1423}
1424
1425impl Sealed for GetInstalledCertificateIdsRequest {}
1426impl Request for GetInstalledCertificateIdsRequest {
1427    type Action = Action;
1428    const ACTION: Action = Action::GetInstalledCertificateIds;
1429    const KIND: MessageKind = MessageKind::Call;
1430    const ORIGIN: Origin = Origin::Csms;
1431    type Response = GetInstalledCertificateIdsResponse;
1432}
1433
1434impl Confirmed for GetInstalledCertificateIdsRequest {}
1435
1436/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1437#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1438pub struct GetInstalledCertificateIdsResponse {
1439    /// The `status` member.
1440    pub status: GetInstalledCertificateStatus,
1441    /// The `certificateHashData` member.
1442    #[serde(rename = "certificateHashData")]
1443    #[serde(default, skip_serializing_if = "Option::is_none")]
1444    pub certificate_hash_data: Option<Vec<CertificateHashData>>,
1445}
1446
1447impl GetInstalledCertificateIdsResponse {
1448    /// Creates a `GetInstalledCertificateIdsResponse` from its required fields.
1449    #[must_use]
1450    pub fn new(status: GetInstalledCertificateStatus) -> Self {
1451        Self {
1452            status,
1453            certificate_hash_data: None,
1454        }
1455    }
1456
1457    /// Sets the optional `certificateHashData` field.
1458    #[must_use]
1459    pub fn with_certificate_hash_data(mut self, value: Vec<CertificateHashData>) -> Self {
1460        self.certificate_hash_data = Some(value);
1461        self
1462    }
1463}
1464
1465impl Validate for GetInstalledCertificateIdsResponse {
1466    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1467        path.push_key("status");
1468        Validate::validate_at(&self.status, path, out);
1469        path.pop();
1470        path.push_key("certificateHashData");
1471        if let Some(value) = &self.certificate_hash_data {
1472            validate::list_len(value.len(), Some(1), None, path, out);
1473            for (index, item) in value.iter().enumerate() {
1474                path.push_index(index);
1475                Validate::validate_at(item, path, out);
1476                path.pop();
1477            }
1478        }
1479        path.pop();
1480    }
1481}
1482
1483impl Sealed for GetInstalledCertificateIdsResponse {}
1484impl Response for GetInstalledCertificateIdsResponse {}
1485
1486/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
1487#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1488pub struct GetLocalListVersionRequest {}
1489
1490impl GetLocalListVersionRequest {
1491    /// Creates an empty `GetLocalListVersionRequest`. Every field of this type is optional.
1492    #[must_use]
1493    pub fn new() -> Self {
1494        Self::default()
1495    }
1496}
1497
1498impl Validate for GetLocalListVersionRequest {
1499    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1500}
1501
1502impl Sealed for GetLocalListVersionRequest {}
1503impl Request for GetLocalListVersionRequest {
1504    type Action = Action;
1505    const ACTION: Action = Action::GetLocalListVersion;
1506    const KIND: MessageKind = MessageKind::Call;
1507    const ORIGIN: Origin = Origin::Csms;
1508    type Response = GetLocalListVersionResponse;
1509}
1510
1511impl Confirmed for GetLocalListVersionRequest {}
1512
1513/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
1514#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1515pub struct GetLocalListVersionResponse {
1516    /// The `listVersion` member.
1517    #[serde(rename = "listVersion")]
1518    pub list_version: i32,
1519}
1520
1521impl GetLocalListVersionResponse {
1522    /// Creates a `GetLocalListVersionResponse` from its required fields.
1523    #[must_use]
1524    pub fn new(list_version: i32) -> Self {
1525        Self { list_version }
1526    }
1527}
1528
1529impl Validate for GetLocalListVersionResponse {
1530    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1531}
1532
1533impl Sealed for GetLocalListVersionResponse {}
1534impl Response for GetLocalListVersionResponse {}
1535
1536/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1537#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1538pub struct GetLogRequest {
1539    /// The `log` member.
1540    pub log: LogParameters,
1541    /// The `logType` member.
1542    #[serde(rename = "logType")]
1543    pub log_type: LogType,
1544    /// The `requestId` member.
1545    #[serde(rename = "requestId")]
1546    pub request_id: i32,
1547    /// The `retries` member.
1548    #[serde(default, skip_serializing_if = "Option::is_none")]
1549    pub retries: Option<i32>,
1550    /// The `retryInterval` member.
1551    #[serde(rename = "retryInterval")]
1552    #[serde(default, skip_serializing_if = "Option::is_none")]
1553    pub retry_interval: Option<i32>,
1554}
1555
1556impl GetLogRequest {
1557    /// Creates a `GetLogRequest` from its required fields.
1558    #[must_use]
1559    pub fn new(log: LogParameters, log_type: LogType, request_id: i32) -> Self {
1560        Self {
1561            log,
1562            log_type,
1563            request_id,
1564            retries: None,
1565            retry_interval: None,
1566        }
1567    }
1568
1569    /// Sets the optional `retries` field.
1570    #[must_use]
1571    pub fn with_retries(mut self, value: i32) -> Self {
1572        self.retries = Some(value);
1573        self
1574    }
1575
1576    /// Sets the optional `retryInterval` field.
1577    #[must_use]
1578    pub fn with_retry_interval(mut self, value: i32) -> Self {
1579        self.retry_interval = Some(value);
1580        self
1581    }
1582}
1583
1584impl Validate for GetLogRequest {
1585    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1586        path.push_key("log");
1587        Validate::validate_at(&self.log, path, out);
1588        path.pop();
1589        path.push_key("logType");
1590        Validate::validate_at(&self.log_type, path, out);
1591        path.pop();
1592    }
1593}
1594
1595impl Sealed for GetLogRequest {}
1596impl Request for GetLogRequest {
1597    type Action = Action;
1598    const ACTION: Action = Action::GetLog;
1599    const KIND: MessageKind = MessageKind::Call;
1600    const ORIGIN: Origin = Origin::Csms;
1601    type Response = GetLogResponse;
1602}
1603
1604impl Confirmed for GetLogRequest {}
1605
1606/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1607#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1608pub struct GetLogResponse {
1609    /// The `status` member.
1610    pub status: LogStatus,
1611    /// The `filename` member.
1612    #[serde(default, skip_serializing_if = "Option::is_none")]
1613    pub filename: Option<String>,
1614}
1615
1616impl GetLogResponse {
1617    /// Creates a `GetLogResponse` from its required fields.
1618    #[must_use]
1619    pub fn new(status: LogStatus) -> Self {
1620        Self {
1621            status,
1622            filename: None,
1623        }
1624    }
1625
1626    /// Sets the optional `filename` field.
1627    #[must_use]
1628    pub fn with_filename(mut self, value: impl Into<String>) -> Self {
1629        self.filename = Some(value.into());
1630        self
1631    }
1632}
1633
1634impl Validate for GetLogResponse {
1635    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1636        path.push_key("status");
1637        Validate::validate_at(&self.status, path, out);
1638        path.pop();
1639        path.push_key("filename");
1640        if let Some(value) = &self.filename {
1641            validate::string(value.as_str(), None, Some(255), path, out);
1642        }
1643        path.pop();
1644    }
1645}
1646
1647impl Sealed for GetLogResponse {}
1648impl Response for GetLogResponse {}
1649
1650/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1651#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1652pub struct HeartbeatRequest {}
1653
1654impl HeartbeatRequest {
1655    /// Creates an empty `HeartbeatRequest`. Every field of this type is optional.
1656    #[must_use]
1657    pub fn new() -> Self {
1658        Self::default()
1659    }
1660}
1661
1662impl Validate for HeartbeatRequest {
1663    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1664}
1665
1666impl Sealed for HeartbeatRequest {}
1667impl Request for HeartbeatRequest {
1668    type Action = Action;
1669    const ACTION: Action = Action::Heartbeat;
1670    const KIND: MessageKind = MessageKind::Call;
1671    const ORIGIN: Origin = Origin::ChargingStation;
1672    type Response = HeartbeatResponse;
1673}
1674
1675impl Confirmed for HeartbeatRequest {}
1676
1677/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1678#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1679pub struct HeartbeatResponse {
1680    /// The `currentTime` member.
1681    #[serde(rename = "currentTime")]
1682    pub current_time: crate::types::DateTime,
1683}
1684
1685impl HeartbeatResponse {
1686    /// Creates a `HeartbeatResponse` from its required fields.
1687    #[must_use]
1688    pub fn new(current_time: impl Into<crate::types::DateTime>) -> Self {
1689        Self {
1690            current_time: current_time.into(),
1691        }
1692    }
1693}
1694
1695impl Validate for HeartbeatResponse {
1696    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1697}
1698
1699impl Sealed for HeartbeatResponse {}
1700impl Response for HeartbeatResponse {}
1701
1702/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1703#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1704pub struct InstallCertificateRequest {
1705    /// The `certificateType` member.
1706    #[serde(rename = "certificateType")]
1707    pub certificate_type: CertificateUse,
1708    /// The `certificate` member.
1709    pub certificate: String,
1710}
1711
1712impl InstallCertificateRequest {
1713    /// Creates a `InstallCertificateRequest` from its required fields.
1714    #[must_use]
1715    pub fn new(certificate_type: CertificateUse, certificate: impl Into<String>) -> Self {
1716        Self {
1717            certificate_type,
1718            certificate: certificate.into(),
1719        }
1720    }
1721}
1722
1723impl Validate for InstallCertificateRequest {
1724    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1725        path.push_key("certificateType");
1726        Validate::validate_at(&self.certificate_type, path, out);
1727        path.pop();
1728        path.push_key("certificate");
1729        validate::string(self.certificate.as_str(), None, Some(5500), path, out);
1730        path.pop();
1731    }
1732}
1733
1734impl Sealed for InstallCertificateRequest {}
1735impl Request for InstallCertificateRequest {
1736    type Action = Action;
1737    const ACTION: Action = Action::InstallCertificate;
1738    const KIND: MessageKind = MessageKind::Call;
1739    const ORIGIN: Origin = Origin::Csms;
1740    type Response = InstallCertificateResponse;
1741}
1742
1743impl Confirmed for InstallCertificateRequest {}
1744
1745/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
1746#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1747pub struct InstallCertificateResponse {
1748    /// The `status` member.
1749    pub status: InstallCertificateStatus,
1750}
1751
1752impl InstallCertificateResponse {
1753    /// Creates a `InstallCertificateResponse` from its required fields.
1754    #[must_use]
1755    pub fn new(status: InstallCertificateStatus) -> Self {
1756        Self { status }
1757    }
1758}
1759
1760impl Validate for InstallCertificateResponse {
1761    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1762        path.push_key("status");
1763        Validate::validate_at(&self.status, path, out);
1764        path.pop();
1765    }
1766}
1767
1768impl Sealed for InstallCertificateResponse {}
1769impl Response for InstallCertificateResponse {}
1770
1771/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
1772#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1773pub struct LogStatusNotificationRequest {
1774    /// The `status` member.
1775    pub status: UploadLogStatus,
1776    /// The `requestId` member.
1777    #[serde(rename = "requestId")]
1778    #[serde(default, skip_serializing_if = "Option::is_none")]
1779    pub request_id: Option<i32>,
1780}
1781
1782impl LogStatusNotificationRequest {
1783    /// Creates a `LogStatusNotificationRequest` from its required fields.
1784    #[must_use]
1785    pub fn new(status: UploadLogStatus) -> Self {
1786        Self {
1787            status,
1788            request_id: None,
1789        }
1790    }
1791
1792    /// Sets the optional `requestId` field.
1793    #[must_use]
1794    pub fn with_request_id(mut self, value: i32) -> Self {
1795        self.request_id = Some(value);
1796        self
1797    }
1798}
1799
1800impl Validate for LogStatusNotificationRequest {
1801    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1802        path.push_key("status");
1803        Validate::validate_at(&self.status, path, out);
1804        path.pop();
1805    }
1806}
1807
1808impl Sealed for LogStatusNotificationRequest {}
1809impl Request for LogStatusNotificationRequest {
1810    type Action = Action;
1811    const ACTION: Action = Action::LogStatusNotification;
1812    const KIND: MessageKind = MessageKind::Call;
1813    const ORIGIN: Origin = Origin::ChargingStation;
1814    type Response = LogStatusNotificationResponse;
1815}
1816
1817impl Confirmed for LogStatusNotificationRequest {}
1818
1819/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
1820#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1821pub struct LogStatusNotificationResponse {}
1822
1823impl LogStatusNotificationResponse {
1824    /// Creates an empty `LogStatusNotificationResponse`. Every field of this type is optional.
1825    #[must_use]
1826    pub fn new() -> Self {
1827        Self::default()
1828    }
1829}
1830
1831impl Validate for LogStatusNotificationResponse {
1832    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1833}
1834
1835impl Sealed for LogStatusNotificationResponse {}
1836impl Response for LogStatusNotificationResponse {}
1837
1838/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1839#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1840pub struct MeterValuesRequest {
1841    /// The `connectorId` member.
1842    #[serde(rename = "connectorId")]
1843    pub connector_id: i32,
1844    /// The `meterValue` member.
1845    #[serde(rename = "meterValue")]
1846    pub meter_value: Vec<MeterValue>,
1847    /// The `transactionId` member.
1848    #[serde(rename = "transactionId")]
1849    #[serde(default, skip_serializing_if = "Option::is_none")]
1850    pub transaction_id: Option<i32>,
1851}
1852
1853impl MeterValuesRequest {
1854    /// Creates a `MeterValuesRequest` from its required fields.
1855    #[must_use]
1856    pub fn new(connector_id: i32, meter_value: Vec<MeterValue>) -> Self {
1857        Self {
1858            connector_id,
1859            meter_value,
1860            transaction_id: None,
1861        }
1862    }
1863
1864    /// Sets the optional `transactionId` field.
1865    #[must_use]
1866    pub fn with_transaction_id(mut self, value: i32) -> Self {
1867        self.transaction_id = Some(value);
1868        self
1869    }
1870}
1871
1872impl Validate for MeterValuesRequest {
1873    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1874        path.push_key("meterValue");
1875        validate::list_len(self.meter_value.len(), Some(1), None, path, out);
1876        for (index, item) in self.meter_value.iter().enumerate() {
1877            path.push_index(index);
1878            Validate::validate_at(item, path, out);
1879            path.pop();
1880        }
1881        path.pop();
1882    }
1883}
1884
1885impl Sealed for MeterValuesRequest {}
1886impl Request for MeterValuesRequest {
1887    type Action = Action;
1888    const ACTION: Action = Action::MeterValues;
1889    const KIND: MessageKind = MessageKind::Call;
1890    const ORIGIN: Origin = Origin::ChargingStation;
1891    type Response = MeterValuesResponse;
1892}
1893
1894impl Confirmed for MeterValuesRequest {}
1895
1896/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
1897#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
1898pub struct MeterValuesResponse {}
1899
1900impl MeterValuesResponse {
1901    /// Creates an empty `MeterValuesResponse`. Every field of this type is optional.
1902    #[must_use]
1903    pub fn new() -> Self {
1904        Self::default()
1905    }
1906}
1907
1908impl Validate for MeterValuesResponse {
1909    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
1910}
1911
1912impl Sealed for MeterValuesResponse {}
1913impl Response for MeterValuesResponse {}
1914
1915/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1916#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1917pub struct RemoteStartTransactionRequest {
1918    /// The `idTag` member.
1919    #[serde(rename = "idTag")]
1920    pub id_tag: String,
1921    /// The `connectorId` member.
1922    #[serde(rename = "connectorId")]
1923    #[serde(default, skip_serializing_if = "Option::is_none")]
1924    pub connector_id: Option<i32>,
1925    /// The `chargingProfile` member.
1926    #[serde(rename = "chargingProfile")]
1927    #[serde(default, skip_serializing_if = "Option::is_none")]
1928    pub charging_profile: Option<ChargingProfile>,
1929}
1930
1931impl RemoteStartTransactionRequest {
1932    /// Creates a `RemoteStartTransactionRequest` from its required fields.
1933    #[must_use]
1934    pub fn new(id_tag: impl Into<String>) -> Self {
1935        Self {
1936            id_tag: id_tag.into(),
1937            connector_id: None,
1938            charging_profile: None,
1939        }
1940    }
1941
1942    /// Sets the optional `connectorId` field.
1943    #[must_use]
1944    pub fn with_connector_id(mut self, value: i32) -> Self {
1945        self.connector_id = Some(value);
1946        self
1947    }
1948
1949    /// Sets the optional `chargingProfile` field.
1950    #[must_use]
1951    pub fn with_charging_profile(mut self, value: ChargingProfile) -> Self {
1952        self.charging_profile = Some(value);
1953        self
1954    }
1955}
1956
1957impl Validate for RemoteStartTransactionRequest {
1958    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1959        path.push_key("idTag");
1960        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
1961        path.pop();
1962        path.push_key("chargingProfile");
1963        if let Some(value) = &self.charging_profile {
1964            Validate::validate_at(value, path, out);
1965        }
1966        path.pop();
1967    }
1968}
1969
1970impl Sealed for RemoteStartTransactionRequest {}
1971impl Request for RemoteStartTransactionRequest {
1972    type Action = Action;
1973    const ACTION: Action = Action::RemoteStartTransaction;
1974    const KIND: MessageKind = MessageKind::Call;
1975    const ORIGIN: Origin = Origin::Csms;
1976    type Response = RemoteStartTransactionResponse;
1977}
1978
1979impl Confirmed for RemoteStartTransactionRequest {}
1980
1981/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
1982#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
1983pub struct RemoteStartTransactionResponse {
1984    /// The `status` member.
1985    pub status: RemoteStartStopStatus,
1986}
1987
1988impl RemoteStartTransactionResponse {
1989    /// Creates a `RemoteStartTransactionResponse` from its required fields.
1990    #[must_use]
1991    pub fn new(status: RemoteStartStopStatus) -> Self {
1992        Self { status }
1993    }
1994}
1995
1996impl Validate for RemoteStartTransactionResponse {
1997    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
1998        path.push_key("status");
1999        Validate::validate_at(&self.status, path, out);
2000        path.pop();
2001    }
2002}
2003
2004impl Sealed for RemoteStartTransactionResponse {}
2005impl Response for RemoteStartTransactionResponse {}
2006
2007/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2008#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2009pub struct RemoteStopTransactionRequest {
2010    /// The `transactionId` member.
2011    #[serde(rename = "transactionId")]
2012    pub transaction_id: i32,
2013}
2014
2015impl RemoteStopTransactionRequest {
2016    /// Creates a `RemoteStopTransactionRequest` from its required fields.
2017    #[must_use]
2018    pub fn new(transaction_id: i32) -> Self {
2019        Self { transaction_id }
2020    }
2021}
2022
2023impl Validate for RemoteStopTransactionRequest {
2024    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2025}
2026
2027impl Sealed for RemoteStopTransactionRequest {}
2028impl Request for RemoteStopTransactionRequest {
2029    type Action = Action;
2030    const ACTION: Action = Action::RemoteStopTransaction;
2031    const KIND: MessageKind = MessageKind::Call;
2032    const ORIGIN: Origin = Origin::Csms;
2033    type Response = RemoteStopTransactionResponse;
2034}
2035
2036impl Confirmed for RemoteStopTransactionRequest {}
2037
2038/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2039#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2040pub struct RemoteStopTransactionResponse {
2041    /// The `status` member.
2042    pub status: RemoteStartStopStatus,
2043}
2044
2045impl RemoteStopTransactionResponse {
2046    /// Creates a `RemoteStopTransactionResponse` from its required fields.
2047    #[must_use]
2048    pub fn new(status: RemoteStartStopStatus) -> Self {
2049        Self { status }
2050    }
2051}
2052
2053impl Validate for RemoteStopTransactionResponse {
2054    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2055        path.push_key("status");
2056        Validate::validate_at(&self.status, path, out);
2057        path.pop();
2058    }
2059}
2060
2061impl Sealed for RemoteStopTransactionResponse {}
2062impl Response for RemoteStopTransactionResponse {}
2063
2064/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
2065#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2066pub struct ReserveNowRequest {
2067    /// The `connectorId` member.
2068    #[serde(rename = "connectorId")]
2069    pub connector_id: i32,
2070    /// The `expiryDate` member.
2071    #[serde(rename = "expiryDate")]
2072    pub expiry_date: crate::types::DateTime,
2073    /// The `idTag` member.
2074    #[serde(rename = "idTag")]
2075    pub id_tag: String,
2076    /// The `reservationId` member.
2077    #[serde(rename = "reservationId")]
2078    pub reservation_id: i32,
2079    /// The `parentIdTag` member.
2080    #[serde(rename = "parentIdTag")]
2081    #[serde(default, skip_serializing_if = "Option::is_none")]
2082    pub parent_id_tag: Option<String>,
2083}
2084
2085impl ReserveNowRequest {
2086    /// Creates a `ReserveNowRequest` from its required fields.
2087    #[must_use]
2088    pub fn new(
2089        connector_id: i32,
2090        expiry_date: impl Into<crate::types::DateTime>,
2091        id_tag: impl Into<String>,
2092        reservation_id: i32,
2093    ) -> Self {
2094        Self {
2095            connector_id,
2096            expiry_date: expiry_date.into(),
2097            id_tag: id_tag.into(),
2098            reservation_id,
2099            parent_id_tag: None,
2100        }
2101    }
2102
2103    /// Sets the optional `parentIdTag` field.
2104    #[must_use]
2105    pub fn with_parent_id_tag(mut self, value: impl Into<String>) -> Self {
2106        self.parent_id_tag = Some(value.into());
2107        self
2108    }
2109}
2110
2111impl Validate for ReserveNowRequest {
2112    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2113        path.push_key("idTag");
2114        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
2115        path.pop();
2116        path.push_key("parentIdTag");
2117        if let Some(value) = &self.parent_id_tag {
2118            validate::string(value.as_str(), None, Some(20), path, out);
2119        }
2120        path.pop();
2121    }
2122}
2123
2124impl Sealed for ReserveNowRequest {}
2125impl Request for ReserveNowRequest {
2126    type Action = Action;
2127    const ACTION: Action = Action::ReserveNow;
2128    const KIND: MessageKind = MessageKind::Call;
2129    const ORIGIN: Origin = Origin::Csms;
2130    type Response = ReserveNowResponse;
2131}
2132
2133impl Confirmed for ReserveNowRequest {}
2134
2135/// Spec: OCPP 1.6 · Reservation · CSMS → Charging Station · CALL.
2136#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2137pub struct ReserveNowResponse {
2138    /// The `status` member.
2139    pub status: ReservationStatus,
2140}
2141
2142impl ReserveNowResponse {
2143    /// Creates a `ReserveNowResponse` from its required fields.
2144    #[must_use]
2145    pub fn new(status: ReservationStatus) -> Self {
2146        Self { status }
2147    }
2148}
2149
2150impl Validate for ReserveNowResponse {
2151    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2152        path.push_key("status");
2153        Validate::validate_at(&self.status, path, out);
2154        path.pop();
2155    }
2156}
2157
2158impl Sealed for ReserveNowResponse {}
2159impl Response for ReserveNowResponse {}
2160
2161/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2162#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2163pub struct ResetRequest {
2164    /// The `type` member.
2165    pub r#type: ResetType,
2166}
2167
2168impl ResetRequest {
2169    /// Creates a `ResetRequest` from its required fields.
2170    #[must_use]
2171    pub fn new(r#type: ResetType) -> Self {
2172        Self { r#type }
2173    }
2174}
2175
2176impl Validate for ResetRequest {
2177    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2178        path.push_key("type");
2179        Validate::validate_at(&self.r#type, path, out);
2180        path.pop();
2181    }
2182}
2183
2184impl Sealed for ResetRequest {}
2185impl Request for ResetRequest {
2186    type Action = Action;
2187    const ACTION: Action = Action::Reset;
2188    const KIND: MessageKind = MessageKind::Call;
2189    const ORIGIN: Origin = Origin::Csms;
2190    type Response = ResetResponse;
2191}
2192
2193impl Confirmed for ResetRequest {}
2194
2195/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
2196#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2197pub struct ResetResponse {
2198    /// The `status` member.
2199    pub status: ResetStatus,
2200}
2201
2202impl ResetResponse {
2203    /// Creates a `ResetResponse` from its required fields.
2204    #[must_use]
2205    pub fn new(status: ResetStatus) -> Self {
2206        Self { status }
2207    }
2208}
2209
2210impl Validate for ResetResponse {
2211    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2212        path.push_key("status");
2213        Validate::validate_at(&self.status, path, out);
2214        path.pop();
2215    }
2216}
2217
2218impl Sealed for ResetResponse {}
2219impl Response for ResetResponse {}
2220
2221/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2222#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2223pub struct SecurityEventNotificationRequest {
2224    /// The `type` member.
2225    pub r#type: String,
2226    /// The `timestamp` member.
2227    pub timestamp: crate::types::DateTime,
2228    /// The `techInfo` member.
2229    #[serde(rename = "techInfo")]
2230    #[serde(default, skip_serializing_if = "Option::is_none")]
2231    pub tech_info: Option<String>,
2232}
2233
2234impl SecurityEventNotificationRequest {
2235    /// Creates a `SecurityEventNotificationRequest` from its required fields.
2236    #[must_use]
2237    pub fn new(r#type: impl Into<String>, timestamp: impl Into<crate::types::DateTime>) -> Self {
2238        Self {
2239            r#type: r#type.into(),
2240            timestamp: timestamp.into(),
2241            tech_info: None,
2242        }
2243    }
2244
2245    /// Sets the optional `techInfo` field.
2246    #[must_use]
2247    pub fn with_tech_info(mut self, value: impl Into<String>) -> Self {
2248        self.tech_info = Some(value.into());
2249        self
2250    }
2251}
2252
2253impl Validate for SecurityEventNotificationRequest {
2254    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2255        path.push_key("type");
2256        validate::string(self.r#type.as_str(), None, Some(50), path, out);
2257        path.pop();
2258        path.push_key("techInfo");
2259        if let Some(value) = &self.tech_info {
2260            validate::string(value.as_str(), None, Some(255), path, out);
2261        }
2262        path.pop();
2263    }
2264}
2265
2266impl Sealed for SecurityEventNotificationRequest {}
2267impl Request for SecurityEventNotificationRequest {
2268    type Action = Action;
2269    const ACTION: Action = Action::SecurityEventNotification;
2270    const KIND: MessageKind = MessageKind::Call;
2271    const ORIGIN: Origin = Origin::ChargingStation;
2272    type Response = SecurityEventNotificationResponse;
2273}
2274
2275impl Confirmed for SecurityEventNotificationRequest {}
2276
2277/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2278#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2279pub struct SecurityEventNotificationResponse {}
2280
2281impl SecurityEventNotificationResponse {
2282    /// Creates an empty `SecurityEventNotificationResponse`. Every field of this type is optional.
2283    #[must_use]
2284    pub fn new() -> Self {
2285        Self::default()
2286    }
2287}
2288
2289impl Validate for SecurityEventNotificationResponse {
2290    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2291}
2292
2293impl Sealed for SecurityEventNotificationResponse {}
2294impl Response for SecurityEventNotificationResponse {}
2295
2296/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
2297#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2298pub struct SendLocalListRequest {
2299    /// The `listVersion` member.
2300    #[serde(rename = "listVersion")]
2301    pub list_version: i32,
2302    /// The `updateType` member.
2303    #[serde(rename = "updateType")]
2304    pub update_type: UpdateType,
2305    /// The `localAuthorizationList` member.
2306    #[serde(rename = "localAuthorizationList")]
2307    #[serde(default, skip_serializing_if = "Option::is_none")]
2308    pub local_authorization_list: Option<Vec<AuthorizationData>>,
2309}
2310
2311impl SendLocalListRequest {
2312    /// Creates a `SendLocalListRequest` from its required fields.
2313    #[must_use]
2314    pub fn new(list_version: i32, update_type: UpdateType) -> Self {
2315        Self {
2316            list_version,
2317            update_type,
2318            local_authorization_list: None,
2319        }
2320    }
2321
2322    /// Sets the optional `localAuthorizationList` field.
2323    #[must_use]
2324    pub fn with_local_authorization_list(mut self, value: Vec<AuthorizationData>) -> Self {
2325        self.local_authorization_list = Some(value);
2326        self
2327    }
2328}
2329
2330impl Validate for SendLocalListRequest {
2331    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2332        path.push_key("updateType");
2333        Validate::validate_at(&self.update_type, path, out);
2334        path.pop();
2335        path.push_key("localAuthorizationList");
2336        if let Some(value) = &self.local_authorization_list {
2337            for (index, item) in value.iter().enumerate() {
2338                path.push_index(index);
2339                Validate::validate_at(item, path, out);
2340                path.pop();
2341            }
2342        }
2343        path.pop();
2344    }
2345}
2346
2347impl Sealed for SendLocalListRequest {}
2348impl Request for SendLocalListRequest {
2349    type Action = Action;
2350    const ACTION: Action = Action::SendLocalList;
2351    const KIND: MessageKind = MessageKind::Call;
2352    const ORIGIN: Origin = Origin::Csms;
2353    type Response = SendLocalListResponse;
2354}
2355
2356impl Confirmed for SendLocalListRequest {}
2357
2358/// Spec: OCPP 1.6 · Local Auth List Management · CSMS → Charging Station · CALL.
2359#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2360pub struct SendLocalListResponse {
2361    /// The `status` member.
2362    pub status: UpdateStatus,
2363}
2364
2365impl SendLocalListResponse {
2366    /// Creates a `SendLocalListResponse` from its required fields.
2367    #[must_use]
2368    pub fn new(status: UpdateStatus) -> Self {
2369        Self { status }
2370    }
2371}
2372
2373impl Validate for SendLocalListResponse {
2374    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2375        path.push_key("status");
2376        Validate::validate_at(&self.status, path, out);
2377        path.pop();
2378    }
2379}
2380
2381impl Sealed for SendLocalListResponse {}
2382impl Response for SendLocalListResponse {}
2383
2384/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
2385#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2386pub struct SetChargingProfileRequest {
2387    /// The `connectorId` member.
2388    #[serde(rename = "connectorId")]
2389    pub connector_id: i32,
2390    /// The `csChargingProfiles` member.
2391    #[serde(rename = "csChargingProfiles")]
2392    pub cs_charging_profiles: ChargingProfile,
2393}
2394
2395impl SetChargingProfileRequest {
2396    /// Creates a `SetChargingProfileRequest` from its required fields.
2397    #[must_use]
2398    pub fn new(connector_id: i32, cs_charging_profiles: ChargingProfile) -> Self {
2399        Self {
2400            connector_id,
2401            cs_charging_profiles,
2402        }
2403    }
2404}
2405
2406impl Validate for SetChargingProfileRequest {
2407    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2408        path.push_key("csChargingProfiles");
2409        Validate::validate_at(&self.cs_charging_profiles, path, out);
2410        path.pop();
2411    }
2412}
2413
2414impl Sealed for SetChargingProfileRequest {}
2415impl Request for SetChargingProfileRequest {
2416    type Action = Action;
2417    const ACTION: Action = Action::SetChargingProfile;
2418    const KIND: MessageKind = MessageKind::Call;
2419    const ORIGIN: Origin = Origin::Csms;
2420    type Response = SetChargingProfileResponse;
2421}
2422
2423impl Confirmed for SetChargingProfileRequest {}
2424
2425/// Spec: OCPP 1.6 · Smart Charging · CSMS → Charging Station · CALL.
2426#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2427pub struct SetChargingProfileResponse {
2428    /// The `status` member.
2429    pub status: ChargingProfileStatus,
2430}
2431
2432impl SetChargingProfileResponse {
2433    /// Creates a `SetChargingProfileResponse` from its required fields.
2434    #[must_use]
2435    pub fn new(status: ChargingProfileStatus) -> Self {
2436        Self { status }
2437    }
2438}
2439
2440impl Validate for SetChargingProfileResponse {
2441    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2442        path.push_key("status");
2443        Validate::validate_at(&self.status, path, out);
2444        path.pop();
2445    }
2446}
2447
2448impl Sealed for SetChargingProfileResponse {}
2449impl Response for SetChargingProfileResponse {}
2450
2451/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2452#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2453pub struct SignCertificateRequest {
2454    /// The `csr` member.
2455    pub csr: String,
2456}
2457
2458impl SignCertificateRequest {
2459    /// Creates a `SignCertificateRequest` from its required fields.
2460    #[must_use]
2461    pub fn new(csr: impl Into<String>) -> Self {
2462        Self { csr: csr.into() }
2463    }
2464}
2465
2466impl Validate for SignCertificateRequest {
2467    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2468        path.push_key("csr");
2469        validate::string(self.csr.as_str(), None, Some(5500), path, out);
2470        path.pop();
2471    }
2472}
2473
2474impl Sealed for SignCertificateRequest {}
2475impl Request for SignCertificateRequest {
2476    type Action = Action;
2477    const ACTION: Action = Action::SignCertificate;
2478    const KIND: MessageKind = MessageKind::Call;
2479    const ORIGIN: Origin = Origin::ChargingStation;
2480    type Response = SignCertificateResponse;
2481}
2482
2483impl Confirmed for SignCertificateRequest {}
2484
2485/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2486#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2487pub struct SignCertificateResponse {
2488    /// The `status` member.
2489    pub status: GenericStatus,
2490}
2491
2492impl SignCertificateResponse {
2493    /// Creates a `SignCertificateResponse` from its required fields.
2494    #[must_use]
2495    pub fn new(status: GenericStatus) -> Self {
2496        Self { status }
2497    }
2498}
2499
2500impl Validate for SignCertificateResponse {
2501    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2502        path.push_key("status");
2503        Validate::validate_at(&self.status, path, out);
2504        path.pop();
2505    }
2506}
2507
2508impl Sealed for SignCertificateResponse {}
2509impl Response for SignCertificateResponse {}
2510
2511/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2512#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2513pub struct SignedFirmwareStatusNotificationRequest {
2514    /// The `status` member.
2515    pub status: SignedFirmwareStatus,
2516    /// The `requestId` member.
2517    #[serde(rename = "requestId")]
2518    #[serde(default, skip_serializing_if = "Option::is_none")]
2519    pub request_id: Option<i32>,
2520}
2521
2522impl SignedFirmwareStatusNotificationRequest {
2523    /// Creates a `SignedFirmwareStatusNotificationRequest` from its required fields.
2524    #[must_use]
2525    pub fn new(status: SignedFirmwareStatus) -> Self {
2526        Self {
2527            status,
2528            request_id: None,
2529        }
2530    }
2531
2532    /// Sets the optional `requestId` field.
2533    #[must_use]
2534    pub fn with_request_id(mut self, value: i32) -> Self {
2535        self.request_id = Some(value);
2536        self
2537    }
2538}
2539
2540impl Validate for SignedFirmwareStatusNotificationRequest {
2541    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2542        path.push_key("status");
2543        Validate::validate_at(&self.status, path, out);
2544        path.pop();
2545    }
2546}
2547
2548impl Sealed for SignedFirmwareStatusNotificationRequest {}
2549impl Request for SignedFirmwareStatusNotificationRequest {
2550    type Action = Action;
2551    const ACTION: Action = Action::SignedFirmwareStatusNotification;
2552    const KIND: MessageKind = MessageKind::Call;
2553    const ORIGIN: Origin = Origin::ChargingStation;
2554    type Response = SignedFirmwareStatusNotificationResponse;
2555}
2556
2557impl Confirmed for SignedFirmwareStatusNotificationRequest {}
2558
2559/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · Charging Station → CSMS · CALL.
2560#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2561pub struct SignedFirmwareStatusNotificationResponse {}
2562
2563impl SignedFirmwareStatusNotificationResponse {
2564    /// Creates an empty `SignedFirmwareStatusNotificationResponse`. Every field of this type is optional.
2565    #[must_use]
2566    pub fn new() -> Self {
2567        Self::default()
2568    }
2569}
2570
2571impl Validate for SignedFirmwareStatusNotificationResponse {
2572    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2573}
2574
2575impl Sealed for SignedFirmwareStatusNotificationResponse {}
2576impl Response for SignedFirmwareStatusNotificationResponse {}
2577
2578/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
2579#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2580pub struct SignedUpdateFirmwareRequest {
2581    /// The `requestId` member.
2582    #[serde(rename = "requestId")]
2583    pub request_id: i32,
2584    /// The `firmware` member.
2585    pub firmware: Firmware,
2586    /// The `retries` member.
2587    #[serde(default, skip_serializing_if = "Option::is_none")]
2588    pub retries: Option<i32>,
2589    /// The `retryInterval` member.
2590    #[serde(rename = "retryInterval")]
2591    #[serde(default, skip_serializing_if = "Option::is_none")]
2592    pub retry_interval: Option<i32>,
2593}
2594
2595impl SignedUpdateFirmwareRequest {
2596    /// Creates a `SignedUpdateFirmwareRequest` from its required fields.
2597    #[must_use]
2598    pub fn new(request_id: i32, firmware: Firmware) -> Self {
2599        Self {
2600            request_id,
2601            firmware,
2602            retries: None,
2603            retry_interval: None,
2604        }
2605    }
2606
2607    /// Sets the optional `retries` field.
2608    #[must_use]
2609    pub fn with_retries(mut self, value: i32) -> Self {
2610        self.retries = Some(value);
2611        self
2612    }
2613
2614    /// Sets the optional `retryInterval` field.
2615    #[must_use]
2616    pub fn with_retry_interval(mut self, value: i32) -> Self {
2617        self.retry_interval = Some(value);
2618        self
2619    }
2620}
2621
2622impl Validate for SignedUpdateFirmwareRequest {
2623    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2624        path.push_key("firmware");
2625        Validate::validate_at(&self.firmware, path, out);
2626        path.pop();
2627    }
2628}
2629
2630impl Sealed for SignedUpdateFirmwareRequest {}
2631impl Request for SignedUpdateFirmwareRequest {
2632    type Action = Action;
2633    const ACTION: Action = Action::SignedUpdateFirmware;
2634    const KIND: MessageKind = MessageKind::Call;
2635    const ORIGIN: Origin = Origin::Csms;
2636    type Response = SignedUpdateFirmwareResponse;
2637}
2638
2639impl Confirmed for SignedUpdateFirmwareRequest {}
2640
2641/// Spec: OCPP 1.6 · Security (Whitepaper ed. 2) · CSMS → Charging Station · CALL.
2642#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2643pub struct SignedUpdateFirmwareResponse {
2644    /// The `status` member.
2645    pub status: UpdateFirmwareStatus,
2646}
2647
2648impl SignedUpdateFirmwareResponse {
2649    /// Creates a `SignedUpdateFirmwareResponse` from its required fields.
2650    #[must_use]
2651    pub fn new(status: UpdateFirmwareStatus) -> Self {
2652        Self { status }
2653    }
2654}
2655
2656impl Validate for SignedUpdateFirmwareResponse {
2657    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2658        path.push_key("status");
2659        Validate::validate_at(&self.status, path, out);
2660        path.pop();
2661    }
2662}
2663
2664impl Sealed for SignedUpdateFirmwareResponse {}
2665impl Response for SignedUpdateFirmwareResponse {}
2666
2667/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2668#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2669pub struct StartTransactionRequest {
2670    /// The `connectorId` member.
2671    #[serde(rename = "connectorId")]
2672    pub connector_id: i32,
2673    /// The `idTag` member.
2674    #[serde(rename = "idTag")]
2675    pub id_tag: String,
2676    /// The `meterStart` member.
2677    #[serde(rename = "meterStart")]
2678    pub meter_start: i32,
2679    /// The `timestamp` member.
2680    pub timestamp: crate::types::DateTime,
2681    /// The `reservationId` member.
2682    #[serde(rename = "reservationId")]
2683    #[serde(default, skip_serializing_if = "Option::is_none")]
2684    pub reservation_id: Option<i32>,
2685}
2686
2687impl StartTransactionRequest {
2688    /// Creates a `StartTransactionRequest` from its required fields.
2689    #[must_use]
2690    pub fn new(
2691        connector_id: i32,
2692        id_tag: impl Into<String>,
2693        meter_start: i32,
2694        timestamp: impl Into<crate::types::DateTime>,
2695    ) -> Self {
2696        Self {
2697            connector_id,
2698            id_tag: id_tag.into(),
2699            meter_start,
2700            timestamp: timestamp.into(),
2701            reservation_id: None,
2702        }
2703    }
2704
2705    /// Sets the optional `reservationId` field.
2706    #[must_use]
2707    pub fn with_reservation_id(mut self, value: i32) -> Self {
2708        self.reservation_id = Some(value);
2709        self
2710    }
2711}
2712
2713impl Validate for StartTransactionRequest {
2714    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2715        path.push_key("idTag");
2716        validate::string(self.id_tag.as_str(), None, Some(20), path, out);
2717        path.pop();
2718    }
2719}
2720
2721impl Sealed for StartTransactionRequest {}
2722impl Request for StartTransactionRequest {
2723    type Action = Action;
2724    const ACTION: Action = Action::StartTransaction;
2725    const KIND: MessageKind = MessageKind::Call;
2726    const ORIGIN: Origin = Origin::ChargingStation;
2727    type Response = StartTransactionResponse;
2728}
2729
2730impl Confirmed for StartTransactionRequest {}
2731
2732/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2733#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2734pub struct StartTransactionResponse {
2735    /// The `idTagInfo` member.
2736    #[serde(rename = "idTagInfo")]
2737    pub id_tag_info: IdTagInfo,
2738    /// The `transactionId` member.
2739    #[serde(rename = "transactionId")]
2740    pub transaction_id: i32,
2741}
2742
2743impl StartTransactionResponse {
2744    /// Creates a `StartTransactionResponse` from its required fields.
2745    #[must_use]
2746    pub fn new(id_tag_info: IdTagInfo, transaction_id: i32) -> Self {
2747        Self {
2748            id_tag_info,
2749            transaction_id,
2750        }
2751    }
2752}
2753
2754impl Validate for StartTransactionResponse {
2755    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2756        path.push_key("idTagInfo");
2757        Validate::validate_at(&self.id_tag_info, path, out);
2758        path.pop();
2759    }
2760}
2761
2762impl Sealed for StartTransactionResponse {}
2763impl Response for StartTransactionResponse {}
2764
2765/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2766#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2767pub struct StatusNotificationRequest {
2768    /// The `connectorId` member.
2769    #[serde(rename = "connectorId")]
2770    pub connector_id: i32,
2771    /// The `errorCode` member.
2772    #[serde(rename = "errorCode")]
2773    pub error_code: ChargePointErrorCode,
2774    /// The `status` member.
2775    pub status: ChargePointStatus,
2776    /// The `info` member.
2777    #[serde(default, skip_serializing_if = "Option::is_none")]
2778    pub info: Option<String>,
2779    /// The `timestamp` member.
2780    #[serde(default, skip_serializing_if = "Option::is_none")]
2781    pub timestamp: Option<crate::types::DateTime>,
2782    /// The `vendorId` member.
2783    #[serde(rename = "vendorId")]
2784    #[serde(default, skip_serializing_if = "Option::is_none")]
2785    pub vendor_id: Option<String>,
2786    /// The `vendorErrorCode` member.
2787    #[serde(rename = "vendorErrorCode")]
2788    #[serde(default, skip_serializing_if = "Option::is_none")]
2789    pub vendor_error_code: Option<String>,
2790}
2791
2792impl StatusNotificationRequest {
2793    /// Creates a `StatusNotificationRequest` from its required fields.
2794    #[must_use]
2795    pub fn new(
2796        connector_id: i32,
2797        error_code: ChargePointErrorCode,
2798        status: ChargePointStatus,
2799    ) -> Self {
2800        Self {
2801            connector_id,
2802            error_code,
2803            status,
2804            info: None,
2805            timestamp: None,
2806            vendor_id: None,
2807            vendor_error_code: None,
2808        }
2809    }
2810
2811    /// Sets the optional `info` field.
2812    #[must_use]
2813    pub fn with_info(mut self, value: impl Into<String>) -> Self {
2814        self.info = Some(value.into());
2815        self
2816    }
2817
2818    /// Sets the optional `timestamp` field.
2819    #[must_use]
2820    pub fn with_timestamp(mut self, value: impl Into<crate::types::DateTime>) -> Self {
2821        self.timestamp = Some(value.into());
2822        self
2823    }
2824
2825    /// Sets the optional `vendorId` field.
2826    #[must_use]
2827    pub fn with_vendor_id(mut self, value: impl Into<String>) -> Self {
2828        self.vendor_id = Some(value.into());
2829        self
2830    }
2831
2832    /// Sets the optional `vendorErrorCode` field.
2833    #[must_use]
2834    pub fn with_vendor_error_code(mut self, value: impl Into<String>) -> Self {
2835        self.vendor_error_code = Some(value.into());
2836        self
2837    }
2838}
2839
2840impl Validate for StatusNotificationRequest {
2841    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2842        path.push_key("errorCode");
2843        Validate::validate_at(&self.error_code, path, out);
2844        path.pop();
2845        path.push_key("status");
2846        Validate::validate_at(&self.status, path, out);
2847        path.pop();
2848        path.push_key("info");
2849        if let Some(value) = &self.info {
2850            validate::string(value.as_str(), None, Some(50), path, out);
2851        }
2852        path.pop();
2853        path.push_key("vendorId");
2854        if let Some(value) = &self.vendor_id {
2855            validate::string(value.as_str(), None, Some(255), path, out);
2856        }
2857        path.pop();
2858        path.push_key("vendorErrorCode");
2859        if let Some(value) = &self.vendor_error_code {
2860            validate::string(value.as_str(), None, Some(50), path, out);
2861        }
2862        path.pop();
2863    }
2864}
2865
2866impl Sealed for StatusNotificationRequest {}
2867impl Request for StatusNotificationRequest {
2868    type Action = Action;
2869    const ACTION: Action = Action::StatusNotification;
2870    const KIND: MessageKind = MessageKind::Call;
2871    const ORIGIN: Origin = Origin::ChargingStation;
2872    type Response = StatusNotificationResponse;
2873}
2874
2875impl Confirmed for StatusNotificationRequest {}
2876
2877/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2878#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2879pub struct StatusNotificationResponse {}
2880
2881impl StatusNotificationResponse {
2882    /// Creates an empty `StatusNotificationResponse`. Every field of this type is optional.
2883    #[must_use]
2884    pub fn new() -> Self {
2885        Self::default()
2886    }
2887}
2888
2889impl Validate for StatusNotificationResponse {
2890    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
2891}
2892
2893impl Sealed for StatusNotificationResponse {}
2894impl Response for StatusNotificationResponse {}
2895
2896/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2897#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2898pub struct StopTransactionRequest {
2899    /// The `meterStop` member.
2900    #[serde(rename = "meterStop")]
2901    pub meter_stop: i32,
2902    /// The `timestamp` member.
2903    pub timestamp: crate::types::DateTime,
2904    /// The `transactionId` member.
2905    #[serde(rename = "transactionId")]
2906    pub transaction_id: i32,
2907    /// The `idTag` member.
2908    #[serde(rename = "idTag")]
2909    #[serde(default, skip_serializing_if = "Option::is_none")]
2910    pub id_tag: Option<String>,
2911    /// The `reason` member.
2912    #[serde(default, skip_serializing_if = "Option::is_none")]
2913    pub reason: Option<Reason>,
2914    /// The `transactionData` member.
2915    #[serde(rename = "transactionData")]
2916    #[serde(default, skip_serializing_if = "Option::is_none")]
2917    pub transaction_data: Option<Vec<MeterValue>>,
2918}
2919
2920impl StopTransactionRequest {
2921    /// Creates a `StopTransactionRequest` from its required fields.
2922    #[must_use]
2923    pub fn new(
2924        meter_stop: i32,
2925        timestamp: impl Into<crate::types::DateTime>,
2926        transaction_id: i32,
2927    ) -> Self {
2928        Self {
2929            meter_stop,
2930            timestamp: timestamp.into(),
2931            transaction_id,
2932            id_tag: None,
2933            reason: None,
2934            transaction_data: None,
2935        }
2936    }
2937
2938    /// Sets the optional `idTag` field.
2939    #[must_use]
2940    pub fn with_id_tag(mut self, value: impl Into<String>) -> Self {
2941        self.id_tag = Some(value.into());
2942        self
2943    }
2944
2945    /// Sets the optional `reason` field.
2946    #[must_use]
2947    pub fn with_reason(mut self, value: Reason) -> Self {
2948        self.reason = Some(value);
2949        self
2950    }
2951
2952    /// Sets the optional `transactionData` field.
2953    #[must_use]
2954    pub fn with_transaction_data(mut self, value: Vec<MeterValue>) -> Self {
2955        self.transaction_data = Some(value);
2956        self
2957    }
2958}
2959
2960impl Validate for StopTransactionRequest {
2961    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
2962        path.push_key("idTag");
2963        if let Some(value) = &self.id_tag {
2964            validate::string(value.as_str(), None, Some(20), path, out);
2965        }
2966        path.pop();
2967        path.push_key("reason");
2968        if let Some(value) = &self.reason {
2969            Validate::validate_at(value, path, out);
2970        }
2971        path.pop();
2972        path.push_key("transactionData");
2973        if let Some(value) = &self.transaction_data {
2974            for (index, item) in value.iter().enumerate() {
2975                path.push_index(index);
2976                Validate::validate_at(item, path, out);
2977                path.pop();
2978            }
2979        }
2980        path.pop();
2981    }
2982}
2983
2984impl Sealed for StopTransactionRequest {}
2985impl Request for StopTransactionRequest {
2986    type Action = Action;
2987    const ACTION: Action = Action::StopTransaction;
2988    const KIND: MessageKind = MessageKind::Call;
2989    const ORIGIN: Origin = Origin::ChargingStation;
2990    type Response = StopTransactionResponse;
2991}
2992
2993impl Confirmed for StopTransactionRequest {}
2994
2995/// Spec: OCPP 1.6 · Core · Charging Station → CSMS · CALL.
2996#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2997pub struct StopTransactionResponse {
2998    /// The `idTagInfo` member.
2999    #[serde(rename = "idTagInfo")]
3000    #[serde(default, skip_serializing_if = "Option::is_none")]
3001    pub id_tag_info: Option<IdTagInfo>,
3002}
3003
3004impl StopTransactionResponse {
3005    /// Creates an empty `StopTransactionResponse`. Every field of this type is optional.
3006    #[must_use]
3007    pub fn new() -> Self {
3008        Self::default()
3009    }
3010
3011    /// Sets the optional `idTagInfo` field.
3012    #[must_use]
3013    pub fn with_id_tag_info(mut self, value: IdTagInfo) -> Self {
3014        self.id_tag_info = Some(value);
3015        self
3016    }
3017}
3018
3019impl Validate for StopTransactionResponse {
3020    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3021        path.push_key("idTagInfo");
3022        if let Some(value) = &self.id_tag_info {
3023            Validate::validate_at(value, path, out);
3024        }
3025        path.pop();
3026    }
3027}
3028
3029impl Sealed for StopTransactionResponse {}
3030impl Response for StopTransactionResponse {}
3031
3032/// Spec: OCPP 1.6 · Remote Trigger · CSMS → Charging Station · CALL.
3033#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3034pub struct TriggerMessageRequest {
3035    /// The `requestedMessage` member.
3036    #[serde(rename = "requestedMessage")]
3037    pub requested_message: MessageTrigger,
3038    /// The `connectorId` member.
3039    #[serde(rename = "connectorId")]
3040    #[serde(default, skip_serializing_if = "Option::is_none")]
3041    pub connector_id: Option<i32>,
3042}
3043
3044impl TriggerMessageRequest {
3045    /// Creates a `TriggerMessageRequest` from its required fields.
3046    #[must_use]
3047    pub fn new(requested_message: MessageTrigger) -> Self {
3048        Self {
3049            requested_message,
3050            connector_id: None,
3051        }
3052    }
3053
3054    /// Sets the optional `connectorId` field.
3055    #[must_use]
3056    pub fn with_connector_id(mut self, value: i32) -> Self {
3057        self.connector_id = Some(value);
3058        self
3059    }
3060}
3061
3062impl Validate for TriggerMessageRequest {
3063    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3064        path.push_key("requestedMessage");
3065        Validate::validate_at(&self.requested_message, path, out);
3066        path.pop();
3067    }
3068}
3069
3070impl Sealed for TriggerMessageRequest {}
3071impl Request for TriggerMessageRequest {
3072    type Action = Action;
3073    const ACTION: Action = Action::TriggerMessage;
3074    const KIND: MessageKind = MessageKind::Call;
3075    const ORIGIN: Origin = Origin::Csms;
3076    type Response = TriggerMessageResponse;
3077}
3078
3079impl Confirmed for TriggerMessageRequest {}
3080
3081/// Spec: OCPP 1.6 · Remote Trigger · CSMS → Charging Station · CALL.
3082#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3083pub struct TriggerMessageResponse {
3084    /// The `status` member.
3085    pub status: TriggerMessageStatus,
3086}
3087
3088impl TriggerMessageResponse {
3089    /// Creates a `TriggerMessageResponse` from its required fields.
3090    #[must_use]
3091    pub fn new(status: TriggerMessageStatus) -> Self {
3092        Self { status }
3093    }
3094}
3095
3096impl Validate for TriggerMessageResponse {
3097    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3098        path.push_key("status");
3099        Validate::validate_at(&self.status, path, out);
3100        path.pop();
3101    }
3102}
3103
3104impl Sealed for TriggerMessageResponse {}
3105impl Response for TriggerMessageResponse {}
3106
3107/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
3108#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3109pub struct UnlockConnectorRequest {
3110    /// The `connectorId` member.
3111    #[serde(rename = "connectorId")]
3112    pub connector_id: i32,
3113}
3114
3115impl UnlockConnectorRequest {
3116    /// Creates a `UnlockConnectorRequest` from its required fields.
3117    #[must_use]
3118    pub fn new(connector_id: i32) -> Self {
3119        Self { connector_id }
3120    }
3121}
3122
3123impl Validate for UnlockConnectorRequest {
3124    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3125}
3126
3127impl Sealed for UnlockConnectorRequest {}
3128impl Request for UnlockConnectorRequest {
3129    type Action = Action;
3130    const ACTION: Action = Action::UnlockConnector;
3131    const KIND: MessageKind = MessageKind::Call;
3132    const ORIGIN: Origin = Origin::Csms;
3133    type Response = UnlockConnectorResponse;
3134}
3135
3136impl Confirmed for UnlockConnectorRequest {}
3137
3138/// Spec: OCPP 1.6 · Core · CSMS → Charging Station · CALL.
3139#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3140pub struct UnlockConnectorResponse {
3141    /// The `status` member.
3142    pub status: UnlockStatus,
3143}
3144
3145impl UnlockConnectorResponse {
3146    /// Creates a `UnlockConnectorResponse` from its required fields.
3147    #[must_use]
3148    pub fn new(status: UnlockStatus) -> Self {
3149        Self { status }
3150    }
3151}
3152
3153impl Validate for UnlockConnectorResponse {
3154    fn validate_at(&self, path: &mut ValidationPath, out: &mut Violations) {
3155        path.push_key("status");
3156        Validate::validate_at(&self.status, path, out);
3157        path.pop();
3158    }
3159}
3160
3161impl Sealed for UnlockConnectorResponse {}
3162impl Response for UnlockConnectorResponse {}
3163
3164/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
3165#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
3166pub struct UpdateFirmwareRequest {
3167    /// The `location` member.
3168    pub location: String,
3169    /// The `retrieveDate` member.
3170    #[serde(rename = "retrieveDate")]
3171    pub retrieve_date: crate::types::DateTime,
3172    /// The `retries` member.
3173    #[serde(default, skip_serializing_if = "Option::is_none")]
3174    pub retries: Option<i32>,
3175    /// The `retryInterval` member.
3176    #[serde(rename = "retryInterval")]
3177    #[serde(default, skip_serializing_if = "Option::is_none")]
3178    pub retry_interval: Option<i32>,
3179}
3180
3181impl UpdateFirmwareRequest {
3182    /// Creates a `UpdateFirmwareRequest` from its required fields.
3183    #[must_use]
3184    pub fn new(
3185        location: impl Into<String>,
3186        retrieve_date: impl Into<crate::types::DateTime>,
3187    ) -> Self {
3188        Self {
3189            location: location.into(),
3190            retrieve_date: retrieve_date.into(),
3191            retries: None,
3192            retry_interval: None,
3193        }
3194    }
3195
3196    /// Sets the optional `retries` field.
3197    #[must_use]
3198    pub fn with_retries(mut self, value: i32) -> Self {
3199        self.retries = Some(value);
3200        self
3201    }
3202
3203    /// Sets the optional `retryInterval` field.
3204    #[must_use]
3205    pub fn with_retry_interval(mut self, value: i32) -> Self {
3206        self.retry_interval = Some(value);
3207        self
3208    }
3209}
3210
3211impl Validate for UpdateFirmwareRequest {
3212    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3213}
3214
3215impl Sealed for UpdateFirmwareRequest {}
3216impl Request for UpdateFirmwareRequest {
3217    type Action = Action;
3218    const ACTION: Action = Action::UpdateFirmware;
3219    const KIND: MessageKind = MessageKind::Call;
3220    const ORIGIN: Origin = Origin::Csms;
3221    type Response = UpdateFirmwareResponse;
3222}
3223
3224impl Confirmed for UpdateFirmwareRequest {}
3225
3226/// Spec: OCPP 1.6 · Firmware Management · CSMS → Charging Station · CALL.
3227#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
3228pub struct UpdateFirmwareResponse {}
3229
3230impl UpdateFirmwareResponse {
3231    /// Creates an empty `UpdateFirmwareResponse`. Every field of this type is optional.
3232    #[must_use]
3233    pub fn new() -> Self {
3234        Self::default()
3235    }
3236}
3237
3238impl Validate for UpdateFirmwareResponse {
3239    fn validate_at(&self, _path: &mut ValidationPath, _out: &mut Violations) {}
3240}
3241
3242impl Sealed for UpdateFirmwareResponse {}
3243impl Response for UpdateFirmwareResponse {}