stadar 0.1.25

Rust SDK for the stadar.net esports data API.
/*
 * Stadar Esports Data API
 *
 * Read-only esports data across all major competitive titles. Flat-tier pricing (no per-game gates), monthly subscriptions, sandbox keys for evaluation. See https://stadar.net for tier pricing. All endpoints under `/v1/...`. The version in `info.version` matches the URL prefix; non-breaking field additions ship in `/v1`, breaking changes get a `/v2`. We commit to 24 months of `/v1` support after `/v2` ships. Times are UTC end-to-end (RFC 3339). Localization is the client's problem. Cursors are opaque base64 strings; treat them as such. 
 *
 * The version of the OpenAPI document: v1
 * Contact: api@stadar.net
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

use serde_repr::{Serialize_repr,Deserialize_repr};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MatchRound {
    /// Which map in the series (1..N).
    #[serde(rename = "game_sequence")]
    pub game_sequence: i32,
    /// Canonical map name (e.g. `inferno`, `mirage`).
    #[serde(rename = "map", skip_serializing_if = "Option::is_none")]
    pub map: Option<String>,
    /// 1..N round order within the map.
    #[serde(rename = "round_number")]
    pub round_number: i32,
    /// 0 or 1 — the match side (A/B) that won the round; null if undecided.
    #[serde(rename = "winner_side", skip_serializing_if = "Option::is_none")]
    pub winner_side: Option<WinnerSide>,
    /// Round-end condition (e.g. `opponentEliminated`, bomb / defuse / time variants).
    #[serde(rename = "win_type", skip_serializing_if = "Option::is_none")]
    pub win_type: Option<String>,
    /// `counter-terrorists` or `terrorists` — side played by match side 0 this round (sides swap at the half).
    #[serde(rename = "team0_side", skip_serializing_if = "Option::is_none")]
    pub team0_side: Option<String>,
    /// Side played by match side 1 this round.
    #[serde(rename = "team1_side", skip_serializing_if = "Option::is_none")]
    pub team1_side: Option<String>,
}

impl MatchRound {
    pub fn new(game_sequence: i32, round_number: i32) -> MatchRound {
        MatchRound {
            game_sequence,
            map: None,
            round_number,
            winner_side: None,
            win_type: None,
            team0_side: None,
            team1_side: None,
        }
    }
}
/// 0 or 1 — the match side (A/B) that won the round; null if undecided.
#[repr(i64)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)]
pub enum WinnerSide {
    Variant0 = 0,
    Variant1 = 1,
}

impl std::fmt::Display for WinnerSide {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", match self {
            Self::Variant0 => "0",
            Self::Variant1 => "1",
        })
    }
}

impl Default for WinnerSide {
    fn default() -> WinnerSide {
        Self::Variant0
    }
}