gistools/readers/gbfs/schema_v2/
station_status.rs

1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS Station Status Schema V2.3, V2.2, V2.1, OR V2.0
5/// List of all stations, their capacities, and locations. REQUIRED for systems utilizing docks.
6///
7/// ## Links
8/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_statusjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#station_statusjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#station_statusjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#station_statusjson)
12pub type GBFSStationStatusV2 = GBFSStationStatusV23;
13
14/// # GBFS Station Status V2.3
15/// Describes the capacity and rental availability of the station.
16///
17/// ## Links
18/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#station_statusjson)
19#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
20pub struct GBFSStationStatusV23 {
21    /// Last time the data in the feed was updated in POSIX time.
22    /// **Minimum**: 1450155600
23    pub last_updated: u64,
24    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
25    /// **Minimum**: 0
26    pub ttl: u64,
27    /// GBFS version number to which the feed conforms, according to the versioning framework.
28    /// **Const**: 2.3
29    pub version: String,
30    /// Contains station status information.
31    pub data: GBFSStationStatusDataV21,
32}
33
34/// # GBFS Station Status V2.2
35/// Describes the capacity and rental availability of the station.
36///
37/// ## Links
38/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#station_statusjson)
39#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
40pub struct GBFSStationStatusV22 {
41    /// Last time the data in the feed was updated in POSIX time.
42    /// **Minimum**: 1450155600
43    pub last_updated: u64,
44    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
45    /// **Minimum**: 0
46    pub ttl: u64,
47    /// GBFS version number to which the feed conforms, according to the versioning framework.
48    /// **Const**: 2.2
49    pub version: String,
50    /// Contains station status information.
51    pub data: GBFSStationStatusDataV21,
52}
53
54/// GBFS Station Status Vehicle Type
55#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
56pub struct GBFSStationStatusVehicleTypeV21 {
57    /// ID of the vehicle type
58    pub vehicle_type_id: String,
59    /// Number of bikes available
60    pub count: u64,
61}
62
63/// GBFS Station Status Station
64#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
65pub struct GBFSStationStatusStationV21 {
66    /// ID of the station
67    pub station_id: String,
68    /// Number of bikes available
69    pub num_bikes_available: u64,
70    /// Number of docks available
71    pub vehicle_types_available: Option<Vec<GBFSStationStatusVehicleTypeV21>>,
72    /// Number of bikes disabled
73    pub num_bikes_disabled: Option<u64>,
74    /// Number of docks available
75    pub num_docks_available: Option<u64>,
76    /// Number of docks disabled
77    pub num_docks_disabled: Option<u64>,
78    /// Whether the station is installed
79    pub is_installed: bool,
80    /// Whether the station is renting
81    pub is_renting: bool,
82    /// Whether the station is returning
83    pub is_returning: bool,
84    /// Last time the data in the feed was updated in POSIX time.
85    pub last_reported: u64,
86    /// Number of docks available
87    pub vehicle_docks_available: Option<Vec<GBFSStationStatusVehicleTypeV21>>,
88}
89
90/// GBFS Station Status Data V2.1
91#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
92pub struct GBFSStationStatusDataV21 {
93    /// Contains station status information.
94    pub stations: Vec<GBFSStationStatusStationV21>,
95}
96
97/// # GBFS Station Status V2.1
98/// Describes the capacity and rental availability of the station.
99///
100/// ## Links
101/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#station_statusjson)
102#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
103pub struct GBFSStationStatusV21 {
104    /// Last time the data in the feed was updated in POSIX time.
105    /// **Minimum**: 1450155600
106    pub last_updated: u64,
107    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
108    /// **Minimum**: 0
109    pub ttl: u64,
110    /// GBFS version number to which the feed conforms, according to the versioning framework.
111    /// **Const**: 2.1
112    pub version: String,
113    /// Contains station status information.
114    pub data: GBFSStationStatusDataV21,
115}
116
117/// GBFS Station Status - Station V2.0
118#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
119pub struct GBFSStationStatusStationV20 {
120    /// ID of the station
121    pub station_id: String,
122    /// Number of bikes available
123    pub num_bikes_available: u64,
124    /// Number of bikes disabled
125    pub num_bikes_disabled: Option<u64>,
126    /// Number of docks available
127    pub num_docks_available: Option<u64>,
128    /// Number of docks disabled
129    pub num_docks_disabled: Option<u64>,
130    /// Whether the station is installed
131    pub is_installed: bool,
132    /// Whether the station is renting
133    pub is_renting: bool,
134    /// Whether the station is returning
135    pub is_returning: bool,
136    /// Last time the data in the feed was updated in POSIX time.
137    pub last_reported: u64,
138}
139
140/// GBFS Station Status Data V2.0
141#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
142pub struct GBFSStationStatusDataV20 {
143    /// Contains station status information.
144    pub stations: Vec<GBFSStationStatusStationV20>,
145}
146
147/// # GBFS Station Status V2.0
148/// Describes the capacity and rental availability of the station.
149///
150/// ## Links
151/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#station_statusjson)
152#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
153pub struct GBFSStationStatusV20 {
154    /// Last time the data in the feed was updated in POSIX time.
155    /// **Minimum**: 1450155600
156    pub last_updated: u64,
157    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
158    /// **Minimum**: 0
159    pub ttl: u64,
160    /// GBFS version number to which the feed conforms, according to the versioning framework.
161    /// **Const**: 2.0
162    pub version: String,
163    /// Contains station status information.
164    pub data: GBFSStationStatusDataV20,
165}