gistools/readers/gbfs/schema_v2/system_hours.rs
1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Hours 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_hoursjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_hoursjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_hoursjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_hoursjson)
12pub type GBFSSystemHoursV2 = GBFSSystemHoursV23;
13
14/// GBFS System Hours User Type
15#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
16pub enum GBFSSystemHourTypeV2 {
17 /// GBFS System Hours User Type
18 #[serde(rename = "member")]
19 #[default]
20 Member,
21 /// GBFS System Hours User Type
22 #[serde(rename = "nonmember")]
23 NonMember,
24}
25
26/// GBFS System Hours Day
27#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
28pub enum GBFSSystemHourDayV2 {
29 /// Sunday
30 #[serde(rename = "sun")]
31 #[default]
32 Sun,
33 /// Monday
34 #[serde(rename = "mon")]
35 Mon,
36 /// Tuesday
37 #[serde(rename = "tue")]
38 Tue,
39 /// Wednesday
40 #[serde(rename = "wed")]
41 Wed,
42 /// Thursday
43 #[serde(rename = "thu")]
44 Thu,
45 /// Friday
46 #[serde(rename = "fri")]
47 Fri,
48 /// Saturday
49 #[serde(rename = "sat")]
50 Sat,
51}
52
53/// # GBFS System Hours V2.3
54/// Describes the system hours of operation.
55///
56/// ## Links
57/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_hoursjson)
58#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
59pub struct GBFSSystemHoursV23 {
60 /// Last time the data in the feed was updated in POSIX time.
61 /// **Minimum**: 1450155600
62 pub last_updated: u64,
63 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
64 /// **Minimum**: 0
65 pub ttl: u64,
66 /// GBFS version number to which the feed conforms, according to the versioning framework.
67 /// **Const**: 2.3
68 pub version: String,
69 /// Contains system hours data.
70 pub data: GBFSSystemHoursDataV20,
71}
72
73/// # GBFS System Hours V2.2
74/// Describes the system hours of operation.
75///
76/// ## Links
77/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_hoursjson)
78#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
79pub struct GBFSSystemHoursV22 {
80 /// Last time the data in the feed was updated in POSIX time.
81 /// **Minimum**: 1450155600
82 pub last_updated: u64,
83 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
84 /// **Minimum**: 0
85 pub ttl: u64,
86 /// GBFS version number to which the feed conforms, according to the versioning framework.
87 /// **Const**: 2.2
88 pub version: String,
89 /// Contains system hours data.
90 pub data: GBFSSystemHoursDataV20,
91}
92
93/// # GBFS System Hours V2.1
94/// Describes the system hours of operation.
95///
96/// ## Links
97/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_hoursjson)
98#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
99pub struct GBFSSystemHoursV21 {
100 /// Last time the data in the feed was updated in POSIX time.
101 /// **Minimum**: 1450155600
102 pub last_updated: u64,
103 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
104 /// **Minimum**: 0
105 pub ttl: u64,
106 /// GBFS version number to which the feed conforms, according to the versioning framework.
107 /// **Const**: 2.1
108 pub version: String,
109 /// Contains system hours data.
110 pub data: GBFSSystemHoursDataV20,
111}
112
113/// # GBFS System Hours - Rental Hours V2.0
114#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
115pub struct GBFSSystemHoursRentalHourV20 {
116 /// Array of member and nonmember values indicating that this set of rental hours applies to either members or non-members only.
117 /// **Enum**: ["member", "nonmember"]
118 /// **Min Items**: 1
119 /// **Max Items**: 2
120 pub user_types: Vec<GBFSSystemHourTypeV2>,
121 /// Abbreviations of English names of the days of the week.
122 /// **Enum**: ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]
123 /// **Min Items**: 1
124 /// **Max Items**: 7
125 pub days: Vec<GBFSSystemHourDayV2>,
126 /// Start time for the hours of operation of the system.
127 /// **Pattern**: `^([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$`
128 pub start_time: String,
129 /// End time for the hours of operation of the system.
130 /// **Pattern**: `^([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$`
131 pub end_time: String,
132}
133
134/// rental hours for the system
135#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
136pub struct GBFSSystemHoursDataV20 {
137 /// rental hours
138 pub rental_hours: Vec<GBFSSystemHoursRentalHourV20>,
139}
140
141/// # GBFS System Hours V2.0
142/// Describes the system hours of operation.
143///
144/// ## Links
145/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_hoursjson)
146#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
147pub struct GBFSSystemHoursV20 {
148 /// Last time the data in the feed was updated in POSIX time.
149 /// **Minimum**: 1450155600
150 pub last_updated: u64,
151 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
152 /// **Minimum**: 0
153 pub ttl: u64,
154 /// GBFS version number to which the feed conforms, according to the versioning framework.
155 /// **Const**: 2.0
156 pub version: String,
157 /// Contains system hours data.
158 pub data: GBFSSystemHoursRentalHourV20,
159}