gistools/readers/gbfs/schema_v3/
station_information.rs

1use crate::readers::{GBFSName, GBFSRentalUri};
2use alloc::{string::String, vec::Vec};
3use s2json::Geometry;
4use serde::{Deserialize, Serialize};
5
6/// # GBFS Station Information Schema V3.1-RC & V3.0
7/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
8///
9/// ## Links
10/// - [GBFS Specification V3.1-RC](https://github.com/MobilityData/gbfs/blob/v3.1-RC/gbfs.md#station_informationjson)
11/// - [GBFS Specification V3.0](https://github.com/MobilityData/gbfs/blob/v3.0/gbfs.md#station_informationjson)
12pub type GBFSStationInformationV3 = GBFSStationInformationV30;
13
14/// GBFS Station Information Rental Method
15#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
16pub enum GBFSStationInformationRentalMethodV30 {
17    /// Key
18    #[default]
19    #[serde(rename = "key")]
20    Key,
21    /// Credit Card
22    #[serde(rename = "creditcard")]
23    CreditCard,
24    /// PayPass
25    #[serde(rename = "paypass")]
26    PayPass,
27    /// Apple Pay
28    #[serde(rename = "applepay")]
29    ApplePay,
30    /// Android Pay
31    #[serde(rename = "androidpay")]
32    AndroidPay,
33    /// Google Wallet
34    #[serde(rename = "transitcard")]
35    TransitCard,
36    /// Cash
37    #[serde(rename = "accountnumber")]
38    AccountNumber,
39    /// Phone
40    #[serde(rename = "phone")]
41    Phone,
42}
43
44/// GBFS Station Information Parking Type
45#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
46pub enum GBFSStationInformationParkingTypeV30 {
47    /// Parking Lot
48    #[default]
49    #[serde(rename = "parking_lot")]
50    ParkingLot,
51    /// Street Parking
52    #[serde(rename = "street_parking")]
53    StreetParking,
54    /// Underground Parking
55    #[serde(rename = "underground_parking")]
56    UndergroundParking,
57    /// Sidewalk Parking
58    #[serde(rename = "sidewalk_parking")]
59    SidewalkParking,
60    /// Other
61    #[serde(rename = "other")]
62    Other,
63}
64
65/// GBFS Station Information Name
66#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
67pub struct GBFSStationV3VehicleCapacity {
68    /// List of vehicle types.
69    pub vehicle_type_ids: Vec<String>,
70    /// Number of vehicles.
71    pub count: u64,
72}
73
74/// Information about a single station.
75#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
76pub struct GBFSStationV3 {
77    /// Identifier of the station.
78    pub station_id: String,
79    /// Public name of the station.
80    pub name: Vec<GBFSName>,
81    /// The latitude of the station.
82    /// **Minimum**: -90
83    /// **Maximum**: 90
84    pub lat: f64,
85    /// The longitude of the station.
86    /// **Minimum**: -180
87    /// **Maximum**: 180
88    pub lon: f64,
89    /// Short name or alternative identifier for the station.
90    pub short_name: Option<Vec<GBFSName>>,
91    /// Address where the station is located.
92    pub address: Option<String>,
93    /// Cross street or landmark where the station is located.
94    pub cross_street: Option<String>,
95    /// Identifier of the region where the station is located.
96    pub region_id: Option<String>,
97    /// Postal code where the station is located.
98    pub post_code: Option<String>,
99    /// Hours of operation for the station in OSM opening_hours format.
100    pub station_opening_hours: Option<String>,
101    /// Payment methods accepted at the station.
102    /// **Enum**: ['key', 'creditcard', 'paypass', 'applepay', 'androidpay', 'transitcard', 'accountnumber', 'phone']
103    pub rental_methods: Option<Vec<GBFSStationInformationRentalMethodV30>>,
104    /// Is this station a location with or without physical infrastructure? (added in v2.1-RC)
105    pub is_virtual_station: Option<bool>,
106    /// A multipolygon describing the area of a virtual station. (added in v2.1-RC)
107    pub station_area: Option<Geometry>,
108    /// Type of parking station. (added in v2.3)
109    /// **Enum**: ['parking_lot', 'street_parking', 'underground_parking', 'sidewalk_parking', 'other']
110    pub parking_type: Option<GBFSStationInformationParkingTypeV30>,
111    /// Are parking hoops present at this station? (added in v2.3)
112    pub parking_hoop: Option<bool>,
113    /// Contact phone of the station. (added in v2.3)
114    pub contact_phone: Option<String>,
115    /// Total docking points installed at the station, both available and unavailable.
116    /// **Minimum**: 0
117    pub capacity: Option<u64>,
118    /// Parking capacity for virtual stations per vehicle type.
119    pub vehicle_types_capacity: Option<Vec<GBFSStationV3VehicleCapacity>>,
120    /// Docking capacity per vehicle type at the station.
121    pub vehicle_docks_capacity: Option<Vec<GBFSStationV3VehicleCapacity>>,
122    /// Are valet services provided at the station? (added in v2.1-RC)
123    pub is_valet_station: Option<bool>,
124    /// Does the station support charging of electric vehicles? (added in v2.3-RC)
125    pub is_charging_station: Option<bool>,
126    /// Rental URIs for Android, iOS, and web.
127    pub rental_uris: Option<GBFSRentalUri>,
128}
129
130/// Data object containing station information.
131#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
132pub struct GBFSStationInformationV30Data {
133    /// List of stations with their attributes.
134    pub stations: Vec<GBFSStationV3>,
135}
136
137/// # GBFS Station Information Schema V3.0
138/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
139///
140/// ## Links
141/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v3.0/gbfs.md#station_informationjson)
142#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
143pub struct GBFSStationInformationV30 {
144    /// Last time the data in the feed was updated in RFC3339 format.
145    /// **Format**: date-time
146    pub last_updated: String,
147    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
148    /// **Minimum**: 0
149    pub ttl: u64,
150    /// GBFS version number to which the feed conforms.
151    /// **Const**: '3.0'
152    pub version: String,
153    /// Data object containing station information.
154    pub data: GBFSStationInformationV30Data,
155}