1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use serde::Deserialize;
use time::OffsetDateTime;
use crate::model::Winner;
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize)]
pub struct CompactGame {
/// The game begin time, UTC.
/// `None` when the game status is [`GameStatus::NotStarted`].
#[serde(with = "time::serde::iso8601::option")]
pub begin_at: Option<OffsetDateTime>,
/// Whether the game statistics are complete and won't be updated again.
pub complete: bool,
/// Whether historical data is available for the game.
pub detailed_stats: bool,
/// The game end time, UTC.
/// `None` when the game status is not [`GameStatus::Finished`].
#[serde(with = "time::serde::iso8601::option")]
pub end_at: Option<OffsetDateTime>,
/// Whether the game is finished.
pub finished: bool,
/// Whether the game has been forfeited.
pub forfeit: bool,
/// ID of the game.
///
/// IDs are video game-specific, ie. a Valorant game and an Overwatch game can have the same
/// game ID.
pub id: u64,
/// Duration of the game in seconds.
///
/// `None` when the game status is not [`GameStatus::Finished`].
pub length: Option<u64>,
pub match_id: u64,
/// Game position in the match. Starts at 1.
pub position: u64,
/// The game status
pub status: GameStatus,
pub winner: Option<Winner>,
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum GameStatus {
Finished,
NotPlayed,
NotStarted,
Running,
}