// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: coop.hypha.spores.site.section
//
// 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, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
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};
/// A single site section for spores.garden. Each section is a record in a collection.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "coop.hypha.spores.site.section",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Section<S: BosStr = DefaultStr> {
    ///Collection NSID to display (for type=collection)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub collection: Option<S>,
    ///Content for block sections
    #[serde(skip_serializing_if = "Option::is_none")]
    pub content: Option<S>,
    ///Content format
    #[serde(skip_serializing_if = "Option::is_none")]
    pub format: Option<SectionFormat<S>>,
    ///If true, hides the section header in display mode
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hide_header: Option<bool>,
    ///Layout to use for rendering
    #[serde(skip_serializing_if = "Option::is_none")]
    pub layout: Option<SectionLayout<S>>,
    ///Maximum records to display
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    ///Specific record URIs to display (for type=records)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub records: Option<Vec<AtUri<S>>>,
    ///AT-URI of the referenced record (for content/profile sections)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#ref: Option<AtUri<S>>,
    ///Record key within the collection to display (e.g. 'self' for profile)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rkey: Option<S>,
    ///Section title
    #[serde(skip_serializing_if = "Option::is_none")]
    pub title: Option<S>,
    ///Section type
    pub r#type: SectionType<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Content format

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SectionFormat<S: BosStr = DefaultStr> {
    Markdown,
    Html,
    Text,
    Other(S),
}

impl<S: BosStr> SectionFormat<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Markdown => "markdown",
            Self::Html => "html",
            Self::Text => "text",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "markdown" => Self::Markdown,
            "html" => Self::Html,
            "text" => Self::Text,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for SectionFormat<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for SectionFormat<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for SectionFormat<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for SectionFormat<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SectionFormat<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SectionFormat::Markdown => SectionFormat::Markdown,
            SectionFormat::Html => SectionFormat::Html,
            SectionFormat::Text => SectionFormat::Text,
            SectionFormat::Other(v) => SectionFormat::Other(v.into_static()),
        }
    }
}

/// Layout to use for rendering

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SectionLayout<S: BosStr = DefaultStr> {
    Post,
    Card,
    Image,
    Link,
    Links,
    List,
    Profile,
    Raw,
    Other(S),
}

impl<S: BosStr> SectionLayout<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Post => "post",
            Self::Card => "card",
            Self::Image => "image",
            Self::Link => "link",
            Self::Links => "links",
            Self::List => "list",
            Self::Profile => "profile",
            Self::Raw => "raw",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "post" => Self::Post,
            "card" => Self::Card,
            "image" => Self::Image,
            "link" => Self::Link,
            "links" => Self::Links,
            "list" => Self::List,
            "profile" => Self::Profile,
            "raw" => Self::Raw,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for SectionLayout<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for SectionLayout<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for SectionLayout<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for SectionLayout<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SectionLayout<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SectionLayout::Post => SectionLayout::Post,
            SectionLayout::Card => SectionLayout::Card,
            SectionLayout::Image => SectionLayout::Image,
            SectionLayout::Link => SectionLayout::Link,
            SectionLayout::Links => SectionLayout::Links,
            SectionLayout::List => SectionLayout::List,
            SectionLayout::Profile => SectionLayout::Profile,
            SectionLayout::Raw => SectionLayout::Raw,
            SectionLayout::Other(v) => SectionLayout::Other(v.into_static()),
        }
    }
}

/// Section type

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SectionType<S: BosStr = DefaultStr> {
    Collection,
    Records,
    Content,
    Block,
    Profile,
    ShareToBluesky,
    CollectedFlowers,
    Other(S),
}

impl<S: BosStr> SectionType<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Collection => "collection",
            Self::Records => "records",
            Self::Content => "content",
            Self::Block => "block",
            Self::Profile => "profile",
            Self::ShareToBluesky => "share-to-bluesky",
            Self::CollectedFlowers => "collected-flowers",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "collection" => Self::Collection,
            "records" => Self::Records,
            "content" => Self::Content,
            "block" => Self::Block,
            "profile" => Self::Profile,
            "share-to-bluesky" => Self::ShareToBluesky,
            "collected-flowers" => Self::CollectedFlowers,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for SectionType<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for SectionType<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for SectionType<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for SectionType<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SectionType<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SectionType::Collection => SectionType::Collection,
            SectionType::Records => SectionType::Records,
            SectionType::Content => SectionType::Content,
            SectionType::Block => SectionType::Block,
            SectionType::Profile => SectionType::Profile,
            SectionType::ShareToBluesky => SectionType::ShareToBluesky,
            SectionType::CollectedFlowers => SectionType::CollectedFlowers,
            SectionType::Other(v) => SectionType::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 SectionGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Section<S>,
}

impl<S: BosStr> Section<S> {
    pub fn uri(uri: S) -> Result<RecordUri<S, SectionRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new(uri)?)
    }
}

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

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

impl<S: BosStr> From<SectionGetRecordOutput<S>> for Section<S> {
    fn from(output: SectionGetRecordOutput<S>) -> Self {
        output.value
    }
}

impl<S: BosStr> Collection for Section<S> {
    const NSID: &'static str = "coop.hypha.spores.site.section";
    type Record = SectionRecord;
}

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

