/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct MatchLive {
#[serde(rename = "match_id")]
pub match_id: String,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "started_at", skip_serializing_if = "Option::is_none")]
pub started_at: Option<chrono::DateTime<chrono::FixedOffset>>,
#[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")]
pub completed_at: Option<chrono::DateTime<chrono::FixedOffset>>,
/// The lowest-sequence game whose `finished=false`. Null when every game is finished, no games have been seeded yet, or the match has no GRID counterpart.
#[serde(rename = "current_game", skip_serializing_if = "Option::is_none")]
pub current_game: Option<Box<models::MatchGame>>,
#[serde(rename = "games")]
pub games: Vec<models::MatchGame>,
/// BO-N overall score in `participants[].side_index` order (side A first, side B second).
#[serde(rename = "series_score")]
pub series_score: Vec<i32>,
/// `grid` when per-game live state is populating `games`. `liquipedia` when no per-game state exists — there is nothing to poll for this match.
#[serde(rename = "live_data_source")]
pub live_data_source: LiveDataSource,
/// Seconds since the most recent `games[]` row updated. `0` when no games rows exist or the data was just written.
#[serde(rename = "data_freshness_seconds")]
pub data_freshness_seconds: i32,
}
impl MatchLive {
pub fn new(match_id: String, status: Status, games: Vec<models::MatchGame>, series_score: Vec<i32>, live_data_source: LiveDataSource, data_freshness_seconds: i32) -> MatchLive {
MatchLive {
match_id,
status,
started_at: None,
completed_at: None,
current_game: None,
games,
series_score,
live_data_source,
data_freshness_seconds,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "scheduled")]
Scheduled,
#[serde(rename = "live")]
Live,
#[serde(rename = "completed")]
Completed,
#[serde(rename = "cancelled")]
Cancelled,
#[serde(rename = "postponed")]
Postponed,
}
impl Default for Status {
fn default() -> Status {
Self::Scheduled
}
}
/// `grid` when per-game live state is populating `games`. `liquipedia` when no per-game state exists — there is nothing to poll for this match.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LiveDataSource {
#[serde(rename = "grid")]
Grid,
#[serde(rename = "liquipedia")]
Liquipedia,
}
impl Default for LiveDataSource {
fn default() -> LiveDataSource {
Self::Grid
}
}