tba-openapi-rust 3.8.2

# 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).
Documentation
/*
 * The Blue Alliance API v3
 *
 * # 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).
 *
 * The version of the OpenAPI document: 3.8.2
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct MatchSimple {
    /// 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.
    #[serde(rename = "key")]
    pub key: String,
    /// The competition level the match was played at.
    #[serde(rename = "comp_level")]
    pub comp_level: CompLevel,
    /// The set number in a series of matches where more than one match is required in the match series.
    #[serde(rename = "set_number")]
    pub set_number: i32,
    /// The match number of the match in the competition level.
    #[serde(rename = "match_number")]
    pub match_number: i32,
    #[serde(rename = "alliances", skip_serializing_if = "Option::is_none")]
    pub alliances: Option<Box<crate::models::MatchSimpleAlliances>>,
    /// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
    #[serde(rename = "winning_alliance", skip_serializing_if = "Option::is_none")]
    pub winning_alliance: Option<WinningAlliance>,
    /// Event key of the event the match was played at.
    #[serde(rename = "event_key")]
    pub event_key: String,
    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the scheduled match time, as taken from the published schedule.
    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
    pub time: Option<i64>,
    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of the TBA predicted match start time.
    #[serde(rename = "predicted_time", skip_serializing_if = "Option::is_none")]
    pub predicted_time: Option<i64>,
    /// UNIX timestamp (seconds since 1-Jan-1970 00:00:00) of actual match start time.
    #[serde(rename = "actual_time", skip_serializing_if = "Option::is_none")]
    pub actual_time: Option<i64>,
}

impl MatchSimple {
    pub fn new(key: String, comp_level: CompLevel, set_number: i32, match_number: i32, event_key: String) -> MatchSimple {
        MatchSimple {
            key,
            comp_level,
            set_number,
            match_number,
            alliances: None,
            winning_alliance: None,
            event_key,
            time: None,
            predicted_time: None,
            actual_time: None,
        }
    }
}

/// The competition level the match was played at.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CompLevel {
    #[serde(rename = "qm")]
    Qm,
    #[serde(rename = "ef")]
    Ef,
    #[serde(rename = "qf")]
    Qf,
    #[serde(rename = "sf")]
    Sf,
    #[serde(rename = "f")]
    F,
}

impl Default for CompLevel {
    fn default() -> CompLevel {
        Self::Qm
    }
}
/// The color (red/blue) of the winning alliance. Will contain an empty string in the event of no winner, or a tie.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum WinningAlliance {
    #[serde(rename = "red")]
    Red,
    #[serde(rename = "blue")]
    Blue,
    #[serde(rename = "")]
    Empty,
}

impl Default for WinningAlliance {
    fn default() -> WinningAlliance {
        Self::Red
    }
}