impl<S: BosStr> LexiconSchema for Section<S> {
    fn nsid() -> &'static str {
        "coop.hypha.spores.site.section"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_coop_hypha_spores_site_section()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.content {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("content"),
                    max: 500000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.content {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 50000usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("content"),
                        max: 50000usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.limit {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("limit"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.limit {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("limit"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.title {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.title {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 200usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("title"),
                        max: 200usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

pub mod section_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 {
        type Type;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Type = Unset;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetType<St> {}
    impl<St: State> State for SetType<St> {
        type Type = Set<members::r#type>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `type` field
        pub struct r#type(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SectionBuilder<St: section_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<S>,
        Option<SectionFormat<S>>,
        Option<bool>,
        Option<SectionLayout<S>>,
        Option<i64>,
        Option<Vec<AtUri<S>>>,
        Option<AtUri<S>>,
        Option<S>,
        Option<S>,
        Option<SectionType<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Section<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> SectionBuilder<section_state::Empty, DefaultStr> {
        SectionBuilder::new()
    }
}

impl<S: BosStr> Section<S> {
    /// Create a new builder for this type
    pub fn builder() -> SectionBuilder<section_state::Empty, S> {
        SectionBuilder::builder()
    }
}

impl SectionBuilder<section_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        SectionBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> SectionBuilder<section_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        SectionBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `collection` field (optional)
    pub fn collection(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `collection` field to an Option value (optional)
    pub fn maybe_collection(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `content` field (optional)
    pub fn content(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `content` field to an Option value (optional)
    pub fn maybe_content(mut self, value: Option<S>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `format` field (optional)
    pub fn format(mut self, value: impl Into<Option<SectionFormat<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `format` field to an Option value (optional)
    pub fn maybe_format(mut self, value: Option<SectionFormat<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `hideHeader` field (optional)
    pub fn hide_header(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `hideHeader` field to an Option value (optional)
    pub fn maybe_hide_header(mut self, value: Option<bool>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `layout` field (optional)
    pub fn layout(mut self, value: impl Into<Option<SectionLayout<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `layout` field to an Option value (optional)
    pub fn maybe_layout(mut self, value: Option<SectionLayout<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `limit` field (optional)
    pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `limit` field to an Option value (optional)
    pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `records` field (optional)
    pub fn records(mut self, value: impl Into<Option<Vec<AtUri<S>>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `records` field to an Option value (optional)
    pub fn maybe_records(mut self, value: Option<Vec<AtUri<S>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `ref` field (optional)
    pub fn r#ref(mut self, value: impl Into<Option<AtUri<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `ref` field to an Option value (optional)
    pub fn maybe_ref(mut self, value: Option<AtUri<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `rkey` field (optional)
    pub fn rkey(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `rkey` field to an Option value (optional)
    pub fn maybe_rkey(mut self, value: Option<S>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St: section_state::State, S: BosStr> SectionBuilder<St, S> {
    /// Set the `title` field (optional)
    pub fn title(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `title` field to an Option value (optional)
    pub fn maybe_title(mut self, value: Option<S>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St, S: BosStr> SectionBuilder<St, S>
where
    St: section_state::State,
    St::Type: section_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<SectionType<S>>,
    ) -> SectionBuilder<section_state::SetType<St>, S> {
        self._fields.10 = Option::Some(value.into());
        SectionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SectionBuilder<St, S>
where
    St: section_state::State,
    St::Type: section_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Section<S> {
        Section {
            collection: self._fields.0,
            content: self._fields.1,
            format: self._fields.2,
            hide_header: self._fields.3,
            layout: self._fields.4,
            limit: self._fields.5,
            records: self._fields.6,
            r#ref: self._fields.7,
            rkey: self._fields.8,
            title: self._fields.9,
            r#type: self._fields.10.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Section<S> {
        Section {
            collection: self._fields.0,
            content: self._fields.1,
            format: self._fields.2,
            hide_header: self._fields.3,
            layout: self._fields.4,
            limit: self._fields.5,
            records: self._fields.6,
            r#ref: self._fields.7,
            rkey: self._fields.8,
            title: self._fields.9,
            r#type: self._fields.10.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_coop_hypha_spores_site_section() -> 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.section"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "A single site section for spores.garden. Each section is a record in a collection.",
                        ),
                    ),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(vec![SmolStr::new_static("type")]),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("collection"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Collection NSID to display (for type=collection)",
                                        ),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("content"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Content for block sections"),
                                    ),
                                    max_length: Some(500000usize),
                                    max_graphemes: Some(50000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("format"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Content format")),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("hideHeader"),
                                LexObjectProperty::Boolean(LexBoolean {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("layout"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Layout to use for rendering"),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("limit"),
                                LexObjectProperty::Integer(LexInteger {
                                    minimum: Some(1i64),
                                    maximum: Some(100i64),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("records"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Specific record URIs to display (for type=records)",
                                        ),
                                    ),
                                    items: LexArrayItem::String(LexString {
                                        format: Some(LexStringFormat::AtUri),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("ref"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "AT-URI of the referenced record (for content/profile sections)",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::AtUri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("rkey"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Record key within the collection to display (e.g. 'self' for profile)",
                                        ),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("title"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Section title")),
                                    max_length: Some(2000usize),
                                    max_graphemes: Some(200usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("type"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Section type")),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}