gistools/readers/gbfs/schema_v2/station_information.rs
1use crate::readers::GBFSRentalUri;
2use alloc::{collections::BTreeMap, string::String, vec::Vec};
3use s2json::Geometry;
4use serde::{Deserialize, Serialize};
5
6/// # GBFS Station Information Schema V2.3, V2.2, V2.1, OR V2.0
7/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
8///
9/// ## Links
10/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_informationjson)
11/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#station_informationjson)
12/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#station_informationjson)
13/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#station_informationjson)
14pub type GBFSStationInformationV2 = GBFSStationInformationV23;
15
16/// GBFS Station Information Parking Type
17#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
18pub enum GBFSStationInformationParkingTypeV23 {
19 /// Parking Lot
20 #[default]
21 #[serde(rename = "parking_lot")]
22 ParkingLot,
23 /// Street Parking
24 #[serde(rename = "street_parking")]
25 StreetParking,
26 /// Underground Parking
27 #[serde(rename = "underground_parking")]
28 UndergroundParking,
29 /// Sidewalk Parking
30 #[serde(rename = "sidewalk_parking")]
31 SidewalkParking,
32 /// Other
33 #[serde(rename = "other")]
34 Other,
35}
36
37/// GBFS Station Information Station V2.3
38#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
39pub struct GBFSStationInformationStationV23 {
40 /// Station ID
41 pub station_id: String,
42 /// Name
43 pub name: String,
44 /// Short Name
45 pub short_name: Option<String>,
46 /// Latitude
47 pub lat: f64,
48 /// Longitude
49 pub lon: f64,
50 /// Address
51 pub address: Option<String>,
52 /// Cross Street
53 pub cross_street: Option<String>,
54 /// Region ID
55 pub region_id: Option<String>,
56 /// Post Code
57 pub post_code: Option<String>,
58 /// Rental Methods
59 pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodV21>>,
60 /// Is Virtual Station
61 pub is_virtual_station: Option<bool>,
62 /// Station Area
63 pub station_area: Option<Geometry>, // MultiPolygonGeometry
64 /// Parking Type
65 pub parking_type: Option<GBFSStationInformationParkingTypeV23>,
66 /// Parking Hoop
67 pub parking_hoop: Option<bool>,
68 /// Contact Phone
69 pub contact_phone: Option<String>,
70 /// Capacity
71 pub capacity: Option<u64>,
72 /// Vehicle Capacity
73 pub vehicle_capacity: Option<BTreeMap<String, f64>>,
74 /// Is Valet Station
75 pub is_valet_station: Option<bool>,
76 /// Is Charging Station
77 pub is_charging_station: Option<bool>,
78 /// Rental URIs
79 pub rental_uris: Option<GBFSRentalUri>,
80 /// Vehicle Type Capacity
81 pub vehicle_type_capacity: Option<BTreeMap<String, f64>>,
82}
83
84/// GBFS Station Information Data
85#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
86pub struct GBFSStationInformationDataV23 {
87 /// Stations
88 pub stations: Vec<GBFSStationInformationStationV23>,
89}
90
91/// # GBFS Station Information V2.3
92/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
93///
94/// ## Links
95/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_informationjson)
96#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
97pub struct GBFSStationInformationV23 {
98 /// Last time the data in the feed was updated in POSIX time.
99 /// **Minimum**: 1450155600
100 pub last_updated: u64,
101 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
102 /// **Minimum**: 0
103 pub ttl: u64,
104 /// GBFS version number to which the feed conforms, according to the versioning framework.
105 /// **Const**: 2.3
106 pub version: String,
107 /// Contains station information for the system.
108 pub data: GBFSStationInformationDataV23,
109}
110
111/// GBFS Station Information Station V2.2
112#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
113pub struct GBFSStationInformationStationV22 {
114 /// Station ID
115 pub station_id: String,
116 /// Name
117 pub name: String,
118 /// Short Name
119 pub short_name: Option<String>,
120 /// Latitude
121 pub lat: f64,
122 /// Longitude
123 pub lon: f64,
124 /// Address
125 pub address: Option<String>,
126 /// Cross Street
127 pub cross_street: Option<String>,
128 /// Region ID
129 pub region_id: Option<String>,
130 /// Post Code
131 pub post_code: Option<String>,
132 /// Rental Methods
133 pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodV21>>,
134 /// Is Virtual Station
135 pub is_virtual_station: Option<bool>,
136 /// Station Area
137 pub station_area: Option<Geometry>,
138 /// Parking Type
139 pub capacity: Option<u64>,
140 /// Vehicle Capacity
141 pub vehicle_capacity: Option<BTreeMap<String, f64>>,
142 /// Is Valet Station
143 pub is_valet_station: Option<bool>,
144 /// Rental URIs
145 pub rental_uris: Option<GBFSRentalUri>,
146 /// Vehicle Type Capacity
147 pub vehicle_type_capacity: Option<BTreeMap<String, f64>>,
148}
149
150/// GBFS Station Information Data
151#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
152pub struct GBFSStationInformationDataV22 {
153 /// Stations
154 pub stations: Vec<GBFSStationInformationStationV22>,
155}
156
157/// # GBFS Station Information V2.2
158/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
159///
160/// ## Links
161/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#station_informationjson)
162#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
163pub struct GBFSStationInformationV22 {
164 /// Last time the data in the feed was updated in POSIX time.
165 /// **Minimum**: 1450155600
166 pub last_updated: u64,
167 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
168 /// **Minimum**: 0
169 pub ttl: u64,
170 /// GBFS version number to which the feed conforms, according to the versioning framework.
171 /// **Const**: 2.2
172 pub version: String,
173 /// Contains station information for the system.
174 pub data: GBFSStationInformationDataV22,
175}
176
177/// GBFS Station Information Rental Method
178#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
179pub enum GBFSStationInformationRentalMethodV21 {
180 /// Key
181 #[default]
182 #[serde(rename = "key")]
183 Key,
184 /// Credit Card
185 #[serde(rename = "creditcard")]
186 CreditCard,
187 /// PayPass
188 #[serde(rename = "paypass")]
189 PayPass,
190 /// Apple Pay
191 #[serde(rename = "applepay")]
192 ApplePay,
193 /// Android Pay
194 #[serde(rename = "androidpay")]
195 AndroidPay,
196 /// Google Wallet
197 #[serde(rename = "transitcard")]
198 TransitCard,
199 /// Cash
200 #[serde(rename = "accountnumber")]
201 AccountNumber,
202 /// Phone
203 #[serde(rename = "phone")]
204 Phone,
205}
206
207/// GBFS Station Information Station
208#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
209pub struct GBFSStationInformationStationV21 {
210 /// Station ID
211 pub station_id: String,
212 /// Name
213 pub name: String,
214 /// Short Name
215 pub short_name: Option<String>,
216 /// Latitude
217 pub lat: f64,
218 /// Longitude
219 pub lon: f64,
220 /// Address
221 pub address: Option<String>,
222 /// Cross Street
223 pub cross_street: Option<String>,
224 /// Region ID
225 pub region_id: Option<String>,
226 /// Post Code
227 pub post_code: Option<String>,
228 /// Rental Methods
229 pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodV21>>,
230 /// Is Virtual Station
231 pub is_virtual_station: Option<bool>,
232 /// Station Area
233 pub station_area: Option<Geometry>,
234 /// Capacity
235 pub capacity: Option<u64>,
236 /// Vehicle Capacity
237 pub vehicle_capacity: Option<BTreeMap<String, f64>>,
238 /// Is Valet Station
239 pub is_valet_station: Option<bool>,
240 /// Rental URIs
241 pub rental_uris: Option<GBFSRentalUri>,
242 /// Vehicle Type Capacity
243 pub vehicle_type_capacity: Option<BTreeMap<String, f64>>,
244}
245
246/// GBFS Station Information Data
247#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
248pub struct GBFSStationInformationDataV21 {
249 /// Stations
250 pub stations: Vec<GBFSStationInformationStationV21>,
251}
252
253/// # GBFS Station Information V2.1
254/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
255///
256/// ## Links
257/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#station_informationjson)
258#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
259pub struct GBFSStationInformationV21 {
260 /// Last time the data in the feed was updated in POSIX time.
261 /// **Minimum**: 1450155600
262 pub last_updated: u64,
263 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
264 /// **Minimum**: 0
265 pub ttl: u64,
266 /// GBFS version number to which the feed conforms, according to the versioning framework.
267 /// **Const**: 2.1
268 pub version: String,
269 /// Contains station information for the system.
270 pub data: GBFSStationInformationDataV21,
271}
272
273/// GBFS Station Information Rental Method
274#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
275pub enum GBFSStationInformationRentalMethodV20 {
276 /// Key
277 #[default]
278 #[serde(rename = "KEY")]
279 Key,
280 /// Credit Card
281 #[serde(rename = "CREDITCARD")]
282 CreditCard,
283 /// PayPass
284 #[serde(rename = "PAYPASS")]
285 PayPass,
286 /// Apple Pay
287 #[serde(rename = "APPLEPAY")]
288 ApplePay,
289 /// Android Pay
290 #[serde(rename = "ANDROIDPAY")]
291 AndroidPay,
292 /// Google Wallet
293 #[serde(rename = "TRANSITCARD")]
294 TransitCard,
295 /// Cash
296 #[serde(rename = "ACCOUNTNUMBER")]
297 AccountNumber,
298 /// Phone
299 #[serde(rename = "PHONE")]
300 Phone,
301}
302
303/// GBFS Station Information Station
304#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
305pub struct GBFSStationInformationStationV20 {
306 /// Station ID
307 pub station_id: String,
308 /// Name
309 pub name: String,
310 /// Short Name
311 pub short_name: Option<String>,
312 /// Latitude
313 pub lat: f64,
314 /// Longitude
315 pub lon: f64,
316 /// Address
317 pub address: Option<String>,
318 /// Cross Street
319 pub cross_street: Option<String>,
320 /// Region ID
321 pub region_id: Option<String>,
322 /// Post Code
323 pub post_code: Option<String>,
324 /// Rental Methods
325 pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodV20>>,
326 /// Capacity
327 pub capacity: Option<u64>,
328 /// Rental URIs
329 pub rental_uris: Option<GBFSRentalUri>,
330}
331
332/// GBFS Station Information Data
333#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
334pub struct GBFSStationInformationDataV20 {
335 /// Stations
336 pub stations: Vec<GBFSStationInformationStationV20>,
337}
338
339/// # GBFS Station Information V2.0
340/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
341///
342/// ## Links
343/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#station_informationjson)
344#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
345pub struct GBFSStationInformationV20 {
346 /// Last time the data in the feed was updated in POSIX time.
347 /// **Minimum**: 1450155600
348 pub last_updated: u64,
349 /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
350 /// **Minimum**: 0
351 pub ttl: u64,
352 /// GBFS version number to which the feed conforms, according to the versioning framework.
353 /// **Const**: 2.0
354 pub version: String,
355 /// Contains station information for the system.
356 pub data: GBFSStationInformationDataV20,
357}