gistools/readers/gbfs/schema_v2/
system_pricing_plans.rs

1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Pricing Plans V2.3, V2.2, V2.1, OR V2.0
5/// Describes the pricing schemes of the system.
6///
7/// ## Links
8/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_pricing_plansjson)
9/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_pricing_plansjson)
10/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_pricing_plansjson)
11/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_pricing_plansjson)
12pub type GBFSSystemPricingPlansV2 = GBFSSystemPricingPlansV23;
13
14/// # GBFS System Pricing Plans Schema V2.3
15/// Describes the pricing schemes of the system.
16///
17/// ## Links
18/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#system_pricing_plansjson)
19#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
20pub struct GBFSSystemPricingPlansV23 {
21    /// Last updated timestamp
22    pub last_updated: u64,
23    /// TTL
24    pub ttl: u64,
25    /// Version
26    pub version: String,
27    /// Pricing plans
28    pub data: GBFSSystemPricingPlansDataV22,
29}
30
31/// GBFS System Pricing Rate
32#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
33pub struct GBFSSystemPricingRateV22 {
34    /// Start
35    pub start: f64,
36    /// Rate
37    pub rate: f64,
38    /// Interval
39    pub interval: f64,
40    /// End
41    pub end: Option<f64>,
42}
43
44/// GBFS System Pricing Plan
45#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
46pub struct GBFSSystemPricingPlansPlanV22 {
47    /// Plan ID
48    pub plan_id: String,
49    /// Plan URL
50    pub url: Option<String>,
51    /// Plan name
52    pub name: String,
53    /// ISO 4217 currency code
54    pub currency: String,
55    /// Plan price
56    pub price: f64,
57    /// Plan is taxable
58    pub is_taxable: bool,
59    /// Plan description
60    pub description: String,
61    /// Array of segments when the price is a function of distance travelled, displayed in kilometers (added in v2.1-RC2).
62    pub per_km_pricing: Option<Vec<GBFSSystemPricingRateV22>>,
63    /// Array of segments when the price is a function of time travelled, displayed in minutes (added in v2.1-RC2).
64    pub per_min_pricing: Option<Vec<GBFSSystemPricingRateV22>>,
65    /// Is there currently an increase in price in response to increased demand in this pricing plan? (added in v2.1-RC2)
66    pub surge_pricing: Option<bool>,
67}
68
69/// GBFS System Pricing Plans Data
70#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
71pub struct GBFSSystemPricingPlansDataV22 {
72    /// Plans
73    pub plans: Vec<GBFSSystemPricingPlansPlanV22>,
74}
75
76/// # GBFS System Pricing Plans Schema V2.2
77/// Describes the pricing schemes of the system.
78///
79/// ## Links
80/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#system_pricing_plansjson)
81#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
82pub struct GBFSSystemPricingPlansV22 {
83    /// Last updated timestamp
84    pub last_updated: u64,
85    /// TTL
86    pub ttl: u64,
87    /// Version
88    pub version: String,
89    /// Pricing plans
90    pub data: GBFSSystemPricingPlansDataV22,
91}
92
93/// # GBFS System Pricing Plans Schema V2.1
94/// Describes the pricing schemes of the system.
95///
96/// ## Links
97/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#system_pricing_plansjson)
98#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
99pub struct GBFSSystemPricingPlansV21 {
100    /// Last updated timestamp
101    pub last_updated: u64,
102    /// TTL
103    pub ttl: u64,
104    /// Version
105    pub version: String,
106    /// Pricing plans
107    pub data: GBFSSystemPricingPlansDataV20,
108}
109
110/// GBFS System Pricing Plan
111#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
112pub struct GBFSSystemPricingPlansPlanV20 {
113    /// Plan ID
114    pub plan_id: String,
115    /// Plan URL
116    pub url: Option<String>,
117    /// Plan name
118    pub name: String,
119    /// ISO 4217 currency code
120    pub currency: String,
121    /// Plan price
122    pub price: f64,
123    /// Plan is taxable
124    pub is_taxable: bool,
125    /// Plan description
126    pub description: String,
127}
128
129/// GBFS System Pricing Plans Data
130#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
131pub struct GBFSSystemPricingPlansDataV20 {
132    /// Plans
133    pub plans: Vec<GBFSSystemPricingPlansPlanV20>,
134}
135
136/// # GBFS System Pricing Plans Schema V2.0
137/// Describes the pricing schemes of the system.
138///
139/// ## Links
140/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#system_pricing_plansjson)
141#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
142pub struct GBFSSystemPricingPlansV20 {
143    /// Last updated
144    pub last_updated: u64,
145    /// TTL
146    pub ttl: u64,
147    /// Version
148    pub version: String,
149    /// System plans
150    pub data: GBFSSystemPricingPlansDataV20,
151}