artifacts/models/
log_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 LogSchema {
7    /// Character name.
8    #[serde(rename = "character")]
9    pub character: String,
10    /// Account character.
11    #[serde(rename = "account")]
12    pub account: String,
13    /// Type of action.
14    #[serde(rename = "type")]
15    pub r#type: models::LogType,
16    /// Description of action.
17    #[serde(rename = "description")]
18    pub description: String,
19    #[serde(rename = "content", deserialize_with = "Option::deserialize")]
20    pub content: Option<serde_json::Value>,
21    /// Cooldown in seconds.
22    #[serde(rename = "cooldown")]
23    pub cooldown: i32,
24    #[serde(
25        rename = "cooldown_expiration",
26        deserialize_with = "Option::deserialize"
27    )]
28    pub cooldown_expiration: Option<String>,
29    /// Datetime of creation.
30    #[serde(rename = "created_at")]
31    pub created_at: String,
32}
33
34impl LogSchema {
35    pub fn new(
36        character: String,
37        account: String,
38        r#type: models::LogType,
39        description: String,
40        content: Option<serde_json::Value>,
41        cooldown: i32,
42        cooldown_expiration: Option<String>,
43        created_at: String,
44    ) -> LogSchema {
45        LogSchema {
46            character,
47            account,
48            r#type,
49            description,
50            content,
51            cooldown,
52            cooldown_expiration,
53            created_at,
54        }
55    }
56}