1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//! Enums for buses and operators
//! Used for transforming stringly typed data from API to enums

pub mod prelude {
    pub use crate::bus_enums::{BusCategory, BusFeature, BusLoad, BusType, Operator};
}

use serde::{Deserialize, Serialize};

/// SBST -> SBS Transit
///
/// SMRT -> SMRT Corporation
///
/// TTS -> Tower Transit Singapore
///
/// GAS -> Go Ahead Singapore
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, Default)]
pub enum Operator {
    #[serde(rename = "SBST")]
    Sbst,

    #[serde(rename = "SMRT")]
    Smrt,

    #[serde(rename = "TTS")]
    Tts,

    #[serde(rename = "GAS")]
    Gas,

    #[default]
    #[serde(other)]
    Unknown,
}

/// SD -> Single Decker
///
/// DD -> Double Decker
///
/// BD -> Bendy
#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize, Serialize, Default)]
#[serde(rename_all = "PascalCase")]
pub enum BusType {
    #[serde(rename = "SD")]
    SingleDecker,

    #[serde(rename = "DD")]
    DoubleDecker,

    #[serde(rename = "BD")]
    Bendy,

    #[default]
    #[serde(other)]
    Unknown,
}

/// SEA -> Seats available
///
/// SDA -> Standing available
///
/// LSD -> Limited standing
#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize, Serialize, Default)]
pub enum BusLoad {
    #[serde(rename = "SEA")]
    SeatsAvailable,

    #[serde(rename = "SDA")]
    StandingAvailable,

    #[serde(rename = "LSD")]
    LimitedStanding,

    #[default]
    #[serde(other)]
    Unknown,
}


#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize, Serialize, Default)]
pub enum BusFeature {
    #[serde(rename = "WAB")]
    WheelChairAccessible,

    #[default]
    #[serde(other)]
    Unknown,
}


#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize, Serialize, Default)]
pub enum BusCategory {
    #[serde(alias = "EXPRESS")]
    Express,

    #[serde(alias = "FEEDER")]
    Feeder,

    #[serde(alias = "INDUSTRIAL")]
    Industrial,

    #[serde(alias = "TOWNLINK")]
    TownLink,

    #[serde(alias = "TRUNK")]
    Trunk,

    #[serde(alias = "2-TIER FLAT FARE")]
    TwoTierFlatFare,

    #[serde(alias = "FLATFEE")]
    FlatFee,

    #[serde(alias = "NIGHT SERVICE")]
    NightService,

    #[serde(alias = "CITY_LINK")]
    CityLink,

    #[serde(alias = "FLAT FARE $2.00")]
    FlatFareTwoDollar,

    #[default]
    #[serde(other)]
    Unknown,
}