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
use common::MatchResultSimple;
use participants::Participant;

/// An opponent involved in a match.
#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Opponent {
    /// Number of the opponent
    pub number: i64,
    /// The participant represented in this opponent.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub participant: Option<Participant>,
    /// The result of the opponent. This property is only available on "duel" match format.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub result: Option<MatchResultSimple>,
    /// Rank of the opponent, compared to other opponents' ranks.
    /// This property is only available on matches of type "ffa".
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rank: Option<i64>,
    /// The score of this game.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub score: Option<i64>,
    /// Whether the opponent has forfeited or not.
    pub forfeit: bool,
}

/// List of the opponents involved in this match.
#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Opponents(pub Vec<Opponent>);