Skip to main content

ocpi_types/
v2.1.1.rs

1// Example code that deserializes and serializes the model.
2// extern crate serde;
3// #[macro_use]
4// extern crate serde_derive;
5// extern crate serde_json;
6//
7// use generated_module::v2.1.1;
8//
9// fn main() {
10//     let json = r#"{"answer": 42}"#;
11//     let model: v2.1.1 = serde_json::from_str(&json).unwrap();
12// }
13
14use serde::{Serialize, Deserialize};
15
16#[derive(Serialize, Deserialize)]
17pub struct V211 {
18    cdr: Option<Cdr>,
19
20    connector: Option<Connector>,
21
22    credentials: Option<Credentials>,
23
24    evse: Option<Evse>,
25
26    location: Option<Location>,
27
28    session: Option<Session>,
29
30    tariff: Option<Tariff>,
31
32    token: Option<Token>,
33}
34
35#[derive(Serialize, Deserialize)]
36pub struct Cdr {
37    auth_id: String,
38
39    auth_method: AuthMethod,
40
41    charging_periods: Vec<ChargingPeriod>,
42
43    currency: String,
44
45    id: String,
46
47    last_updated: String,
48
49    location: CdrLocation,
50
51    meter_id: Option<String>,
52
53    remark: Option<String>,
54
55    start_date_time: String,
56
57    stop_date_time: String,
58
59    tariffs: Option<Vec<Tariff>>,
60
61    total_cost: f64,
62
63    total_energy: f64,
64
65    total_parking_time: Option<f64>,
66
67    total_time: f64,
68}
69
70#[derive(Serialize, Deserialize)]
71#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
72pub enum AuthMethod {
73    #[serde(rename = "AUTH_REQUEST")]
74    AuthRequest,
75
76    Whitelist,
77}
78
79#[derive(Serialize, Deserialize)]
80pub struct ChargingPeriod {
81    dimensions: Vec<Dimension>,
82
83    start_date_time: String,
84}
85
86#[derive(Serialize, Deserialize)]
87pub struct Dimension {
88    #[serde(rename = "type")]
89    dimension_type: DimensionType,
90
91    volume: f64,
92}
93
94#[derive(Serialize, Deserialize)]
95#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
96pub enum DimensionType {
97    Energy,
98
99    Flat,
100
101    #[serde(rename = "MAX_CURRENT")]
102    MaxCurrent,
103
104    #[serde(rename = "MIN_CURRENT")]
105    MinCurrent,
106
107    #[serde(rename = "PARKING_TIME")]
108    ParkingTime,
109
110    Time,
111}
112
113#[derive(Serialize, Deserialize)]
114pub struct CdrLocation {
115    id: String,
116
117    #[serde(rename = "type")]
118    location_type: LocationType,
119
120    address: String,
121
122    city: String,
123
124    postal_code: String,
125
126    country: String,
127
128    coordinates: GeoLocation,
129
130    last_updated: String,
131
132    charging_when_closed: Option<bool>,
133
134    directions: Option<Vec<DisplayText>>,
135
136    energy_mix: Option<EnergyMix>,
137
138    evses: Option<Vec<Evse>>,
139
140    facilities: Option<Vec<Facility>>,
141
142    images: Option<Vec<Image>>,
143
144    name: Option<String>,
145
146    opening_times: Option<Hours>,
147
148    operator: Option<BusinessDetails>,
149
150    owner: Option<BusinessDetails>,
151
152    related_locations: Option<Vec<RelatedLocation>>,
153
154    suboperator: Option<BusinessDetails>,
155
156    time_zone: Option<String>,
157}
158
159#[derive(Serialize, Deserialize)]
160pub struct GeoLocation {
161    latitude: Option<String>,
162
163    longitude: Option<String>,
164}
165
166#[derive(Serialize, Deserialize)]
167pub struct DisplayText {
168    language: String,
169
170    text: String,
171}
172
173#[derive(Serialize, Deserialize)]
174pub struct EnergyMix {
175    energy_product_name: Option<String>,
176
177    energy_sources: Option<Vec<EnergySource>>,
178
179    environ_impact: Option<Vec<EnvironImpact>>,
180
181    is_green_energy: bool,
182
183    supplier_name: Option<String>,
184}
185
186#[derive(Serialize, Deserialize)]
187pub struct EnergySource {
188    percentage: f64,
189
190    source: EnergySourceSource,
191}
192
193#[derive(Serialize, Deserialize)]
194#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
195pub enum EnergySourceSource {
196    Coal,
197
198    Gas,
199
200    #[serde(rename = "GENERAL_FOSSIL")]
201    GeneralFossil,
202
203    #[serde(rename = "GENERAL_GREEN")]
204    GeneralGreen,
205
206    Nuclear,
207
208    Solar,
209
210    Water,
211
212    Wind,
213}
214
215#[derive(Serialize, Deserialize)]
216pub struct EnvironImpact {
217    amount: f64,
218
219    source: EnvironImpactSource,
220}
221
222#[derive(Serialize, Deserialize)]
223#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
224pub enum EnvironImpactSource {
225    #[serde(rename = "CARBON_DIOXIDE")]
226    CarbonDioxide,
227
228    #[serde(rename = "NUCLEAR_WASTE")]
229    NuclearWaste,
230}
231
232#[derive(Serialize, Deserialize)]
233pub struct Evse {
234    capabilities: Option<Vec<Capability>>,
235
236    connectors: Option<Vec<Connector>>,
237
238    coordinates: Option<GeoLocation>,
239
240    directions: Option<Vec<DisplayText>>,
241
242    evse_id: Option<String>,
243
244    floor_level: Option<String>,
245
246    images: Option<Vec<Image>>,
247
248    last_updated: Option<String>,
249
250    parking_restrictions: Option<Vec<ParkingRestriction>>,
251
252    physical_reference: Option<String>,
253
254    status: Option<EvseStatus>,
255
256    status_schedule: Option<Vec<StatusSchedule>>,
257
258    uid: Option<String>,
259}
260
261#[derive(Serialize, Deserialize)]
262#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
263pub enum Capability {
264    #[serde(rename = "CHARGING_PROFILE_CAPABLE")]
265    ChargingProfileCapable,
266
267    #[serde(rename = "CREDIT_CARD_PAYABLE")]
268    CreditCardPayable,
269
270    #[serde(rename = "REMOTE_START_STOP_CAPABLE")]
271    RemoteStartStopCapable,
272
273    Reservable,
274
275    #[serde(rename = "RFID_READER")]
276    RfidReader,
277
278    #[serde(rename = "UNLOCK_CAPABLE")]
279    UnlockCapable,
280}
281
282#[derive(Serialize, Deserialize)]
283pub struct Connector {
284    amperage: Option<i64>,
285
286    format: Option<Format>,
287
288    id: Option<String>,
289
290    last_updated: Option<String>,
291
292    power_type: Option<PowerType>,
293
294    standard: Option<Standard>,
295
296    tariff_id: Option<String>,
297
298    terms_and_conditions: Option<String>,
299
300    voltage: Option<i64>,
301}
302
303#[derive(Serialize, Deserialize)]
304pub enum Format {
305    #[serde(rename = "CABLE")]
306    Cable,
307
308    #[serde(rename = "SOCKET")]
309    Socket,
310}
311
312#[derive(Serialize, Deserialize)]
313#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
314pub enum PowerType {
315    #[serde(rename = "AC_1_PHASE")]
316    Ac1_Phase,
317
318    #[serde(rename = "AC_3_PHASE")]
319    Ac3_Phase,
320
321    Dc,
322}
323
324#[derive(Serialize, Deserialize)]
325#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
326pub enum Standard {
327    Chademo,
328
329    #[serde(rename = "DOMESTIC_A")]
330    DomesticA,
331
332    #[serde(rename = "DOMESTIC_B")]
333    DomesticB,
334
335    #[serde(rename = "DOMESTIC_C")]
336    DomesticC,
337
338    #[serde(rename = "DOMESTIC_D")]
339    DomesticD,
340
341    #[serde(rename = "DOMESTIC_E")]
342    DomesticE,
343
344    #[serde(rename = "DOMESTIC_F")]
345    DomesticF,
346
347    #[serde(rename = "DOMESTIC_G")]
348    DomesticG,
349
350    #[serde(rename = "DOMESTIC_H")]
351    DomesticH,
352
353    #[serde(rename = "DOMESTIC_I")]
354    DomesticI,
355
356    #[serde(rename = "DOMESTIC_J")]
357    DomesticJ,
358
359    #[serde(rename = "DOMESTIC_K")]
360    DomesticK,
361
362    #[serde(rename = "DOMESTIC_L")]
363    DomesticL,
364
365    #[serde(rename = "IEC_60309_2_single_16")]
366    Iec60309_2_Single16,
367
368    #[serde(rename = "IEC_60309_2_three_16")]
369    Iec60309_2_Three16,
370
371    #[serde(rename = "IEC_60309_2_three_32")]
372    Iec60309_2_Three32,
373
374    #[serde(rename = "IEC_60309_2_three_64")]
375    Iec60309_2_Three64,
376
377    #[serde(rename = "IEC_62196_T1")]
378    Iec62196_T1,
379
380    #[serde(rename = "IEC_62196_T1_COMBO")]
381    Iec62196_T1Combo,
382
383    #[serde(rename = "IEC_62196_T2")]
384    Iec62196_T2,
385
386    #[serde(rename = "IEC_62196_T2_COMBO")]
387    Iec62196_T2Combo,
388
389    #[serde(rename = "IEC_62196_T3A")]
390    Iec62196_T3A,
391
392    #[serde(rename = "IEC_62196_T3C")]
393    Iec62196_T3C,
394
395    #[serde(rename = "TESLA_R")]
396    TeslaR,
397
398    #[serde(rename = "TESLA_S")]
399    TeslaS,
400}
401
402#[derive(Serialize, Deserialize)]
403pub struct Image {
404    category: Category,
405
406    height: Option<i64>,
407
408    thumbnail: Option<String>,
409
410    #[serde(rename = "type")]
411    image_type: String,
412
413    url: String,
414
415    width: Option<i64>,
416}
417
418#[derive(Serialize, Deserialize)]
419pub enum Category {
420    #[serde(rename = "CHARGER")]
421    Charger,
422
423    #[serde(rename = "ENTRANCE")]
424    Entrance,
425
426    #[serde(rename = "LOCATION")]
427    Location,
428
429    #[serde(rename = "NETWORK")]
430    Network,
431
432    #[serde(rename = "OPERATOR")]
433    Operator,
434
435    #[serde(rename = "OTHER")]
436    Other,
437
438    #[serde(rename = "OWNER")]
439    Owner,
440}
441
442#[derive(Serialize, Deserialize)]
443#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
444pub enum ParkingRestriction {
445    Customers,
446
447    Disabled,
448
449    #[serde(rename = "EV_ONLY")]
450    EvOnly,
451
452    Motorcycles,
453
454    Plugged,
455}
456
457#[derive(Serialize, Deserialize)]
458pub enum EvseStatus {
459    #[serde(rename = "AVAILABLE")]
460    Available,
461
462    #[serde(rename = "BLOCKED")]
463    Blocked,
464
465    #[serde(rename = "CHARGING")]
466    Charging,
467
468    #[serde(rename = "INOPERATIVE")]
469    Inoperative,
470
471    #[serde(rename = "OUTOFORDER")]
472    Outoforder,
473
474    #[serde(rename = "PLANNED")]
475    Planned,
476
477    #[serde(rename = "REMOVED")]
478    Removed,
479
480    #[serde(rename = "RESERVED")]
481    Reserved,
482
483    #[serde(rename = "UNKNOWN")]
484    Unknown,
485}
486
487#[derive(Serialize, Deserialize)]
488pub struct StatusSchedule {
489    period_begin: String,
490
491    period_end: Option<String>,
492
493    status: EvseStatus,
494}
495
496#[derive(Serialize, Deserialize)]
497#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
498pub enum Facility {
499    Airport,
500
501    #[serde(rename = "BUS_STOP")]
502    BusStop,
503
504    Cafe,
505
506    #[serde(rename = "CARPOOL_PARKING")]
507    CarpoolParking,
508
509    #[serde(rename = "FUEL_STATION")]
510    FuelStation,
511
512    Hotel,
513
514    Mall,
515
516    Museum,
517
518    Nature,
519
520    #[serde(rename = "RECREATION_AREA")]
521    RecreationArea,
522
523    Restaurant,
524
525    Sport,
526
527    Supermarket,
528
529    #[serde(rename = "TAXI_STAND")]
530    TaxiStand,
531
532    #[serde(rename = "TRAIN_STATION")]
533    TrainStation,
534
535    Wifi,
536}
537
538#[derive(Serialize, Deserialize)]
539#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
540pub enum LocationType {
541    #[serde(rename = "ON_STREET")]
542    OnStreet,
543
544    Other,
545
546    #[serde(rename = "PARKING_GARAGE")]
547    ParkingGarage,
548
549    #[serde(rename = "PARKING_LOT")]
550    ParkingLot,
551
552    #[serde(rename = "UNDERGROUND_GARAGE")]
553    UndergroundGarage,
554
555    Unknown,
556}
557
558#[derive(Serialize, Deserialize)]
559pub struct Hours {
560    exceptional_closings: Option<Vec<ExceptionalPeriod>>,
561
562    exceptional_openings: Option<Vec<ExceptionalPeriod>>,
563
564    regular_hours: Option<Vec<RegularHours>>,
565
566    twentyfourseven: Option<bool>,
567}
568
569#[derive(Serialize, Deserialize)]
570pub struct ExceptionalPeriod {
571    period_begin: String,
572
573    period_end: String,
574}
575
576#[derive(Serialize, Deserialize)]
577pub struct RegularHours {
578    period_begin: Option<String>,
579
580    period_end: Option<String>,
581
582    weekday: Option<i64>,
583}
584
585#[derive(Serialize, Deserialize)]
586pub struct BusinessDetails {
587    logo: Option<Image>,
588
589    name: String,
590
591    website: Option<String>,
592}
593
594#[derive(Serialize, Deserialize)]
595pub struct RelatedLocation {
596    latitude: Option<String>,
597
598    longitude: Option<String>,
599
600    name: Option<DisplayText>,
601}
602
603#[derive(Serialize, Deserialize)]
604pub struct Tariff {
605    currency: String,
606
607    elements: Vec<TariffElement>,
608
609    energy_mix: Option<EnergyMix>,
610
611    id: String,
612
613    last_updated: String,
614
615    tariff_alt_text: Option<Vec<DisplayText>>,
616
617    tariff_alt_url: Option<String>,
618}
619
620#[derive(Serialize, Deserialize)]
621pub struct TariffElement {
622    price_components: Vec<PriceComponent>,
623
624    restrictions: Option<Restrictions>,
625}
626
627#[derive(Serialize, Deserialize)]
628pub struct PriceComponent {
629    price: f64,
630
631    step_size: i64,
632
633    #[serde(rename = "type")]
634    price_component_type: PriceComponentType,
635}
636
637#[derive(Serialize, Deserialize)]
638#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
639pub enum PriceComponentType {
640    Energy,
641
642    Flat,
643
644    #[serde(rename = "PARKING_TIME")]
645    ParkingTime,
646
647    Time,
648}
649
650#[derive(Serialize, Deserialize)]
651pub struct Restrictions {
652    day_of_week: Option<Vec<DayOfWeek>>,
653
654    end_date: Option<String>,
655
656    end_time: Option<String>,
657
658    max_duration: Option<i64>,
659
660    max_kwh: Option<f64>,
661
662    max_power: Option<f64>,
663
664    min_duration: Option<i64>,
665
666    min_kwh: Option<f64>,
667
668    min_power: Option<f64>,
669
670    start_date: Option<String>,
671
672    start_time: Option<String>,
673}
674
675#[derive(Serialize, Deserialize)]
676pub enum DayOfWeek {
677    #[serde(rename = "FRIDAY")]
678    Friday,
679
680    #[serde(rename = "MONDAY")]
681    Monday,
682
683    #[serde(rename = "SATURDAY")]
684    Saturday,
685
686    #[serde(rename = "SUNDAY")]
687    Sunday,
688
689    #[serde(rename = "THURSDAY")]
690    Thursday,
691
692    #[serde(rename = "TUESDAY")]
693    Tuesday,
694
695    #[serde(rename = "WEDNESDAY")]
696    Wednesday,
697}
698
699#[derive(Serialize, Deserialize)]
700pub struct Credentials {
701    business_details: Option<BusinessDetails>,
702
703    country_code: Option<String>,
704
705    party_id: Option<String>,
706
707    token: Option<String>,
708
709    url: Option<String>,
710}
711
712#[derive(Serialize, Deserialize)]
713pub struct Location {
714    address: Option<String>,
715
716    charging_when_closed: Option<bool>,
717
718    city: Option<String>,
719
720    coordinates: Option<GeoLocation>,
721
722    country: Option<String>,
723
724    directions: Option<Vec<DisplayText>>,
725
726    energy_mix: Option<EnergyMix>,
727
728    evses: Option<Vec<Evse>>,
729
730    facilities: Option<Vec<Facility>>,
731
732    id: Option<String>,
733
734    images: Option<Vec<Image>>,
735
736    last_updated: Option<String>,
737
738    name: Option<String>,
739
740    opening_times: Option<Hours>,
741
742    operator: Option<BusinessDetails>,
743
744    owner: Option<BusinessDetails>,
745
746    postal_code: Option<String>,
747
748    related_locations: Option<Vec<RelatedLocation>>,
749
750    suboperator: Option<BusinessDetails>,
751
752    time_zone: Option<String>,
753
754    #[serde(rename = "type")]
755    location_type: Option<LocationType>,
756}
757
758#[derive(Serialize, Deserialize)]
759pub struct Session {
760    auth_id: Option<String>,
761
762    auth_method: Option<AuthMethod>,
763
764    charging_periods: Option<Vec<ChargingPeriod>>,
765
766    currency: Option<String>,
767
768    end_datetime: Option<String>,
769
770    id: Option<String>,
771
772    kwh: Option<f64>,
773
774    last_updated: Option<String>,
775
776    location: Option<SessionLocation>,
777
778    meter_id: Option<String>,
779
780    start_datetime: Option<String>,
781
782    status: Option<Status>,
783
784    total_cost: Option<f64>,
785}
786
787#[derive(Serialize, Deserialize)]
788pub struct SessionLocation {
789    id: String,
790
791    #[serde(rename = "type")]
792    location_type: LocationType,
793
794    address: String,
795
796    city: String,
797
798    postal_code: String,
799
800    country: String,
801
802    coordinates: GeoLocation,
803
804    last_updated: String,
805
806    charging_when_closed: Option<bool>,
807
808    directions: Option<Vec<DisplayText>>,
809
810    energy_mix: Option<EnergyMix>,
811
812    evses: Option<Vec<Evse>>,
813
814    facilities: Option<Vec<Facility>>,
815
816    images: Option<Vec<Image>>,
817
818    name: Option<String>,
819
820    opening_times: Option<Hours>,
821
822    operator: Option<BusinessDetails>,
823
824    owner: Option<BusinessDetails>,
825
826    related_locations: Option<Vec<RelatedLocation>>,
827
828    suboperator: Option<BusinessDetails>,
829
830    time_zone: Option<String>,
831}
832
833#[derive(Serialize, Deserialize)]
834pub enum Status {
835    #[serde(rename = "ACTIVE")]
836    Active,
837
838    #[serde(rename = "COMPLETED")]
839    Completed,
840
841    #[serde(rename = "INVALID")]
842    Invalid,
843
844    #[serde(rename = "PENDING")]
845    Pending,
846}
847
848#[derive(Serialize, Deserialize)]
849pub struct Token {
850    auth_id: Option<String>,
851
852    issuer: Option<String>,
853
854    language: Option<String>,
855
856    last_updated: Option<String>,
857
858    #[serde(rename = "type")]
859    token_type: Option<TokenType>,
860
861    uid: Option<String>,
862
863    valid: Option<bool>,
864
865    visual_number: Option<String>,
866
867    whitelist: Option<Whitelist>,
868}
869
870#[derive(Serialize, Deserialize)]
871pub enum TokenType {
872    #[serde(rename = "OTHER")]
873    Other,
874
875    #[serde(rename = "RFID")]
876    Rfid,
877}
878
879#[derive(Serialize, Deserialize)]
880#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
881pub enum Whitelist {
882    Allowed,
883
884    #[serde(rename = "ALLOWED_OFFLINE")]
885    AllowedOffline,
886
887    Always,
888
889    Never,
890}