use crate::models::{blog::Post, story::Story, Existing};
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct Settings {
pub key: String,
pub value: String,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct User {
pub account: SettingsAccount,
pub site: SettingsSite,
pub stories: Option<Vec<Existing<Story>>>,
pub posts: Option<Vec<Existing<Post>>>,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct SettingsAccount {
pub name: String,
pub email: Option<String>,
pub hash: Option<Vec<u8>>,
pub biography: Option<Vec<Existing<Part>>>,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct SettingsSite {
pub theme: SiteTheme,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub enum SiteTheme {
Dark,
Light,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct Part {
pub kind: PartKind,
pub comments: Vec<Existing<Comment>>,
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub enum PartKind {
Heading { level: u8 },
Image { url: String, alt: Option<String>, },
Text { content: String, words: i64, },
}
#[rustfmt::skip]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(serde::Deserialize, serde::Serialize)]
pub struct Comment {
pub author: Existing<User>,
pub main: Vec<Existing<Part>>,
pub children: Vec<Existing<Comment>>,
}