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 MatchGame {
    /// 1..N game order within the series.
    #[serde(rename = "sequence")]
    pub sequence: i32,
    /// Canonical map name (e.g. `inferno`, `mirage`). Null for titles without a per-game map dimension (Dota 2, LoL). 
    #[serde(rename = "map", skip_serializing_if = "Option::is_none")]
    pub map: Option<String>,
    #[serde(rename = "finished")]
    pub finished: bool,
    /// Per-game / per-map score for side A. Round count in CS2. Null for titles whose per-game score isn't a flat integer (Dota 2, LoL). 
    #[serde(rename = "score_a", skip_serializing_if = "Option::is_none")]
    pub score_a: Option<i32>,
    #[serde(rename = "score_b", skip_serializing_if = "Option::is_none")]
    pub score_b: Option<i32>,
    /// Per-team kill count for the game. Null when the upstream returns zero (game not started, or the title doesn't expose a kills metric). 
    #[serde(rename = "kills_a", skip_serializing_if = "Option::is_none")]
    pub kills_a: Option<i32>,
    #[serde(rename = "kills_b", skip_serializing_if = "Option::is_none")]
    pub kills_b: Option<i32>,
    /// 0 or 1 once decided. Null until the game finishes (or permanently null for forfeit/technical-loss endings). 
    #[serde(rename = "winner_side", skip_serializing_if = "Option::is_none")]
    pub winner_side: Option<WinnerSide>,
}

impl MatchGame {
    pub fn new(sequence: i32, finished: bool) -> MatchGame {
        MatchGame {
            sequence,
            map: None,
            finished,
            score_a: None,
            score_b: None,
            kills_a: None,
            kills_b: None,
            winner_side: None,
        }
    }
}
/// 0 or 1 once decided. Null until the game finishes (or permanently null for forfeit/technical-loss endings). 
#[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
    }
}