ed_journals/modules/civilization/models/
conflict.rs

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use serde::{Deserialize, Serialize};

/// Information about a current conflict or war in a system.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Conflict {
    /// The kind of conflict that is happening.
    pub war_type: ConflictWarType,

    /// The current status of the conflict.
    pub status: ConflictStatus,

    /// One of the factions that are part of the conflict.
    pub faction_1: ConflictFaction,

    /// The second one the factions that are part of the conflict.
    pub faction_2: ConflictFaction,
}

/// The kind of conflict.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub enum ConflictWarType {
    #[serde(rename = "election")]
    Election,

    #[serde(rename = "war")]
    War,

    #[serde(rename = "civilwar")]
    CivilWar,

    #[cfg(feature = "allow-unknown")]
    #[cfg_attr(docsrs, doc(cfg(feature = "allow-unknown")))]
    #[serde(untagged)]
    Unknown(String),
}

/// The status of a given conflict.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum ConflictStatus {
    #[serde(rename = "")]
    None,

    Active,
    Pending,
}

/// Information about the participating faction in a conflict.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct ConflictFaction {
    /// The name of the faction participating in a conflict.
    pub name: String,

    /// The name of the asset that is at stake in the conflict.
    pub stake: String,

    /// The number of days the faction has won in the conflict.
    pub won_days: u32,
}