gistools/readers/gbfs/schema_v3/
system_pricing_plans.rs

1use crate::readers::GBFSName;
2use alloc::{string::String, vec::Vec};
3use serde::{Deserialize, Serialize};
4
5/// # GBFS System Pricing Plans Schema V3.1-RC & V3.0
6/// Describes the pricing schemes of the system.
7///
8/// ## Links
9/// - [GBFS Specification V3.1-RC](https://github.com/MobilityData/gbfs/blob/v3.1-RC/gbfs.md#system_pricing_plansjson)
10/// - [GBFS Specification V3.0](https://github.com/MobilityData/gbfs/blob/v3.0/gbfs.md#system_pricing_plansjson)
11pub type GBFSSystemPricingPlansV3 = GBFSSystemPricingPlansV30;
12
13/// GBFS System Pricing Plan Rates
14#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
15pub struct GBFSSystemPricingPlanRatesV30 {
16    /// Start distance or time.
17    pub start: f64,
18    /// Rate of the pricing plan.
19    pub rate: f64,
20    /// Interval of the pricing plan.
21    pub interval: f64,
22    /// End distance or time.
23    pub end: Option<f64>,
24}
25
26/// GBFS System Pricing Plan
27#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
28pub struct GBFSSystemPricingPlanV30 {
29    /// Identifier of the pricing plan.
30    pub plan_id: String,
31    /// URL where customers can learn more about this pricing plan.
32    pub url: Option<String>,
33    /// Name of the pricing plan.
34    pub name: Vec<GBFSName>,
35    /// Currency in ISO 4217 format.
36    pub currency: String,
37    /// Base price of the pricing plan.
38    pub price: f64,
39    /// Indicates if additional tax is applied to the base price.
40    pub is_taxable: bool,
41    /// Description of the pricing plan.
42    pub description: Vec<GBFSName>,
43    /// Segments for distance-based pricing.
44    pub per_km_pricing: Option<Vec<GBFSSystemPricingPlanRatesV30>>,
45    /// Segments for time-based pricing.
46    pub per_min_pricing: Option<Vec<GBFSSystemPricingPlanRatesV30>>,
47    /// Indicates if surge pricing is active.
48    pub surge_pricing: Option<bool>,
49}
50
51/// GBFS System Pricing Plans Data
52#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
53pub struct GBFSSystemPricingPlansDataV30 {
54    /// GBFS System Pricing Plan List
55    pub plans: Vec<GBFSSystemPricingPlanV30>,
56}
57
58/// # GBFS System Pricing Plans Schema V3.0
59/// Describes the pricing schemes of the system.
60///
61/// ## Links
62/// - [GBFS Specification V3.0](https://github.com/MobilityData/gbfs/blob/v3.0/gbfs.md#system_pricing_plansjson)
63#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
64pub struct GBFSSystemPricingPlansV30 {
65    /// Last time the data in the feed was updated in RFC3339 format.
66    pub last_updated: String,
67    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
68    pub ttl: u64,
69    /// GBFS version number to which the feed conforms.
70    pub version: String,
71    /// Pricing plan data.
72    pub data: GBFSSystemPricingPlansDataV30,
73}