tfl_api_wrapper/
models.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4pub type Line = Vec<Lines>;
5pub type Disruption = Vec<Disruptions>;
6pub type Arrival = Vec<Arrivals>;
7pub type StopPoint = Vec<StopPoints>;
8pub type DisruptionCategories = Vec<String>;
9pub type Modes = Vec<ValidMode>;
10pub type LServiceTypes = Vec<String>;
11pub type Serverities = Vec<Severity>;
12pub type Route = Vec<Routes>;
13pub type LineSeverity = Vec<LineSeverities>;
14pub type LineStatusBetweenDates = Vec<LineStatusesDates>;
15pub type LineStatusForModes = Vec<LineStatusesDates>;
16
17#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
18pub struct ApiException {
19    /// A string representing the class of exception.
20    pub exception: String,
21    /// Readable error message
22    pub doc: String,
23    /// TBD
24    pub display: String,
25}
26
27#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct SearchLinesRoutesByQuery {
30    #[serde(rename = "$type")]
31    pub type_field: String,
32    pub input: String,
33    pub search_matches: Vec<SearchMatch>,
34}
35
36#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
37#[serde(rename_all = "camelCase")]
38pub struct SearchMatch {
39    #[serde(rename = "$type")]
40    pub type_field: String,
41    pub line_id: String,
42    pub mode: String,
43    pub line_name: String,
44    pub line_route_section: Vec<LineRouteSection>,
45    pub matched_route_sections: Vec<Value>,
46    pub matched_stops: Vec<Value>,
47}
48
49#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
50#[serde(rename_all = "camelCase")]
51pub struct LineRouteSection {
52    #[serde(rename = "$type")]
53    pub type_field: String,
54    pub route_id: i64,
55    pub direction: String,
56    pub destination: String,
57    pub from_station: String,
58    pub to_station: String,
59    pub service_type: String,
60    pub vehicle_destination_text: String,
61}
62
63#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
64#[serde(rename_all = "camelCase")]
65pub struct TimetableForStationWithDestinationByLineID {
66    #[serde(rename = "$type")]
67    pub type_field: String,
68    pub line_id: String,
69    pub line_name: String,
70    pub direction: String,
71    pub stations: Vec<Station>,
72    pub stops: Vec<Stop>,
73    pub timetable: Timetable,
74}
75
76#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[serde(rename_all = "camelCase")]
78pub struct Stop {
79    #[serde(rename = "$type")]
80    pub type_field: String,
81    pub parent_id: Option<String>,
82    pub station_id: String,
83    pub ics_id: String,
84    pub top_most_parent_id: String,
85    pub modes: Vec<String>,
86    pub stop_type: String,
87    pub zone: String,
88    pub lines: Vec<Line2>,
89    pub status: bool,
90    pub id: String,
91    pub name: String,
92    pub lat: f64,
93    pub lon: f64,
94    pub has_disruption: Option<bool>,
95}
96
97#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
98#[serde(rename_all = "camelCase")]
99pub struct Timetable {
100    #[serde(rename = "$type")]
101    pub type_field: String,
102    pub departure_stop_id: String,
103    pub routes: Vec<TimetableRoute>,
104}
105
106#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
107#[serde(rename_all = "camelCase")]
108pub struct TimetableRoute {
109    #[serde(rename = "$type")]
110    pub type_field: String,
111    pub station_intervals: Vec<StationInterval>,
112    pub schedules: Vec<Schedule>,
113}
114
115#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
116#[serde(rename_all = "camelCase")]
117pub struct StationInterval {
118    #[serde(rename = "$type")]
119    pub type_field: String,
120    pub id: String,
121    pub intervals: Vec<Interval>,
122}
123
124#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
125#[serde(rename_all = "camelCase")]
126pub struct Interval {
127    #[serde(rename = "$type")]
128    pub type_field: String,
129    pub stop_id: String,
130    pub time_to_arrival: f64,
131}
132
133#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
134#[serde(rename_all = "camelCase")]
135pub struct Schedule {
136    #[serde(rename = "$type")]
137    pub type_field: String,
138    pub name: String,
139    pub known_journeys: Vec<KnownJourney>,
140    pub first_journey: FirstJourney,
141    pub last_journey: LastJourney,
142    pub periods: Vec<Period>,
143}
144
145#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
146#[serde(rename_all = "camelCase")]
147pub struct KnownJourney {
148    #[serde(rename = "$type")]
149    pub type_field: String,
150    pub hour: String,
151    pub minute: String,
152    pub interval_id: i64,
153}
154
155#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
156#[serde(rename_all = "camelCase")]
157pub struct FirstJourney {
158    #[serde(rename = "$type")]
159    pub type_field: String,
160    pub hour: String,
161    pub minute: String,
162    pub interval_id: i64,
163}
164
165#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
166#[serde(rename_all = "camelCase")]
167pub struct LastJourney {
168    #[serde(rename = "$type")]
169    pub type_field: String,
170    pub hour: String,
171    pub minute: String,
172    pub interval_id: i64,
173}
174
175#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
176#[serde(rename_all = "camelCase")]
177pub struct Period {
178    #[serde(rename = "$type")]
179    pub type_field: String,
180    #[serde(rename = "type")]
181    pub type_field2: String,
182    pub from_time: FromTime,
183    pub to_time: ToTime,
184    pub frequency: Option<Frequency>,
185}
186
187#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
188#[serde(rename_all = "camelCase")]
189pub struct FromTime {
190    #[serde(rename = "$type")]
191    pub type_field: String,
192    pub hour: String,
193    pub minute: String,
194}
195
196#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
197#[serde(rename_all = "camelCase")]
198pub struct ToTime {
199    #[serde(rename = "$type")]
200    pub type_field: String,
201    pub hour: String,
202    pub minute: String,
203}
204
205#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
206#[serde(rename_all = "camelCase")]
207pub struct Frequency {
208    #[serde(rename = "$type")]
209    pub type_field: String,
210    pub lowest_frequency: f64,
211    pub highest_frequency: f64,
212}
213
214#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
215#[serde(rename_all = "camelCase")]
216pub struct TimetableForStationByLineID {
217    #[serde(rename = "$type")]
218    pub type_field: String,
219    pub disambiguation: Disambiguation,
220}
221
222#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
223#[serde(rename_all = "camelCase")]
224pub struct Disambiguation {
225    #[serde(rename = "$type")]
226    pub type_field: String,
227    pub disambiguation_options: Vec<DisambiguationOption>,
228}
229
230#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
231#[serde(rename_all = "camelCase")]
232pub struct DisambiguationOption {
233    #[serde(rename = "$type")]
234    pub type_field: String,
235    pub description: String,
236    pub uri: String,
237}
238
239#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
240#[serde(rename_all = "camelCase")]
241pub struct LineStatusesDates {
242    #[serde(rename = "$type")]
243    pub type_field: String,
244    pub id: String,
245    pub name: String,
246    pub mode_name: String,
247    pub disruptions: Vec<Value>,
248    pub created: String,
249    pub modified: String,
250    pub line_statuses: Vec<LineStatusesBetweenDates>,
251    pub route_sections: Vec<Value>,
252    pub service_types: Vec<ServiceType>,
253    pub crowding: Crowding,
254}
255
256#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
257#[serde(rename_all = "camelCase")]
258pub struct LineStatusesBetweenDates {
259    #[serde(rename = "$type")]
260    pub type_field: String,
261    pub id: i64,
262    pub status_severity: i64,
263    pub status_severity_description: String,
264    pub created: String,
265    pub validity_periods: Vec<Value>,
266}
267
268#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
269#[serde(rename_all = "camelCase")]
270pub struct LineSeverities {
271    #[serde(rename = "$type")]
272    pub type_field: String,
273    pub id: String,
274    pub name: String,
275    pub mode_name: String,
276    pub disruptions: Vec<Value>,
277    pub created: String,
278    pub modified: String,
279    pub line_statuses: Vec<LineStatuses>,
280    pub route_sections: Vec<Value>,
281    pub service_types: Vec<ServiceType>,
282    pub crowding: Crowding,
283}
284
285#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
286#[serde(rename_all = "camelCase")]
287pub struct LineStatuses {
288    #[serde(rename = "$type")]
289    pub type_field: String,
290    pub id: i64,
291    pub line_id: String,
292    pub status_severity: i64,
293    pub status_severity_description: String,
294    pub reason: String,
295    pub created: String,
296    pub validity_periods: Vec<ValidityPeriod>,
297    pub disruption: SevDisruption,
298}
299
300#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
301#[serde(rename_all = "camelCase")]
302pub struct ValidityPeriod {
303    #[serde(rename = "$type")]
304    pub type_field: String,
305    pub from_date: String,
306    pub to_date: String,
307    pub is_now: bool,
308}
309
310#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
311#[serde(rename_all = "camelCase")]
312pub struct SevDisruption {
313    #[serde(rename = "$type")]
314    pub type_field: String,
315    pub category: String,
316    pub category_description: String,
317    pub description: String,
318    pub created: Option<String>,
319    pub affected_routes: Vec<Value>,
320    pub affected_stops: Vec<Value>,
321    pub additional_info: Option<String>,
322    pub closure_text: Option<String>,
323}
324
325#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
326#[serde(rename_all = "camelCase")]
327pub struct Routes {
328    #[serde(rename = "$type")]
329    pub type_field: String,
330    /// Line ID
331    pub line_id: String,
332    /// Line name
333    pub line_name: String,
334    /// Line direction
335    pub direction: String,
336    /// Outbound only line
337    pub is_outbound_only: bool,
338    /// Mode
339    pub mode: String,
340    /// Line strings
341    pub line_strings: Vec<String>,
342    /// Stations on the line
343    pub stations: Vec<Station>,
344    /// Stop point sequences
345    pub stop_point_sequences: Vec<StopPointSequence>,
346    /// Ordered line routes
347    pub ordered_line_routes: Vec<OrderedLineRoute>,
348}
349
350#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
351#[serde(rename_all = "camelCase")]
352pub struct Station {
353    #[serde(rename = "$type")]
354    pub type_field: String,
355    /// Station ID
356    pub station_id: Option<String>,
357    /// ICS ID
358    pub ics_id: String,
359    /// Top most parent id
360    pub top_most_parent_id: Option<String>,
361    /// Modes
362    pub modes: Vec<String>,
363    /// Stop type
364    pub stop_type: String,
365    /// Station zone
366    pub zone: String,
367    /// Lines
368    pub lines: Vec<RouteLines>,
369    /// Status of the station
370    pub status: bool,
371    /// Station ID
372    pub id: String,
373    /// Station name
374    pub name: String,
375    /// Latitude
376    pub lat: f64,
377    /// Longitude
378    pub lon: f64,
379}
380
381#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
382#[serde(rename_all = "camelCase")]
383pub struct RouteLines {
384    #[serde(rename = "$type")]
385    pub type_field: String,
386    /// Line ID
387    pub id: String,
388    /// Line name
389    pub name: String,
390    /// URI
391    pub uri: String,
392    #[serde(rename = "type")]
393    pub type_field2: String,
394    /// Crowding stat
395    pub crowding: Crowding,
396    /// Route type
397    pub route_type: String,
398    /// Line status
399    pub status: String,
400}
401
402#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
403#[serde(rename_all = "camelCase")]
404pub struct StopPointSequence {
405    #[serde(rename = "$type")]
406    pub type_field: String,
407    /// Line ID
408    pub line_id: String,
409    /// Line name
410    pub line_name: String,
411    /// Traveling direction
412    pub direction: String,
413    /// Branch ID
414    pub branch_id: i64,
415    /// Subsequent branch IDs
416    pub next_branch_ids: Vec<Value>,
417    /// Previous branch IDs
418    pub prev_branch_ids: Vec<Value>,
419    /// Stop points
420    pub stop_point: Vec<RouteStopPoint>,
421    /// Service type
422    pub service_type: String,
423}
424
425#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
426#[serde(rename_all = "camelCase")]
427pub struct RouteStopPoint {
428    #[serde(rename = "$type")]
429    pub type_field: String,
430    /// Parent ID
431    pub parent_id: Option<String>,
432    /// Station ID
433    pub station_id: String,
434    /// ICS ID
435    pub ics_id: String,
436    /// Top most parent ID
437    pub top_most_parent_id: String,
438    /// Modes
439    pub modes: Vec<String>,
440    /// Stop type
441    pub stop_type: String,
442    /// Zone
443    pub zone: String,
444    /// Lines
445    pub lines: Vec<Line2>,
446    /// Status
447    pub status: bool,
448    /// Stop point ID
449    pub id: String,
450    /// Stop point name
451    pub name: String,
452    /// Latitude
453    pub lat: f64,
454    /// Longitude
455    pub lon: f64,
456    /// Does it has a reported disruption
457    pub has_disruption: Option<bool>,
458}
459
460#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
461#[serde(rename_all = "camelCase")]
462pub struct Line2 {
463    #[serde(rename = "$type")]
464    pub type_field: String,
465    /// Line ID
466    pub id: String,
467    /// Line name
468    pub name: String,
469    /// Line URI
470    pub uri: String,
471    #[serde(rename = "type")]
472    pub type_field2: String,
473    /// Crowding
474    pub crowding: Crowding2,
475    /// Route type
476    pub route_type: String,
477    /// Line status
478    pub status: String,
479}
480
481#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
482#[serde(rename_all = "camelCase")]
483pub struct Crowding2 {
484    #[serde(rename = "$type")]
485    pub type_field: String,
486}
487
488#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
489#[serde(rename_all = "camelCase")]
490pub struct OrderedLineRoute {
491    #[serde(rename = "$type")]
492    pub type_field: String,
493    /// Ordered line route name
494    pub name: String,
495    /// NAPTAN IDs
496    pub naptan_ids: Vec<String>,
497    /// Service type
498    pub service_type: String,
499}
500
501#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
502#[serde(rename_all = "camelCase")]
503pub struct Severity {
504    #[serde(rename = "$type")]
505    pub type_field: String,
506    /// Transport mode name
507    pub mode_name: String,
508    /// Severity level
509    pub severity_level: i64,
510    /// Severity description
511    pub description: String,
512}
513
514#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
515#[serde(rename_all = "camelCase")]
516pub struct ValidMode {
517    #[serde(rename = "$type")]
518    pub type_field: String,
519    /// Is mode type a TFL service
520    pub is_tfl_service: bool,
521    /// Is Fare paying service
522    pub is_fare_paying: bool,
523    /// Is it a scheduled service
524    pub is_scheduled_service: bool,
525    /// Name of the mode
526    pub mode_name: String,
527}
528
529// Returned by TFl version endpoint
530#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
531pub struct Version {
532    /// Labels returned by the API
533    pub label: String,
534    /// Timestamp returned from the API
535    pub timestamp: String,
536    /// Current TFL API version
537    pub version: String,
538}
539
540#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
541#[serde(rename_all = "camelCase")]
542pub struct StopPoints {
543    #[serde(rename = "$type")]
544    pub type_field: String,
545    /// NAPTAN ID
546    pub naptan_id: String,
547    /// List of modes
548    pub modes: Vec<String>,
549    /// ICS code
550    pub ics_code: String,
551    /// Stop type
552    pub stop_type: String,
553    /// Station NAPTAN
554    pub station_naptan: String,
555    /// List of lines
556    pub lines: Vec<StopPointLine>,
557    /// Line group
558    pub line_group: Vec<LineGroup>,
559    /// Line mode groups
560    pub line_mode_groups: Vec<LineModeGroup>,
561    /// Status
562    pub status: bool,
563    /// ID
564    pub id: String,
565    /// Common Name
566    pub common_name: String,
567    /// Place type
568    pub place_type: String,
569    /// Additional properties
570    pub additional_properties: Vec<AdditionalProperty>,
571    /// Children
572    pub children: Vec<Children>,
573    /// Latitude
574    pub lat: f64,
575    /// Longitude
576    pub lon: f64,
577    /// Hub NAPTAN code
578    pub hub_naptan_code: Option<String>,
579}
580
581#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
582#[serde(rename_all = "camelCase")]
583pub struct StopPointLine {
584    #[serde(rename = "$type")]
585    pub type_field: String,
586    /// Stop point line ID
587    pub id: String,
588    /// Stop point line name
589    pub name: String,
590    /// URI
591    pub uri: String,
592    #[serde(rename = "type")]
593    pub type_field2: String,
594    /// Crowding details
595    pub crowding: Crowding,
596    /// Route type
597    pub route_type: String,
598    /// Status
599    pub status: String,
600}
601
602#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
603#[serde(rename_all = "camelCase")]
604pub struct LineGroup {
605    #[serde(rename = "$type")]
606    pub type_field: String,
607    /// NAPTAN ID reference for line group
608    pub naptan_id_reference: Option<String>,
609    /// Station atco code for line group
610    pub station_atco_code: String,
611    /// Line identifier for line group
612    pub line_identifier: Vec<String>,
613}
614
615#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
616#[serde(rename_all = "camelCase")]
617pub struct LineModeGroup {
618    #[serde(rename = "$type")]
619    pub type_field: String,
620    /// Mode name of line mode group
621    pub mode_name: String,
622    /// Line identifier
623    pub line_identifier: Vec<String>,
624}
625
626#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
627#[serde(rename_all = "camelCase")]
628pub struct AdditionalProperty {
629    #[serde(rename = "$type")]
630    pub type_field: String,
631    /// Additional property category
632    pub category: String,
633    /// Additional property key
634    pub key: String,
635    /// Source system key
636    pub source_system_key: String,
637    /// Porperty value
638    pub value: String,
639}
640
641#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
642#[serde(rename_all = "camelCase")]
643pub struct Children {
644    #[serde(rename = "$type")]
645    pub type_field: String,
646    /// Children NAPTAN ID
647    pub naptan_id: String,
648    /// Children modes
649    pub modes: Vec<Value>,
650    /// ICS Code
651    pub ics_code: String,
652    /// Station NAPTAN
653    pub station_naptan: String,
654    /// Lines
655    pub lines: Vec<Value>,
656    /// Line group
657    pub line_group: Vec<Value>,
658    /// Line mode groups
659    pub line_mode_groups: Vec<Value>,
660    /// Status
661    pub status: bool,
662    /// ID
663    pub id: String,
664    /// Common name
665    pub common_name: String,
666    /// Place type
667    pub place_type: String,
668    /// Additional properties
669    pub additional_properties: Vec<Value>,
670    /// Children
671    pub children: Vec<Value>,
672    /// Latitude
673    pub lat: f64,
674    /// Longitude
675    pub lon: f64,
676    /// Hub NAPTAN code
677    pub hub_naptan_code: Option<String>,
678    /// Indicator
679    pub indicator: Option<String>,
680}
681
682#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
683#[serde(rename_all = "camelCase")]
684pub struct Lines {
685    #[serde(rename = "$type")]
686    pub type_field: String,
687    /// Line ID
688    pub id: String,
689    /// Line name. E.g. Bakerloo
690    pub name: String,
691    /// Mode name of the line. E.g. Tube, DLR, Bus
692    pub mode_name: String,
693    /// Disruptions for the line
694    pub disruptions: Vec<Value>,
695    /// Created time
696    pub created: String,
697    /// Modified time
698    pub modified: String,
699    /// Line statuses
700    pub line_statuses: Vec<Value>,
701    /// Route section for the line
702    pub route_sections: Vec<RouteSection>,
703    /// Type of the service. E.g. Regular, Night
704    pub service_types: Vec<ServiceType>,
705    /// Crowding details for the line
706    pub crowding: Crowding,
707}
708
709#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
710#[serde(rename_all = "camelCase")]
711pub struct RouteSection {
712    #[serde(rename = "$type")]
713    pub type_field: String,
714    /// Route section name
715    pub name: String,
716    /// Route direction
717    pub direction: String,
718    /// Route origin name
719    pub origination_name: String,
720    /// Route destination name
721    pub destination_name: String,
722    /// Route originator
723    pub originator: String,
724    /// Route destination
725    pub destination: String,
726    /// Service type of the route. E.g. Regular, Night
727    pub service_type: String,
728    /// Valid until
729    pub valid_to: String,
730    /// Valid from
731    pub valid_from: String,
732}
733
734#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
735#[serde(rename_all = "camelCase")]
736pub struct ServiceType {
737    #[serde(rename = "$type")]
738    pub type_field: String,
739    /// Service type name
740    pub name: String,
741    /// Service type URI
742    pub uri: String,
743}
744
745#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
746#[serde(rename_all = "camelCase")]
747pub struct Crowding {
748    #[serde(rename = "$type")]
749    pub type_field: String,
750}
751
752#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
753#[serde(rename_all = "camelCase")]
754pub struct Disruptions {
755    #[serde(rename = "$type")]
756    pub type_field: String,
757    /// Disruption category
758    pub category: String,
759    #[serde(rename = "type")]
760    pub type_field2: String,
761    /// Description for disruption category
762    pub category_description: String,
763    /// Description
764    pub description: String,
765    /// Creation time for disruption
766    pub created: Option<String>,
767    /// Last update time for disruption
768    pub last_update: Option<String>,
769    /// Affected routes for disruption
770    pub affected_routes: Vec<Value>,
771    /// Affected stops for disruption
772    pub affected_stops: Vec<Value>,
773    /// closure text
774    pub closure_text: Option<String>,
775}
776
777#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
778#[serde(rename_all = "camelCase")]
779#[serde(default)]
780pub struct Arrivals {
781    #[serde(rename = "$type")]
782    pub type_field: String,
783    pub id: String,
784    pub operation_type: i64,
785    pub vehicle_id: String,
786    pub naptan_id: String,
787    pub station_name: String,
788    pub line_id: String,
789    pub line_name: String,
790    pub platform_name: String,
791    pub direction: Option<String>,
792    pub bearing: String,
793    pub destination_naptan_id: String,
794    pub destination_name: String,
795    pub timestamp: String,
796    pub time_to_station: i64,
797    pub current_location: String,
798    pub towards: String,
799    pub expected_arrival: String,
800    pub time_to_live: String,
801    pub mode_name: String,
802    pub timing: Timing,
803}
804
805#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
806#[serde(rename_all = "camelCase")]
807pub struct Timing {
808    #[serde(rename = "$type")]
809    pub type_field: String,
810    pub countdown_server_adjustment: String,
811    pub source: String,
812    pub insert: String,
813    pub read: String,
814    pub sent: String,
815    pub received: String,
816}
817
818#[derive(Debug)]
819pub enum ServiceTypes {
820    Regular,
821    Night,
822}
823
824impl ServiceTypes {
825    pub fn to_type(&self) -> &'static str {
826        match self {
827            ServiceTypes::Regular => "Regular",
828            ServiceTypes::Night => "Night",
829        }
830    }
831}
832pub enum Directions {
833    Inbound,
834    Outbound,
835    All,
836}
837
838impl Directions {
839    pub fn to_type(&self) -> &'static str {
840        match self {
841            Directions::Inbound => "Inbound",
842            Directions::Outbound => "Outbound",
843            Directions::All => "All",
844        }
845    }
846}
847
848pub enum Mode {
849    Tube,
850    DLR,
851    Bus,
852    RiverBus,
853    NationalRail,
854    Tram,
855    ElizabethLine,
856}
857
858impl Mode {
859    pub fn mode(&self) -> &'static str {
860        match self {
861            Mode::Tube => "Tube",
862            Mode::DLR => "DLR",
863            Mode::Bus => "Bus",
864            Mode::RiverBus => "river-bus",
865            Mode::NationalRail => "national-rail",
866            Mode::Tram => "Tram",
867            Mode::ElizabethLine => "elizabeth-line",
868        }
869    }
870}
871
872#[derive(Debug, Default, Serialize)]
873pub struct Parameters {
874    #[serde(flatten)]
875    pub lines: String,
876    pub line_id: String,
877    pub service_type: Option<String>,
878    pub modes: String,
879    pub stop_point_id: String,
880    pub from_stop_point_id: String,
881    pub to_stop_point_id: String,
882    pub direction: Option<String>,
883    pub destination_station_id: Option<String>,
884    pub tfl_operated_national_rail_stations_only: Option<bool>,
885    pub exclude_crowding: Option<bool>,
886    pub severity: Option<i8>,
887    pub start_date: String,
888    pub end_date: String,
889    pub detail: Option<bool>,
890    pub query: String,
891}