gistools/readers/gbfs/schema_v2/system_calendar.rs
1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Calendar Schema V2.3, V2.2, V2.1, OR V2.0
5/// Describes the operating calendar for a system.
6///
7/// ## Links
8/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_calendarjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_calendarjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_calendarjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_calendarjson)
12pub type GBFSSystemCalendarV2 = GBFSSystemCalendarV23;
13
14/// GBFS System Calendar Calendar
15#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
16pub struct GBFSSystemCalendarCalendarV2 {
17 /// Start month of the calendar.
18 pub start_month: u64,
19 /// Start day of the calendar.
20 pub start_day: u64,
21 /// Start year of the calendar.
22 pub start_year: Option<u64>,
23 /// End month of the calendar.
24 pub end_month: u64,
25 /// End day of the calendar.
26 pub end_day: u64,
27 /// End year of the calendar.
28 pub end_year: Option<u64>,
29}
30
31/// GBFS System Calendar Data
32#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
33pub struct GBFSSystemCalendarDataV2 {
34 /// List of all the system's operating calendars.
35 pub calendars: Vec<GBFSSystemCalendarCalendarV2>,
36}
37
38/// # GBFS System Calendar V2.3
39/// Describes the operating calendar for a system.
40///
41/// ## Links
42/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_calendarjson)
43#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
44pub struct GBFSSystemCalendarV23 {
45 /// Last time the data in the feed was updated in POSIX time.
46 /// **Minimum**: 1450155600
47 pub last_updated: u64,
48 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
49 /// **Minimum**: 0
50 pub ttl: u64,
51 /// GBFS version number to which the feed conforms, according to the versioning framework.
52 /// **Const**: 2.3
53 pub version: String,
54 /// Contains the operations calendar data.
55 pub data: GBFSSystemCalendarDataV2,
56}
57
58/// # GBFS System Calendar V2.2
59/// Describes the operating calendar for a system.
60///
61/// ## Links
62/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_calendarjson)
63#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
64pub struct GBFSSystemCalendarV22 {
65 /// Last time the data in the feed was updated in POSIX time.
66 /// **Minimum**: 1450155600
67 pub last_updated: u64,
68 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
69 /// **Minimum**: 0
70 pub ttl: u64,
71 /// GBFS version number to which the feed conforms, according to the versioning framework.
72 /// **Const**: 2.2
73 pub version: String,
74 /// Contains the operations calendar data.
75 pub data: GBFSSystemCalendarDataV2,
76}
77
78/// # GBFS System Calendar V2.1
79/// Describes the operating calendar for a system.
80///
81/// ## Links
82/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_calendarjson)
83#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
84pub struct GBFSSystemCalendarV21 {
85 /// Last time the data in the feed was updated in POSIX time.
86 /// **Minimum**: 1450155600
87 pub last_updated: u64,
88 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
89 /// **Minimum**: 0
90 pub ttl: u64,
91 /// GBFS version number to which the feed conforms, according to the versioning framework.
92 /// **Const**: 2.1
93 pub version: String,
94 /// Contains the operations calendar data.
95 pub data: GBFSSystemCalendarDataV2,
96}
97
98/// # GBFS System Calendar V2.0
99/// Describes the operating calendar for a system.
100///
101/// ## Links
102/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_calendarjson)
103#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
104pub struct GBFSSystemCalendarV20 {
105 /// Last time the data in the feed was updated in POSIX time.
106 /// **Minimum**: 1450155600
107 pub last_updated: u64,
108 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
109 /// **Minimum**: 0
110 pub ttl: u64,
111 /// GBFS version number to which the feed conforms, according to the versioning framework.
112 /// **Const**: 2.0
113 pub version: String,
114 /// Contains the operations calendar data.
115 pub data: GBFSSystemCalendarDataV2,
116}