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 MatchGamePlayerStat {
    /// Which map in the series (1..N).
    #[serde(rename = "game_sequence")]
    pub game_sequence: i32,
    /// Canonical map name.
    #[serde(rename = "map", skip_serializing_if = "Option::is_none")]
    pub map: Option<String>,
    /// SteamID64 of the player (stable across maps).
    #[serde(rename = "player_id")]
    pub player_id: String,
    #[serde(rename = "name")]
    pub name: String,
    /// Which match side (A/B) the player was on.
    #[serde(rename = "side_index")]
    pub side_index: SideIndex,
    #[serde(rename = "kills")]
    pub kills: i32,
    #[serde(rename = "deaths")]
    pub deaths: i32,
    #[serde(rename = "assists")]
    pub assists: i32,
    #[serde(rename = "headshots")]
    pub headshots: i32,
    /// Total damage dealt to opponents over the map.
    #[serde(rename = "damage_dealt")]
    pub damage_dealt: i32,
    /// End-of-map cash.
    #[serde(rename = "money")]
    pub money: i32,
    #[serde(rename = "loadout_value")]
    pub loadout_value: i32,
    #[serde(rename = "net_worth")]
    pub net_worth: i32,
}

impl MatchGamePlayerStat {
    pub fn new(game_sequence: i32, player_id: String, name: String, side_index: SideIndex, kills: i32, deaths: i32, assists: i32, headshots: i32, damage_dealt: i32, money: i32, loadout_value: i32, net_worth: i32) -> MatchGamePlayerStat {
        MatchGamePlayerStat {
            game_sequence,
            map: None,
            player_id,
            name,
            side_index,
            kills,
            deaths,
            assists,
            headshots,
            damage_dealt,
            money,
            loadout_value,
            net_worth,
        }
    }
}
/// Which match side (A/B) the player was on.
#[repr(i64)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)]
pub enum SideIndex {
    Variant0 = 0,
    Variant1 = 1,
}

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

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