gistools/readers/gbfs/schema_v1/
station_information.rs

1use crate::readers::GBFSRentalUri;
2use alloc::{string::String, vec::Vec};
3use serde::{Deserialize, Serialize};
4
5/// # GBFS Station Information Schema V1.1 OR GBFS Station Information Schema V1.0
6/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
7///
8/// ## Links
9/// - [GBFS Specification V1.1](https://github.com/MobilityData/gbfs/blob/v1.1/gbfs.md#station_informationjson)
10/// - [GBFS Specification V1.0](https://github.com/MobilityData/gbfs/blob/v1.0/gbfs.md#station_informationjson)
11pub type GBFSStationInformationV1 = GBFSStationInformationV11;
12
13/// GBFS Station Information Rental Methods
14#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
15pub enum GBFSStationInformationRentalMethodsV1 {
16    /// Key
17    #[default]
18    KEY,
19    /// Credit Card
20    CREDITCARD,
21    /// PayPass
22    PAYPASS,
23    /// Apple Pay
24    APPLEPAY,
25    /// Android Pay
26    ANDROIDPAY,
27    /// Transit Card
28    TRANSITCARD,
29    /// Account Number
30    ACCOUNTNUMBER,
31    /// Phone
32    PHONE,
33}
34
35/// GBFS Station Information Station
36#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
37pub struct GBFSStationInformationV11Station {
38    /// Station ID
39    pub station_id: String,
40    /// Station Name
41    pub name: String,
42    /// Short Station Name
43    pub short_name: Option<String>,
44    /// Latitude
45    pub lat: f64,
46    /// Longitude
47    pub lon: f64,
48    /// Address
49    pub address: Option<String>,
50    /// Cross Street
51    pub cross_street: Option<String>,
52    /// Region
53    pub region_id: Option<String>,
54    /// Postal Code
55    pub post_code: Option<String>,
56    /// Rental Methods
57    pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodsV1>>,
58    /// Capacity
59    pub capacity: Option<u64>,
60    /// Rental URIs
61    pub rental_uris: Option<GBFSRentalUri>,
62}
63
64/// GBFS Station Information Data
65#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
66pub struct GBFSStationInformationDataV11 {
67    /// Data containing an array of stations
68    pub stations: Vec<GBFSStationInformationV11Station>,
69}
70
71/// GBFS Station Information Schema V1.1 Interface
72#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
73pub struct GBFSStationInformationV11 {
74    /// Last time the data in the feed was updated in POSIX time.
75    pub last_updated: u64,
76    /// Number of seconds before the data in the feed will be updated again.
77    pub ttl: u64,
78    /// GBFS version number (1.1).
79    pub version: String,
80    /// Data containing an array of stations.
81    pub data: GBFSStationInformationDataV11,
82}
83
84/// GBFS Station Information Rental Methods
85#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
86pub struct GBFSStationInformationV10Station {
87    /// Station ID
88    pub station_id: String,
89    /// Station Name
90    pub name: String,
91    /// Short Station Name
92    pub short_name: Option<String>,
93    /// Latitude
94    pub lat: f64,
95    /// Longitude
96    pub lon: f64,
97    /// Address
98    pub address: Option<String>,
99    /// Cross Street
100    pub cross_street: Option<String>,
101    /// Region
102    pub region_id: Option<String>,
103    /// Postal Code
104    pub post_code: Option<String>,
105    /// Rental Methods
106    pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodsV1>>,
107    /// Capacity
108    pub capacity: Option<u64>,
109}
110
111/// GBFS Station Information Data
112#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
113pub struct GBFSStationInformationDataV10 {
114    /// Data containing an array of stations
115    pub stations: Vec<GBFSStationInformationV10Station>,
116}
117
118/// GBFS Station Information Schema V1.0 Interface
119#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
120pub struct GBFSStationInformationV10 {
121    /// Last time the data in the feed was updated in POSIX time.
122    pub last_updated: u64,
123    /// Number of seconds before the data in the feed will be updated again.
124    pub ttl: u64,
125    /// Data containing an array of stations.
126    pub data: GBFSStationInformationDataV10,
127}