tba_openapi_rust/models/
match_simple.rs

1/*
2 * The Blue Alliance API v3
3 *
4 * # Overview    Information and statistics about FIRST Robotics Competition teams and events.   # Authentication   All endpoints require an Auth Key to be passed in the header `X-TBA-Auth-Key`. If you do not have an auth key yet, you can obtain one from your [Account Page](/account).
5 *
6 * The version of the OpenAPI document: 3.8.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct MatchSimple {
16    /// TBA match key with the format `yyyy[EVENT_CODE]_[COMP_LEVEL]m[MATCH_NUMBER]`, where `yyyy` is the year, and `EVENT_CODE` is the event code of the event, `COMP_LEVEL` is (qm, ef, qf, sf, f), and `MATCH_NUMBER` is the match number in the competition level. A set number may append the competition level if more than one match in required per set.
17    #[serde(rename = "key")]
18    pub key: String,
19    /// The competition level the match was played at.
20    #[serde(rename = "comp_level")]
21    pub comp_level: CompLevel,
22    /// The set number in a series of matches where more than one match is required in the match series.
23    #[serde(rename = "set_number")]
24    pub set_number: i32,
25    /// The match number of the match in the competition level.
26    #[serde(rename = "match_number")]
27    pub match_number: i32,
28    #[serde(rename = "alliances", skip_serializing_if = "Option::is_none")]
29    pub alliances: Option<Box<crate::models::MatchSimpleAlliances>>,
30    /// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
31    #[serde(rename = "winning_alliance", skip_serializing_if = "Option::is_none")]
32    pub winning_alliance: Option<WinningAlliance>,
33    /// Event key of the event the match was played at.
34    #[serde(rename = "event_key")]
35    pub event_key: String,
36    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the scheduled match time, as taken from the published schedule.
37    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
38    pub time: Option<i64>,
39    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the TBA predicted match start time.
40    #[serde(rename = "predicted_time", skip_serializing_if = "Option::is_none")]
41    pub predicted_time: Option<i64>,
42    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of actual match start time.
43    #[serde(rename = "actual_time", skip_serializing_if = "Option::is_none")]
44    pub actual_time: Option<i64>,
45}
46
47impl MatchSimple {
48    pub fn new(key: String, comp_level: CompLevel, set_number: i32, match_number: i32, event_key: String) -> MatchSimple {
49        MatchSimple {
50            key,
51            comp_level,
52            set_number,
53            match_number,
54            alliances: None,
55            winning_alliance: None,
56            event_key,
57            time: None,
58            predicted_time: None,
59            actual_time: None,
60        }
61    }
62}
63
64/// The competition level the match was played at.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum CompLevel {
67    #[serde(rename = "qm")]
68    Qm,
69    #[serde(rename = "ef")]
70    Ef,
71    #[serde(rename = "qf")]
72    Qf,
73    #[serde(rename = "sf")]
74    Sf,
75    #[serde(rename = "f")]
76    F,
77}
78
79impl Default for CompLevel {
80    fn default() -> CompLevel {
81        Self::Qm
82    }
83}
84/// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum WinningAlliance {
87    #[serde(rename = "red")]
88    Red,
89    #[serde(rename = "blue")]
90    Blue,
91    #[serde(rename = "")]
92    Empty,
93}
94
95impl Default for WinningAlliance {
96    fn default() -> WinningAlliance {
97        Self::Red
98    }
99}
100