gistools/readers/gbfs/schema_v1/
system_regions.rs

1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Regions Schema V1.1 OR GBFS System Regions Schema V1.0
5/// Describes regions for a system that is broken up by geographic or political region.
6///
7/// ## Links
8/// - [GBFS Specification V1.1](https://github.com/MobilityData/gbfs/blob/v1.1/gbfs.md#system_regionsjson)
9/// - [GBFS Specification V1.0](https://github.com/MobilityData/gbfs/blob/v1.0/gbfs.md#system_regionsjson)
10pub type GBFSSystemRegionsV1 = GBFSSystemRegionsV11;
11
12/// GBFS System Region
13#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
14pub struct GBFSSystemRegionV1 {
15    /// Region ID
16    pub region_id: String,
17    /// Region name
18    pub name: String,
19}
20
21/// GBFS System Regions Data
22#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
23pub struct GBFSSystemRegionsDataV1 {
24    /// List of regions
25    pub regions: Vec<GBFSSystemRegionV1>,
26}
27
28/// GBFS System Regions Schema V1.1 Interface
29#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
30pub struct GBFSSystemRegionsV11 {
31    /// Last time the data in the feed was updated in POSIX time.
32    pub last_updated: u64,
33    /// Number of seconds before the data in the feed will be updated again.
34    pub ttl: u64,
35    /// GBFS version number (1.1).
36    pub version: String,
37    /// Data describing regions for a system.
38    pub data: GBFSSystemRegionsDataV1,
39}
40
41/// GBFS System Regions Schema V1.0 Interface
42#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
43pub struct GBFSSystemRegionsV10 {
44    /// Last time the data in the feed was updated in POSIX time.
45    pub last_updated: u64,
46    /// Number of seconds before the data in the feed will be updated again.
47    pub ttl: u64,
48    /// Data describing regions for a system.
49    pub data: GBFSSystemRegionsDataV1,
50}