gistools/readers/gbfs/schema_v2/system_regions.rs
1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Regions V2.3, V2.2, V2.1, OR V2.0
5/// Describes regions for a system that is broken up by geographic or political region.
6///
7/// ## Links
8/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_regionsjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_regionsjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_regionsjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_regionsjson)
12pub type GBFSSystemRegionsV2 = GBFSSystemRegionsV23;
13
14/// # GBFS System Regions Schema V2.3
15///
16/// Describes regions for a system that is broken up by geographic or political region.
17///
18/// **Links**:
19/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_regionsjson)
20#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
21pub struct GBFSSystemRegionsV23 {
22 /// Last time the data in the feed was updated in POSIX time
23 pub last_updated: u64,
24 /// Number of seconds before the data in the feed will be updated again
25 pub ttl: u64,
26 /// GBFS version number
27 pub version: String,
28 /// Region data
29 pub data: GBFSSystemRegionsDataV20,
30}
31
32/// # GBFS System Regions Schema V2.2
33///
34/// Describes regions for a system that is broken up by geographic or political region.
35///
36/// **Links**:
37/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_regionsjson)
38#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
39pub struct GBFSSystemRegionsV22 {
40 /// Last time the data in the feed was updated in POSIX time
41 pub last_updated: u64,
42 /// Number of seconds before the data in the feed will be updated again
43 pub ttl: u64,
44 /// GBFS version number
45 pub version: String,
46 /// Region data
47 pub data: GBFSSystemRegionsDataV20,
48}
49
50/// # GBFS System Regions Schema V2.1
51///
52/// Describes regions for a system that is broken up by geographic or political region.
53///
54/// **Links**:
55/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_regionsjson)
56#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
57pub struct GBFSSystemRegionsV21 {
58 /// Last time the data in the feed was updated in POSIX time
59 pub last_updated: u64,
60 /// Number of seconds before the data in the feed will be updated again
61 pub ttl: u64,
62 /// GBFS version number
63 pub version: String,
64 /// Region data
65 pub data: GBFSSystemRegionsDataV20,
66}
67
68/// GBFS Station Information Region
69#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
70pub struct GBFSSystemRegionsRegionV20 {
71 /// Identifier of the region
72 pub region_id: String,
73 /// Public name for the region
74 pub name: String,
75}
76
77/// GBFS Station Information Data
78#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
79pub struct GBFSSystemRegionsDataV20 {
80 /// Stations
81 pub regions: Vec<GBFSSystemRegionsRegionV20>,
82}
83
84/// # GBFS System Regions Schema V2.0
85///
86/// Describes regions for a system that is broken up by geographic or political region.
87///
88/// **Links**:
89/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_regionsjson)
90#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
91pub struct GBFSSystemRegionsV20 {
92 /// Last time the data in the feed was updated in POSIX time
93 pub last_updated: u64,
94 /// Number of seconds before the data in the feed will be updated again
95 pub ttl: u64,
96 /// GBFS version number
97 pub version: String,
98 /// Stations
99 pub data: GBFSSystemRegionsDataV20,
100}