artifacts/models/
fight_schema.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct FightSchema {
7    /// The amount of xp gained from the fight.
8    #[serde(rename = "xp")]
9    pub xp: i32,
10    /// The amount of gold gained from the fight.
11    #[serde(rename = "gold")]
12    pub gold: i32,
13    /// The items dropped from the fight.
14    #[serde(rename = "drops")]
15    pub drops: Vec<models::DropSchema>,
16    /// Numbers of the turns of the combat.
17    #[serde(rename = "turns")]
18    pub turns: i32,
19    /// The fight logs.
20    #[serde(rename = "logs")]
21    pub logs: Vec<String>,
22    /// The result of the fight.
23    #[serde(rename = "result")]
24    pub result: models::FightResult,
25}
26
27impl FightSchema {
28    pub fn new(
29        xp: i32,
30        gold: i32,
31        drops: Vec<models::DropSchema>,
32        turns: i32,
33        logs: Vec<String>,
34        result: models::FightResult,
35    ) -> FightSchema {
36        FightSchema {
37            xp,
38            gold,
39            drops,
40            turns,
41            logs,
42            result,
43        }
44    }
45}