use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct LogSchema {
#[serde(rename = "character")]
pub character: String,
#[serde(rename = "account")]
pub account: String,
#[serde(rename = "type")]
pub r#type: models::LogType,
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "content", deserialize_with = "Option::deserialize")]
#[cfg_attr(feature = "specta", specta(type = Option<specta_util::Unknown>))]
pub content: Option<serde_json::Value>,
#[serde(rename = "cooldown")]
pub cooldown: i32,
#[serde(
rename = "cooldown_expiration",
skip_serializing_if = "Option::is_none"
)]
pub cooldown_expiration: Option<String>,
#[serde(rename = "created_at")]
pub created_at: String,
}
impl LogSchema {
pub fn new(
character: String,
account: String,
r#type: models::LogType,
description: String,
content: Option<serde_json::Value>,
cooldown: i32,
created_at: String,
) -> LogSchema {
LogSchema {
character,
account,
r#type,
description,
content,
cooldown,
cooldown_expiration: None,
created_at,
}
}
}