use crate::types::{Any, HashMap};
use beef::lean::Cow;
use ramhorns::Content;
use serde::{Deserialize, Serialize};
#[derive(Content, Default, Deserialize, Serialize)]
pub struct Site<'c> {
#[serde(borrow, default = "default_assets")]
pub assets: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub title: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub description: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub keywords: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub image: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub lang: Cow<'c, str>,
#[serde(borrow, default)]
pub author: Cow<'c, str>,
#[serde(borrow, default)]
pub email: Cow<'c, str>,
#[serde(borrow, default, skip_serializing_if = "str::is_empty")]
pub url: Cow<'c, str>,
#[serde(default = "default_true")]
pub sitemap: bool,
#[serde(default = "default_true")]
pub rss: bool,
#[serde(default = "default_true")]
pub atom: bool,
#[serde(flatten)]
#[ramhorns(flatten)]
pub extra: HashMap<&'c str, Any<'c>>,
}
#[inline]
const fn default_assets() -> Cow<'static, str> {
Cow::const_str("assets")
}
#[inline]
pub(crate) const fn default_true() -> bool {
true
}