gistools/readers/gbfs/schema_v2/
system_information.rs

1use alloc::string::String;
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Information Schema V2.3, V2.2, V2.1, OR V2.0
5/// Details including system operator, system location, year implemented, URL, contact info, time zone.
6///
7/// ## Links
8/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_informationjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_informationjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_informationjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_informationjson)
12pub type GBFSSystemInformationV2 = GBFSSystemInformationV23;
13
14/// GBFS System Information Rental Apps
15#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
16pub struct GBFSSystemInformationRentalAppsV20 {
17    /// Rental app URL
18    pub store_uri: String,
19    /// Rental app discovery URL
20    pub discovery_uri: String,
21}
22
23/// GBFS System Information Rental App Container
24#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
25pub struct GBFSSystemInformationRentalAppV20 {
26    /// Android Rental App
27    pub android: Option<GBFSSystemInformationRentalAppsV20>,
28    /// iOS Rental App
29    pub ios: Option<GBFSSystemInformationRentalAppsV20>,
30}
31
32/// GBFS System Information Brand Assets
33#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
34pub struct GBFSSystemInformationBrandAssetsV20 {
35    /// Last modified date of the brand assets
36    pub brand_last_modified: String,
37    /// URL to the brand terms
38    pub brand_terms_url: Option<String>,
39    /// URL to the brand image
40    pub brand_image_url: String,
41    /// URL to the dark mode brand image
42    pub brand_image_url_dark: Option<String>,
43    /// Color used to represent the brand
44    pub color: Option<String>,
45}
46
47/// GBFS System Information Data V2.3
48#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
49pub struct GBFSSystemInformationDataV23 {
50    /// System ID
51    pub system_id: String,
52    /// System language
53    pub language: String, // Matches BCP-47 language tags
54    /// System name
55    pub name: String,
56    /// System short name
57    pub short_name: Option<String>,
58    /// System operator
59    pub operator: Option<String>,
60    /// System operator URL
61    pub url: Option<String>,
62    /// System purchase URL
63    pub purchase_url: Option<String>,
64    /// Start date
65    pub start_date: Option<String>, // ISO 8601 format
66    /// System phone number
67    pub phone_number: Option<String>,
68    /// System email
69    pub email: Option<String>,
70    /// System feed contact email
71    pub feed_contact_email: Option<String>,
72    /// System time zone
73    pub timezone: String,
74    /// System license
75    pub license_url: Option<String>,
76    /// System brand
77    pub brand_assets: Option<GBFSSystemInformationBrandAssetsV20>,
78    /// Terms URL
79    pub terms_url: Option<String>,
80    /// Terms last updated
81    pub terms_last_updated: Option<String>, // ISO 8601 format
82    /// Privacy URL
83    pub privacy_url: Option<String>,
84    /// Privacy last updated
85    pub privacy_last_updated: Option<String>, // ISO 8601 format
86    /// Rental apps
87    pub rental_apps: Option<GBFSSystemInformationRentalAppV20>,
88}
89
90/// # GBFS System Information V2.3
91/// Details including system operator, system location, year implemented, URL, contact info, and time zone.
92///
93/// ## Links
94/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_informationjson)
95#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
96pub struct GBFSSystemInformationV23 {
97    /// Last updated
98    pub last_updated: u64,
99    /// TTL
100    pub ttl: u64,
101    /// Version
102    pub version: String,
103    /// Data
104    pub data: GBFSSystemInformationDataV23,
105}
106
107/// # GBFS System Information Schema V2.2
108/// Details including system operator, system location, year implemented, URL, contact info, and time zone.
109///
110/// ## Links
111/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_informationjson)
112#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
113pub struct GBFSSystemInformationV22 {
114    /// Last updated
115    pub last_updated: u64,
116    /// TTL
117    pub ttl: u64,
118    /// Version
119    pub version: String,
120    /// Data
121    pub data: GBFSSystemInformationDataV20,
122}
123
124/// # GBFS System Information Schema V2.1
125/// Details including system operator, system location, year implemented, URL, contact info, and time zone.
126///
127/// ## Links
128/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_informationjson)
129#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
130pub struct GBFSSystemInformationV21 {
131    /// Last updated
132    pub last_updated: u64,
133    /// TTL
134    pub ttl: u64,
135    /// Version
136    pub version: String,
137    /// Data
138    pub data: GBFSSystemInformationDataV20,
139}
140
141/// GBFS System Information Data V2.0
142#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
143pub struct GBFSSystemInformationDataV20 {
144    /// System ID
145    pub system_id: String,
146    /// System language
147    pub language: String, // Matches BCP-47 language tags
148    /// System name
149    pub name: String,
150    /// System short name
151    pub short_name: Option<String>,
152    /// System operator
153    pub operator: Option<String>,
154    /// System operator URL
155    pub url: Option<String>,
156    /// System purchase URL
157    pub purchase_url: Option<String>,
158    /// Start date
159    pub start_date: Option<String>, // ISO 8601 format
160    /// System phone number
161    pub phone_number: Option<String>,
162    /// System email
163    pub email: Option<String>,
164    /// System feed contact email
165    pub feed_contact_email: Option<String>,
166    /// System time zone
167    pub timezone: String,
168    /// System license
169    pub license_url: Option<String>,
170    /// System brand
171    pub rental_apps: Option<GBFSSystemInformationRentalAppV20>,
172}
173
174/// # GBFS System Information Schema V2.0
175/// Details including system operator, system location, year implemented, URL, contact info, and time zone.
176///
177/// ## Links
178/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_informationjson)
179#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
180pub struct GBFSSystemInformationV20 {
181    /// Last updated
182    pub last_updated: u64,
183    /// TTL
184    pub ttl: u64,
185    /// Version
186    pub version: String,
187    /// Data
188    pub data: GBFSSystemInformationDataV20,
189}