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 #[cfg_attr(feature = "specta", specta(type = Option<specta_util::Unknown>))]
21 pub content: Option<serde_json::Value>,
22 #[serde(rename = "cooldown")]
24 pub cooldown: i32,
25 #[serde(
27 rename = "cooldown_expiration",
28 skip_serializing_if = "Option::is_none"
29 )]
30 pub cooldown_expiration: Option<String>,
31 #[serde(rename = "created_at")]
33 pub created_at: String,
34}
35
36impl LogSchema {
37 pub fn new(
38 character: String,
39 account: String,
40 r#type: models::LogType,
41 description: String,
42 content: Option<serde_json::Value>,
43 cooldown: i32,
44 created_at: String,
45 ) -> LogSchema {
46 LogSchema {
47 character,
48 account,
49 r#type,
50 description,
51 content,
52 cooldown,
53 cooldown_expiration: None,
54 created_at,
55 }
56 }
57}