// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: coop.hypha.spores.site.config
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
/// Site configuration for spores.garden, including title and subtitle.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Config<'a> {
    ///Body font ID
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub body_font: Option<ConfigBodyFont<'a>>,
    ///Deprecated legacy key for body font ID
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub font_body: Option<ConfigFontBody<'a>>,
    ///Deprecated legacy key for heading font ID
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub font_heading: Option<ConfigFontHeading<'a>>,
    ///Heading font ID
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub heading_font: Option<ConfigHeadingFont<'a>>,
    ///Site subtitle
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subtitle: Option<CowStr<'a>>,
    ///Site title
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub title: Option<CowStr<'a>>,
}

/// Body font ID

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConfigBodyFont<'a> {
    WorkSans,
    Georgia,
    JetbrainsMono,
    CourierNew,
    Other(CowStr<'a>),
}

impl<'a> ConfigBodyFont<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::WorkSans => "work-sans",
            Self::Georgia => "georgia",
            Self::JetbrainsMono => "jetbrains-mono",
            Self::CourierNew => "courier-new",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ConfigBodyFont<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ConfigBodyFont<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for ConfigBodyFont<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for ConfigBodyFont<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for ConfigBodyFont<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ConfigBodyFont<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for ConfigBodyFont<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ConfigBodyFont<'_> {
    type Output = ConfigBodyFont<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ConfigBodyFont::WorkSans => ConfigBodyFont::WorkSans,
            ConfigBodyFont::Georgia => ConfigBodyFont::Georgia,
            ConfigBodyFont::JetbrainsMono => ConfigBodyFont::JetbrainsMono,
            ConfigBodyFont::CourierNew => ConfigBodyFont::CourierNew,
            ConfigBodyFont::Other(v) => ConfigBodyFont::Other(v.into_static()),
        }
    }
}

/// Deprecated legacy key for body font ID

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConfigFontBody<'a> {
    WorkSans,
    Georgia,
    JetbrainsMono,
    CourierNew,
    Other(CowStr<'a>),
}

impl<'a> ConfigFontBody<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::WorkSans => "work-sans",
            Self::Georgia => "georgia",
            Self::JetbrainsMono => "jetbrains-mono",
            Self::CourierNew => "courier-new",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ConfigFontBody<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ConfigFontBody<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for ConfigFontBody<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for ConfigFontBody<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for ConfigFontBody<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ConfigFontBody<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for ConfigFontBody<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ConfigFontBody<'_> {
    type Output = ConfigFontBody<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ConfigFontBody::WorkSans => ConfigFontBody::WorkSans,
            ConfigFontBody::Georgia => ConfigFontBody::Georgia,
            ConfigFontBody::JetbrainsMono => ConfigFontBody::JetbrainsMono,
            ConfigFontBody::CourierNew => ConfigFontBody::CourierNew,
            ConfigFontBody::Other(v) => ConfigFontBody::Other(v.into_static()),
        }
    }
}

/// Deprecated legacy key for heading font ID

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConfigFontHeading<'a> {
    WorkSans,
    Georgia,
    JetbrainsMono,
    CourierNew,
    Other(CowStr<'a>),
}

impl<'a> ConfigFontHeading<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::WorkSans => "work-sans",
            Self::Georgia => "georgia",
            Self::JetbrainsMono => "jetbrains-mono",
            Self::CourierNew => "courier-new",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ConfigFontHeading<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ConfigFontHeading<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for ConfigFontHeading<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for ConfigFontHeading<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for ConfigFontHeading<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ConfigFontHeading<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for ConfigFontHeading<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ConfigFontHeading<'_> {
    type Output = ConfigFontHeading<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ConfigFontHeading::WorkSans => ConfigFontHeading::WorkSans,
            ConfigFontHeading::Georgia => ConfigFontHeading::Georgia,
            ConfigFontHeading::JetbrainsMono => ConfigFontHeading::JetbrainsMono,
            ConfigFontHeading::CourierNew => ConfigFontHeading::CourierNew,
            ConfigFontHeading::Other(v) => ConfigFontHeading::Other(v.into_static()),
        }
    }
}

/// Heading font ID

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConfigHeadingFont<'a> {
    WorkSans,
    Georgia,
    JetbrainsMono,
    CourierNew,
    Other(CowStr<'a>),
}

impl<'a> ConfigHeadingFont<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::WorkSans => "work-sans",
            Self::Georgia => "georgia",
            Self::JetbrainsMono => "jetbrains-mono",
            Self::CourierNew => "courier-new",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ConfigHeadingFont<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ConfigHeadingFont<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "work-sans" => Self::WorkSans,
            "georgia" => Self::Georgia,
            "jetbrains-mono" => Self::JetbrainsMono,
            "courier-new" => Self::CourierNew,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> core::fmt::Display for ConfigHeadingFont<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> AsRef<str> for ConfigHeadingFont<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> serde::Serialize for ConfigHeadingFont<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ConfigHeadingFont<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl<'a> Default for ConfigHeadingFont<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ConfigHeadingFont<'_> {
    type Output = ConfigHeadingFont<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ConfigHeadingFont::WorkSans => ConfigHeadingFont::WorkSans,
            ConfigHeadingFont::Georgia => ConfigHeadingFont::Georgia,
            ConfigHeadingFont::JetbrainsMono => ConfigHeadingFont::JetbrainsMono,
            ConfigHeadingFont::CourierNew => ConfigHeadingFont::CourierNew,
            ConfigHeadingFont::Other(v) => ConfigHeadingFont::Other(v.into_static()),
        }
    }
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConfigGetRecordOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Config<'a>,
}

