Skip to main content

codetics_ocpp16/
messages.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Kevin Vavelin, Codetics (https://codetics.fr)
3
4//! OCPP 1.6 request / response payloads.
5
6use ocpp_core::DateTime;
7use ocpp_core::validate::{self as v, Path, Validate, Violation};
8use serde::{Deserialize, Serialize};
9
10use crate::datatypes::*;
11use crate::enums::*;
12
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14#[serde(deny_unknown_fields)]
15pub struct AuthorizeRequest {
16    #[serde(rename = "idTag")]
17    pub id_tag: String,
18}
19
20impl Validate for AuthorizeRequest {
21    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
22        {
23            let x = &self.id_tag;
24            let p = path.field("idTag");
25            v::max_length(x, 20, &p)?;
26        }
27        Ok(())
28    }
29}
30
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32#[serde(deny_unknown_fields)]
33pub struct AuthorizeResponse {
34    #[serde(rename = "idTagInfo")]
35    pub id_tag_info: IdTagInfo,
36}
37
38impl Validate for AuthorizeResponse {
39    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
40        {
41            let x = &self.id_tag_info;
42            let p = path.field("idTagInfo");
43            x.validate(&p)?;
44        }
45        Ok(())
46    }
47}
48
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50#[serde(deny_unknown_fields)]
51pub struct BootNotificationRequest {
52    #[serde(rename = "chargePointVendor")]
53    pub charge_point_vendor: String,
54    #[serde(rename = "chargePointModel")]
55    pub charge_point_model: String,
56    #[serde(
57        rename = "chargePointSerialNumber",
58        default,
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub charge_point_serial_number: Option<String>,
62    #[serde(
63        rename = "chargeBoxSerialNumber",
64        default,
65        skip_serializing_if = "Option::is_none"
66    )]
67    pub charge_box_serial_number: Option<String>,
68    #[serde(
69        rename = "firmwareVersion",
70        default,
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub firmware_version: Option<String>,
74    #[serde(rename = "iccid", default, skip_serializing_if = "Option::is_none")]
75    pub iccid: Option<String>,
76    #[serde(rename = "imsi", default, skip_serializing_if = "Option::is_none")]
77    pub imsi: Option<String>,
78    #[serde(rename = "meterType", default, skip_serializing_if = "Option::is_none")]
79    pub meter_type: Option<String>,
80    #[serde(
81        rename = "meterSerialNumber",
82        default,
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub meter_serial_number: Option<String>,
86}
87
88impl Validate for BootNotificationRequest {
89    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
90        {
91            let x = &self.charge_point_vendor;
92            let p = path.field("chargePointVendor");
93            v::max_length(x, 20, &p)?;
94        }
95        {
96            let x = &self.charge_point_model;
97            let p = path.field("chargePointModel");
98            v::max_length(x, 20, &p)?;
99        }
100        if let Some(x) = &self.charge_point_serial_number {
101            let p = path.field("chargePointSerialNumber");
102            v::max_length(x, 25, &p)?;
103        }
104        if let Some(x) = &self.charge_box_serial_number {
105            let p = path.field("chargeBoxSerialNumber");
106            v::max_length(x, 25, &p)?;
107        }
108        if let Some(x) = &self.firmware_version {
109            let p = path.field("firmwareVersion");
110            v::max_length(x, 50, &p)?;
111        }
112        if let Some(x) = &self.iccid {
113            let p = path.field("iccid");
114            v::max_length(x, 20, &p)?;
115        }
116        if let Some(x) = &self.imsi {
117            let p = path.field("imsi");
118            v::max_length(x, 20, &p)?;
119        }
120        if let Some(x) = &self.meter_type {
121            let p = path.field("meterType");
122            v::max_length(x, 25, &p)?;
123        }
124        if let Some(x) = &self.meter_serial_number {
125            let p = path.field("meterSerialNumber");
126            v::max_length(x, 25, &p)?;
127        }
128        Ok(())
129    }
130}
131
132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
133#[serde(deny_unknown_fields)]
134pub struct BootNotificationResponse {
135    #[serde(rename = "status")]
136    pub status: RegistrationStatus,
137    #[serde(rename = "currentTime")]
138    pub current_time: DateTime,
139    #[serde(rename = "interval")]
140    pub interval: i64,
141}
142
143impl Validate for BootNotificationResponse {
144    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
145        Ok(())
146    }
147}
148
149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
150#[serde(deny_unknown_fields)]
151pub struct CancelReservationRequest {
152    #[serde(rename = "reservationId")]
153    pub reservation_id: i64,
154}
155
156impl Validate for CancelReservationRequest {
157    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
158        Ok(())
159    }
160}
161
162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
163#[serde(deny_unknown_fields)]
164pub struct CancelReservationResponse {
165    #[serde(rename = "status")]
166    pub status: CancelReservationStatus,
167}
168
169impl Validate for CancelReservationResponse {
170    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
171        Ok(())
172    }
173}
174
175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
176#[serde(deny_unknown_fields)]
177pub struct ChangeAvailabilityRequest {
178    #[serde(rename = "connectorId")]
179    pub connector_id: i64,
180    #[serde(rename = "type")]
181    pub r#type: AvailabilityType,
182}
183
184impl Validate for ChangeAvailabilityRequest {
185    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
186        Ok(())
187    }
188}
189
190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
191#[serde(deny_unknown_fields)]
192pub struct ChangeAvailabilityResponse {
193    #[serde(rename = "status")]
194    pub status: AvailabilityStatus,
195}
196
197impl Validate for ChangeAvailabilityResponse {
198    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
199        Ok(())
200    }
201}
202
203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
204#[serde(deny_unknown_fields)]
205pub struct ChangeConfigurationRequest {
206    #[serde(rename = "key")]
207    pub key: String,
208    #[serde(rename = "value")]
209    pub value: String,
210}
211
212impl Validate for ChangeConfigurationRequest {
213    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
214        {
215            let x = &self.key;
216            let p = path.field("key");
217            v::max_length(x, 50, &p)?;
218        }
219        {
220            let x = &self.value;
221            let p = path.field("value");
222            v::max_length(x, 500, &p)?;
223        }
224        Ok(())
225    }
226}
227
228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
229#[serde(deny_unknown_fields)]
230pub struct ChangeConfigurationResponse {
231    #[serde(rename = "status")]
232    pub status: ConfigurationStatus,
233}
234
235impl Validate for ChangeConfigurationResponse {
236    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
237        Ok(())
238    }
239}
240
241#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
242#[serde(deny_unknown_fields)]
243pub struct ClearCacheRequest {}
244
245impl Validate for ClearCacheRequest {
246    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
247        Ok(())
248    }
249}
250
251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
252#[serde(deny_unknown_fields)]
253pub struct ClearCacheResponse {
254    #[serde(rename = "status")]
255    pub status: ClearCacheStatus,
256}
257
258impl Validate for ClearCacheResponse {
259    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
260        Ok(())
261    }
262}
263
264#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
265#[serde(deny_unknown_fields)]
266pub struct ClearChargingProfileRequest {
267    #[serde(rename = "id", default, skip_serializing_if = "Option::is_none")]
268    pub id: Option<i64>,
269    #[serde(
270        rename = "connectorId",
271        default,
272        skip_serializing_if = "Option::is_none"
273    )]
274    pub connector_id: Option<i64>,
275    #[serde(
276        rename = "chargingProfilePurpose",
277        default,
278        skip_serializing_if = "Option::is_none"
279    )]
280    pub charging_profile_purpose: Option<ChargingProfilePurposeType>,
281    #[serde(
282        rename = "stackLevel",
283        default,
284        skip_serializing_if = "Option::is_none"
285    )]
286    pub stack_level: Option<i64>,
287}
288
289impl Validate for ClearChargingProfileRequest {
290    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
291        Ok(())
292    }
293}
294
295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
296#[serde(deny_unknown_fields)]
297pub struct ClearChargingProfileResponse {
298    #[serde(rename = "status")]
299    pub status: ClearChargingProfileStatus,
300}
301
302impl Validate for ClearChargingProfileResponse {
303    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
304        Ok(())
305    }
306}
307
308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
309#[serde(deny_unknown_fields)]
310pub struct DataTransferRequest {
311    #[serde(rename = "vendorId")]
312    pub vendor_id: String,
313    #[serde(rename = "messageId", default, skip_serializing_if = "Option::is_none")]
314    pub message_id: Option<String>,
315    #[serde(rename = "data", default, skip_serializing_if = "Option::is_none")]
316    pub data: Option<String>,
317}
318
319impl Validate for DataTransferRequest {
320    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
321        {
322            let x = &self.vendor_id;
323            let p = path.field("vendorId");
324            v::max_length(x, 255, &p)?;
325        }
326        if let Some(x) = &self.message_id {
327            let p = path.field("messageId");
328            v::max_length(x, 50, &p)?;
329        }
330        Ok(())
331    }
332}
333
334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
335#[serde(deny_unknown_fields)]
336pub struct DataTransferResponse {
337    #[serde(rename = "status")]
338    pub status: DataTransferStatus,
339    #[serde(rename = "data", default, skip_serializing_if = "Option::is_none")]
340    pub data: Option<String>,
341}
342
343impl Validate for DataTransferResponse {
344    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
345        Ok(())
346    }
347}
348
349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
350#[serde(deny_unknown_fields)]
351pub struct DiagnosticsStatusNotificationRequest {
352    #[serde(rename = "status")]
353    pub status: DiagnosticsStatus,
354}
355
356impl Validate for DiagnosticsStatusNotificationRequest {
357    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
358        Ok(())
359    }
360}
361
362#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
363#[serde(deny_unknown_fields)]
364pub struct DiagnosticsStatusNotificationResponse {}
365
366impl Validate for DiagnosticsStatusNotificationResponse {
367    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
368        Ok(())
369    }
370}
371
372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
373#[serde(deny_unknown_fields)]
374pub struct FirmwareStatusNotificationRequest {
375    #[serde(rename = "status")]
376    pub status: FirmwareStatus,
377}
378
379impl Validate for FirmwareStatusNotificationRequest {
380    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
381        Ok(())
382    }
383}
384
385#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
386#[serde(deny_unknown_fields)]
387pub struct FirmwareStatusNotificationResponse {}
388
389impl Validate for FirmwareStatusNotificationResponse {
390    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
391        Ok(())
392    }
393}
394
395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
396#[serde(deny_unknown_fields)]
397pub struct GetCompositeScheduleRequest {
398    #[serde(rename = "connectorId")]
399    pub connector_id: i64,
400    #[serde(rename = "duration")]
401    pub duration: i64,
402    #[serde(
403        rename = "chargingRateUnit",
404        default,
405        skip_serializing_if = "Option::is_none"
406    )]
407    pub charging_rate_unit: Option<ChargingRateUnitType>,
408}
409
410impl Validate for GetCompositeScheduleRequest {
411    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
412        Ok(())
413    }
414}
415
416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
417#[serde(deny_unknown_fields)]
418pub struct GetCompositeScheduleResponse {
419    #[serde(rename = "status")]
420    pub status: GetCompositeScheduleStatus,
421    #[serde(
422        rename = "connectorId",
423        default,
424        skip_serializing_if = "Option::is_none"
425    )]
426    pub connector_id: Option<i64>,
427    #[serde(
428        rename = "scheduleStart",
429        default,
430        skip_serializing_if = "Option::is_none"
431    )]
432    pub schedule_start: Option<DateTime>,
433    #[serde(
434        rename = "chargingSchedule",
435        default,
436        skip_serializing_if = "Option::is_none"
437    )]
438    pub charging_schedule: Option<ChargingSchedule>,
439}
440
441impl Validate for GetCompositeScheduleResponse {
442    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
443        if let Some(x) = &self.charging_schedule {
444            let p = path.field("chargingSchedule");
445            x.validate(&p)?;
446        }
447        Ok(())
448    }
449}
450
451#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
452#[serde(deny_unknown_fields)]
453pub struct GetConfigurationRequest {
454    #[serde(rename = "key", default, skip_serializing_if = "Option::is_none")]
455    pub key: Option<Vec<String>>,
456}
457
458impl Validate for GetConfigurationRequest {
459    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
460        if let Some(x) = &self.key {
461            let p = path.field("key");
462            for (i0, it0) in x.iter().enumerate() {
463                let p0 = p.index(i0);
464                v::max_length(it0, 50, &p0)?;
465            }
466        }
467        Ok(())
468    }
469}
470
471#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
472#[serde(deny_unknown_fields)]
473pub struct GetConfigurationResponse {
474    #[serde(
475        rename = "configurationKey",
476        default,
477        skip_serializing_if = "Option::is_none"
478    )]
479    pub configuration_key: Option<Vec<KeyValue>>,
480    #[serde(
481        rename = "unknownKey",
482        default,
483        skip_serializing_if = "Option::is_none"
484    )]
485    pub unknown_key: Option<Vec<String>>,
486}
487
488impl Validate for GetConfigurationResponse {
489    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
490        if let Some(x) = &self.configuration_key {
491            let p = path.field("configurationKey");
492            for (i0, it0) in x.iter().enumerate() {
493                let p0 = p.index(i0);
494                it0.validate(&p0)?;
495            }
496        }
497        if let Some(x) = &self.unknown_key {
498            let p = path.field("unknownKey");
499            for (i0, it0) in x.iter().enumerate() {
500                let p0 = p.index(i0);
501                v::max_length(it0, 50, &p0)?;
502            }
503        }
504        Ok(())
505    }
506}
507
508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
509#[serde(deny_unknown_fields)]
510pub struct GetDiagnosticsRequest {
511    #[serde(rename = "location")]
512    pub location: String,
513    #[serde(rename = "retries", default, skip_serializing_if = "Option::is_none")]
514    pub retries: Option<i64>,
515    #[serde(
516        rename = "retryInterval",
517        default,
518        skip_serializing_if = "Option::is_none"
519    )]
520    pub retry_interval: Option<i64>,
521    #[serde(rename = "startTime", default, skip_serializing_if = "Option::is_none")]
522    pub start_time: Option<DateTime>,
523    #[serde(rename = "stopTime", default, skip_serializing_if = "Option::is_none")]
524    pub stop_time: Option<DateTime>,
525}
526
527impl Validate for GetDiagnosticsRequest {
528    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
529        Ok(())
530    }
531}
532
533#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
534#[serde(deny_unknown_fields)]
535pub struct GetDiagnosticsResponse {
536    #[serde(rename = "fileName", default, skip_serializing_if = "Option::is_none")]
537    pub file_name: Option<String>,
538}
539
540impl Validate for GetDiagnosticsResponse {
541    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
542        if let Some(x) = &self.file_name {
543            let p = path.field("fileName");
544            v::max_length(x, 255, &p)?;
545        }
546        Ok(())
547    }
548}
549
550#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
551#[serde(deny_unknown_fields)]
552pub struct GetLocalListVersionRequest {}
553
554impl Validate for GetLocalListVersionRequest {
555    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
556        Ok(())
557    }
558}
559
560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
561#[serde(deny_unknown_fields)]
562pub struct GetLocalListVersionResponse {
563    #[serde(rename = "listVersion")]
564    pub list_version: i64,
565}
566
567impl Validate for GetLocalListVersionResponse {
568    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
569        Ok(())
570    }
571}
572
573#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
574#[serde(deny_unknown_fields)]
575pub struct HeartbeatRequest {}
576
577impl Validate for HeartbeatRequest {
578    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
579        Ok(())
580    }
581}
582
583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
584#[serde(deny_unknown_fields)]
585pub struct HeartbeatResponse {
586    #[serde(rename = "currentTime")]
587    pub current_time: DateTime,
588}
589
590impl Validate for HeartbeatResponse {
591    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
592        Ok(())
593    }
594}
595
596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
597#[serde(deny_unknown_fields)]
598pub struct MeterValuesRequest {
599    #[serde(rename = "connectorId")]
600    pub connector_id: i64,
601    #[serde(
602        rename = "transactionId",
603        default,
604        skip_serializing_if = "Option::is_none"
605    )]
606    pub transaction_id: Option<i64>,
607    #[serde(rename = "meterValue")]
608    pub meter_value: Vec<MeterValue>,
609}
610
611impl Validate for MeterValuesRequest {
612    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
613        Ok(())
614    }
615}
616
617#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
618#[serde(deny_unknown_fields)]
619pub struct MeterValuesResponse {}
620
621impl Validate for MeterValuesResponse {
622    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
623        Ok(())
624    }
625}
626
627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
628#[serde(deny_unknown_fields)]
629pub struct RemoteStartTransactionRequest {
630    #[serde(
631        rename = "connectorId",
632        default,
633        skip_serializing_if = "Option::is_none"
634    )]
635    pub connector_id: Option<i64>,
636    #[serde(rename = "idTag")]
637    pub id_tag: String,
638    #[serde(
639        rename = "chargingProfile",
640        default,
641        skip_serializing_if = "Option::is_none"
642    )]
643    pub charging_profile: Option<ChargingProfile>,
644}
645
646impl Validate for RemoteStartTransactionRequest {
647    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
648        {
649            let x = &self.id_tag;
650            let p = path.field("idTag");
651            v::max_length(x, 20, &p)?;
652        }
653        if let Some(x) = &self.charging_profile {
654            let p = path.field("chargingProfile");
655            x.validate(&p)?;
656        }
657        Ok(())
658    }
659}
660
661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
662#[serde(deny_unknown_fields)]
663pub struct RemoteStartTransactionResponse {
664    #[serde(rename = "status")]
665    pub status: RemoteStartStopStatus,
666}
667
668impl Validate for RemoteStartTransactionResponse {
669    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
670        Ok(())
671    }
672}
673
674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
675#[serde(deny_unknown_fields)]
676pub struct RemoteStopTransactionRequest {
677    #[serde(rename = "transactionId")]
678    pub transaction_id: i64,
679}
680
681impl Validate for RemoteStopTransactionRequest {
682    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
683        Ok(())
684    }
685}
686
687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
688#[serde(deny_unknown_fields)]
689pub struct RemoteStopTransactionResponse {
690    #[serde(rename = "status")]
691    pub status: RemoteStartStopStatus,
692}
693
694impl Validate for RemoteStopTransactionResponse {
695    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
696        Ok(())
697    }
698}
699
700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
701#[serde(deny_unknown_fields)]
702pub struct ReserveNowRequest {
703    #[serde(rename = "connectorId")]
704    pub connector_id: i64,
705    #[serde(rename = "expiryDate")]
706    pub expiry_date: DateTime,
707    #[serde(rename = "idTag")]
708    pub id_tag: String,
709    #[serde(
710        rename = "parentIdTag",
711        default,
712        skip_serializing_if = "Option::is_none"
713    )]
714    pub parent_id_tag: Option<String>,
715    #[serde(rename = "reservationId")]
716    pub reservation_id: i64,
717}
718
719impl Validate for ReserveNowRequest {
720    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
721        {
722            let x = &self.id_tag;
723            let p = path.field("idTag");
724            v::max_length(x, 20, &p)?;
725        }
726        if let Some(x) = &self.parent_id_tag {
727            let p = path.field("parentIdTag");
728            v::max_length(x, 20, &p)?;
729        }
730        Ok(())
731    }
732}
733
734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
735#[serde(deny_unknown_fields)]
736pub struct ReserveNowResponse {
737    #[serde(rename = "status")]
738    pub status: ReservationStatus,
739}
740
741impl Validate for ReserveNowResponse {
742    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
743        Ok(())
744    }
745}
746
747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
748#[serde(deny_unknown_fields)]
749pub struct ResetRequest {
750    #[serde(rename = "type")]
751    pub r#type: ResetType,
752}
753
754impl Validate for ResetRequest {
755    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
756        Ok(())
757    }
758}
759
760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
761#[serde(deny_unknown_fields)]
762pub struct ResetResponse {
763    #[serde(rename = "status")]
764    pub status: ResetStatus,
765}
766
767impl Validate for ResetResponse {
768    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
769        Ok(())
770    }
771}
772
773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
774#[serde(deny_unknown_fields)]
775pub struct SendLocalListRequest {
776    #[serde(rename = "listVersion")]
777    pub list_version: i64,
778    #[serde(
779        rename = "localAuthorizationList",
780        default,
781        skip_serializing_if = "Option::is_none"
782    )]
783    pub local_authorization_list: Option<Vec<AuthorizationData>>,
784    #[serde(rename = "updateType")]
785    pub update_type: UpdateType,
786}
787
788impl Validate for SendLocalListRequest {
789    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
790        if let Some(x) = &self.local_authorization_list {
791            let p = path.field("localAuthorizationList");
792            for (i0, it0) in x.iter().enumerate() {
793                let p0 = p.index(i0);
794                it0.validate(&p0)?;
795            }
796        }
797        Ok(())
798    }
799}
800
801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
802#[serde(deny_unknown_fields)]
803pub struct SendLocalListResponse {
804    #[serde(rename = "status")]
805    pub status: UpdateStatus,
806}
807
808impl Validate for SendLocalListResponse {
809    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
810        Ok(())
811    }
812}
813
814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
815#[serde(deny_unknown_fields)]
816pub struct SetChargingProfileRequest {
817    #[serde(rename = "connectorId")]
818    pub connector_id: i64,
819    #[serde(rename = "csChargingProfiles")]
820    pub cs_charging_profiles: ChargingProfile,
821}
822
823impl Validate for SetChargingProfileRequest {
824    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
825        {
826            let x = &self.cs_charging_profiles;
827            let p = path.field("csChargingProfiles");
828            x.validate(&p)?;
829        }
830        Ok(())
831    }
832}
833
834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
835#[serde(deny_unknown_fields)]
836pub struct SetChargingProfileResponse {
837    #[serde(rename = "status")]
838    pub status: ChargingProfileStatus,
839}
840
841impl Validate for SetChargingProfileResponse {
842    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
843        Ok(())
844    }
845}
846
847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
848#[serde(deny_unknown_fields)]
849pub struct StartTransactionRequest {
850    #[serde(rename = "connectorId")]
851    pub connector_id: i64,
852    #[serde(rename = "idTag")]
853    pub id_tag: String,
854    #[serde(rename = "meterStart")]
855    pub meter_start: i64,
856    #[serde(
857        rename = "reservationId",
858        default,
859        skip_serializing_if = "Option::is_none"
860    )]
861    pub reservation_id: Option<i64>,
862    #[serde(rename = "timestamp")]
863    pub timestamp: DateTime,
864}
865
866impl Validate for StartTransactionRequest {
867    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
868        {
869            let x = &self.id_tag;
870            let p = path.field("idTag");
871            v::max_length(x, 20, &p)?;
872        }
873        Ok(())
874    }
875}
876
877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
878#[serde(deny_unknown_fields)]
879pub struct StartTransactionResponse {
880    #[serde(rename = "idTagInfo")]
881    pub id_tag_info: IdTagInfo,
882    #[serde(rename = "transactionId")]
883    pub transaction_id: i64,
884}
885
886impl Validate for StartTransactionResponse {
887    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
888        {
889            let x = &self.id_tag_info;
890            let p = path.field("idTagInfo");
891            x.validate(&p)?;
892        }
893        Ok(())
894    }
895}
896
897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
898#[serde(deny_unknown_fields)]
899pub struct StatusNotificationRequest {
900    #[serde(rename = "connectorId")]
901    pub connector_id: i64,
902    #[serde(rename = "errorCode")]
903    pub error_code: ChargePointErrorCode,
904    #[serde(rename = "info", default, skip_serializing_if = "Option::is_none")]
905    pub info: Option<String>,
906    #[serde(rename = "status")]
907    pub status: ChargePointStatus,
908    #[serde(rename = "timestamp", default, skip_serializing_if = "Option::is_none")]
909    pub timestamp: Option<DateTime>,
910    #[serde(rename = "vendorId", default, skip_serializing_if = "Option::is_none")]
911    pub vendor_id: Option<String>,
912    #[serde(
913        rename = "vendorErrorCode",
914        default,
915        skip_serializing_if = "Option::is_none"
916    )]
917    pub vendor_error_code: Option<String>,
918}
919
920impl Validate for StatusNotificationRequest {
921    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
922        if let Some(x) = &self.info {
923            let p = path.field("info");
924            v::max_length(x, 50, &p)?;
925        }
926        if let Some(x) = &self.vendor_id {
927            let p = path.field("vendorId");
928            v::max_length(x, 255, &p)?;
929        }
930        if let Some(x) = &self.vendor_error_code {
931            let p = path.field("vendorErrorCode");
932            v::max_length(x, 50, &p)?;
933        }
934        Ok(())
935    }
936}
937
938#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
939#[serde(deny_unknown_fields)]
940pub struct StatusNotificationResponse {}
941
942impl Validate for StatusNotificationResponse {
943    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
944        Ok(())
945    }
946}
947
948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
949#[serde(deny_unknown_fields)]
950pub struct StopTransactionRequest {
951    #[serde(rename = "idTag", default, skip_serializing_if = "Option::is_none")]
952    pub id_tag: Option<String>,
953    #[serde(rename = "meterStop")]
954    pub meter_stop: i64,
955    #[serde(rename = "timestamp")]
956    pub timestamp: DateTime,
957    #[serde(rename = "transactionId")]
958    pub transaction_id: i64,
959    #[serde(rename = "reason", default, skip_serializing_if = "Option::is_none")]
960    pub reason: Option<Reason>,
961    #[serde(
962        rename = "transactionData",
963        default,
964        skip_serializing_if = "Option::is_none"
965    )]
966    pub transaction_data: Option<Vec<MeterValue>>,
967}
968
969impl Validate for StopTransactionRequest {
970    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
971        if let Some(x) = &self.id_tag {
972            let p = path.field("idTag");
973            v::max_length(x, 20, &p)?;
974        }
975        Ok(())
976    }
977}
978
979#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
980#[serde(deny_unknown_fields)]
981pub struct StopTransactionResponse {
982    #[serde(rename = "idTagInfo", default, skip_serializing_if = "Option::is_none")]
983    pub id_tag_info: Option<IdTagInfo>,
984}
985
986impl Validate for StopTransactionResponse {
987    fn validate(&self, path: &Path<'_>) -> Result<(), Violation> {
988        if let Some(x) = &self.id_tag_info {
989            let p = path.field("idTagInfo");
990            x.validate(&p)?;
991        }
992        Ok(())
993    }
994}
995
996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
997#[serde(deny_unknown_fields)]
998pub struct TriggerMessageRequest {
999    #[serde(rename = "requestedMessage")]
1000    pub requested_message: MessageTrigger,
1001    #[serde(
1002        rename = "connectorId",
1003        default,
1004        skip_serializing_if = "Option::is_none"
1005    )]
1006    pub connector_id: Option<i64>,
1007}
1008
1009impl Validate for TriggerMessageRequest {
1010    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1011        Ok(())
1012    }
1013}
1014
1015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1016#[serde(deny_unknown_fields)]
1017pub struct TriggerMessageResponse {
1018    #[serde(rename = "status")]
1019    pub status: TriggerMessageStatus,
1020}
1021
1022impl Validate for TriggerMessageResponse {
1023    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1024        Ok(())
1025    }
1026}
1027
1028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1029#[serde(deny_unknown_fields)]
1030pub struct UnlockConnectorRequest {
1031    #[serde(rename = "connectorId")]
1032    pub connector_id: i64,
1033}
1034
1035impl Validate for UnlockConnectorRequest {
1036    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1037        Ok(())
1038    }
1039}
1040
1041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1042#[serde(deny_unknown_fields)]
1043pub struct UnlockConnectorResponse {
1044    #[serde(rename = "status")]
1045    pub status: UnlockStatus,
1046}
1047
1048impl Validate for UnlockConnectorResponse {
1049    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1050        Ok(())
1051    }
1052}
1053
1054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1055#[serde(deny_unknown_fields)]
1056pub struct UpdateFirmwareRequest {
1057    #[serde(rename = "location")]
1058    pub location: String,
1059    #[serde(rename = "retries", default, skip_serializing_if = "Option::is_none")]
1060    pub retries: Option<i64>,
1061    #[serde(rename = "retrieveDate")]
1062    pub retrieve_date: DateTime,
1063    #[serde(
1064        rename = "retryInterval",
1065        default,
1066        skip_serializing_if = "Option::is_none"
1067    )]
1068    pub retry_interval: Option<i64>,
1069}
1070
1071impl Validate for UpdateFirmwareRequest {
1072    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1073        Ok(())
1074    }
1075}
1076
1077#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
1078#[serde(deny_unknown_fields)]
1079pub struct UpdateFirmwareResponse {}
1080
1081impl Validate for UpdateFirmwareResponse {
1082    fn validate(&self, _path: &Path<'_>) -> Result<(), Violation> {
1083        Ok(())
1084    }
1085}