ed_journals/modules/logs/content/log_event_content/
redeem_voucher_event.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
//! Fired when redeeming any kind of voucher.

use serde::{Deserialize, Serialize};

/// Fired when redeeming any kind of voucher.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct RedeemVoucherEvent {
    /// The type of voucher redeemed.
    #[serde(rename = "Type")]
    pub kind: RedeemVoucherEventType,

    /// The number of credits that were received from redeeming the voucher.
    pub amount: u64,

    /// List of factions that are linked to the voucher.
    #[serde(default)]
    pub factions: Vec<RedeemVoucherEventFaction>,

    /// This is used instead of the [factions] field when the [kind] is
    /// [RedeemVoucherEventType::Bounty].
    pub faction: Option<String>,

    /// Percentage that the broker received for redeeming the voucher.
    pub broker_percentage: Option<f32>,
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub enum RedeemVoucherEventType {
    CombatBond,

    #[serde(rename = "bounty")]
    Bounty,

    #[serde(rename = "trade")]
    Trade,

    #[serde(rename = "settlement")]
    Settlement,

    #[serde(rename = "scannable")]
    Scannable,

    #[serde(rename = "codex")]
    Codex,
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct RedeemVoucherEventFaction {
    pub faction: String,
    pub amount: u64,
}