impl<'a> Config<'a> {
    pub fn uri(
        uri: impl Into<CowStr<'a>>,
    ) -> Result<RecordUri<'a, ConfigRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct ConfigRecord;
impl XrpcResp for ConfigRecord {
    const NSID: &'static str = "coop.hypha.spores.site.config";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = ConfigGetRecordOutput<'de>;
    type Err<'de> = RecordError<'de>;
}

impl From<ConfigGetRecordOutput<'_>> for Config<'_> {
    fn from(output: ConfigGetRecordOutput<'_>) -> Self {
        use jacquard_common::IntoStatic;
        output.value.into_static()
    }
}

impl Collection for Config<'_> {
    const NSID: &'static str = "coop.hypha.spores.site.config";
    type Record = ConfigRecord;
}

impl Collection for ConfigRecord {
    const NSID: &'static str = "coop.hypha.spores.site.config";
    type Record = ConfigRecord;
}

impl<'a> LexiconSchema for Config<'a> {
    fn nsid() -> &'static str {
        "coop.hypha.spores.site.config"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_coop_hypha_spores_site_config()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.body_font {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("body_font"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.font_body {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("font_body"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.font_heading {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("font_heading"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.heading_font {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("heading_font"),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.subtitle {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("subtitle"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.subtitle {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 200usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("subtitle"),
                        max: 200usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.title {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.title {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 100usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("title"),
                        max: 100usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

pub mod config_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {}
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {}
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {}
}

/// Builder for constructing an instance of this type
pub struct ConfigBuilder<'a, S: config_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ConfigBodyFont<'a>>,
        Option<ConfigFontBody<'a>>,
        Option<ConfigFontHeading<'a>>,
        Option<ConfigHeadingFont<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Config<'a> {
    /// Create a new builder for this type
    pub fn new() -> ConfigBuilder<'a, config_state::Empty> {
        ConfigBuilder::new()
    }
}

impl<'a> ConfigBuilder<'a, config_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ConfigBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `bodyFont` field (optional)
    pub fn body_font(mut self, value: impl Into<Option<ConfigBodyFont<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `bodyFont` field to an Option value (optional)
    pub fn maybe_body_font(mut self, value: Option<ConfigBodyFont<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `fontBody` field (optional)
    pub fn font_body(mut self, value: impl Into<Option<ConfigFontBody<'a>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `fontBody` field to an Option value (optional)
    pub fn maybe_font_body(mut self, value: Option<ConfigFontBody<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `fontHeading` field (optional)
    pub fn font_heading(
        mut self,
        value: impl Into<Option<ConfigFontHeading<'a>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `fontHeading` field to an Option value (optional)
    pub fn maybe_font_heading(mut self, value: Option<ConfigFontHeading<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `headingFont` field (optional)
    pub fn heading_font(
        mut self,
        value: impl Into<Option<ConfigHeadingFont<'a>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `headingFont` field to an Option value (optional)
    pub fn maybe_heading_font(mut self, value: Option<ConfigHeadingFont<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `subtitle` field (optional)
    pub fn subtitle(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `subtitle` field to an Option value (optional)
    pub fn maybe_subtitle(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S: config_state::State> ConfigBuilder<'a, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<'a, S> ConfigBuilder<'a, S>
where
    S: config_state::State,
{
    /// Build the final struct
    pub fn build(self) -> Config<'a> {
        Config {
            body_font: self._fields.0,
            font_body: self._fields.1,
            font_heading: self._fields.2,
            heading_font: self._fields.3,
            subtitle: self._fields.4,
            title: self._fields.5,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Config<'a> {
        Config {
            body_font: self._fields.0,
            font_body: self._fields.1,
            font_heading: self._fields.2,
            heading_font: self._fields.3,
            subtitle: self._fields.4,
            title: self._fields.5,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_coop_hypha_spores_site_config() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("coop.hypha.spores.site.config"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "Site configuration for spores.garden, including title and subtitle.",
                        ),
                    ),
                    key: Some(CowStr::new_static("literal:self")),
                    record: LexRecordRecord::Object(LexObject {
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("bodyFont"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Body font ID")),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("fontBody"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Deprecated legacy key for body font ID"),
                                    ),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("fontHeading"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Deprecated legacy key for heading font ID",
                                        ),
                                    ),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("headingFont"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Heading font ID")),
                                    max_length: Some(50usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("subtitle"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Site subtitle")),
                                    max_length: Some(2000usize),
                                    max_graphemes: Some(200usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("title"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Site title")),
                                    max_length: Some(1000usize),
                                    max_graphemes: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}