artifacts/models/
log_schema.rs1use 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 #[serde(rename = "character")]
9 pub character: String,
10 #[serde(rename = "account")]
12 pub account: String,
13 #[serde(rename = "type")]
15 pub r#type: models::LogType,
16 #[serde(rename = "description")]
18 pub description: String,
19 #[serde(rename = "content", deserialize_with = "Option::deserialize")]
20 pub content: Option<serde_json::Value>,
21 #[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 #[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}