gistools/readers/gbfs/schema_v1/
system_calendar.rs

1use alloc::{string::String, vec::Vec};
2use serde::{Deserialize, Serialize};
3
4/// # GBFS System Calendar Schema V1.1 OR GBFS System Calendar Schema V1.0
5/// Describes the operating calendar for a system.
6///
7/// ## Links
8/// - [GBFS Specification V1.1](https://github.com/MobilityData/gbfs/blob/v1.1/gbfs.md#system_calendarjson)
9/// - [GBFS Specification V1.0](https://github.com/MobilityData/gbfs/blob/v1.0/gbfs.md#system_calendarjson)
10pub type GBFSSystemCalendarV1 = GBFSSystemCalendarV11;
11
12/// GBFS System Calendar Calendar
13#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
14pub struct GBFSSystemCalendarCalendarV1 {
15    /// Start month of the calendar.
16    pub start_month: u64,
17    /// Start day of the calendar.
18    pub start_day: u64,
19    /// Start year of the calendar.
20    pub start_year: Option<u64>,
21    /// End month of the calendar.
22    pub end_month: u64,
23    /// End day of the calendar.
24    pub end_day: u64,
25    /// End year of the calendar.
26    pub end_year: Option<u64>,
27}
28
29/// GBFS System Calendar Data
30#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
31pub struct GBFSSystemCalendarDataV1 {
32    /// List of all the system's operating calendars.
33    pub calendars: Vec<GBFSSystemCalendarCalendarV1>,
34}
35
36/// GBFS System Calendar Schema V1.1 Interface
37#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
38pub struct GBFSSystemCalendarV11 {
39    /// Last time the data in the feed was updated in POSIX time.
40    pub last_updated: u64,
41    /// Number of seconds before the data in the feed will be updated again.
42    pub ttl: u64,
43    /// GBFS version number (1.1).
44    pub version: String,
45    /// Data containing the system's operations calendar.
46    pub data: GBFSSystemCalendarDataV1,
47}
48
49/// GBFS System Calendar Schema V1.0 Interface
50pub struct GBFSSystemCalendarV10 {
51    /// Last time the data in the feed was updated in POSIX time.
52    pub last_updated: u64,
53    /// Number of seconds before the data in the feed will be updated again.
54    pub ttl: u64,
55    /// Data containing the system's operations calendar.
56    pub data: GBFSSystemCalendarDataV1,
57}