// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: social.showcase.library.item
//
// 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, Datetime, UriValue};
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};
use crate::social_showcase::ItemImage;
/// Showcase item record

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "social.showcase.library.item",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Item<S: BosStr = DefaultStr> {
    ///Category/type of item
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<S>,
    pub created_at: Datetime,
    ///Item description
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Link to external site
    #[serde(skip_serializing_if = "Option::is_none")]
    pub external_link: Option<UriValue<S>>,
    ///Embedded image blobs (max 6 images, 2000x2000px max, 5MB each)
    pub images: Vec<ItemImage<S>>,
    ///Freeform metadata (brand, model, condition, datePurchased, etc.)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub metadata: Option<Data<S>>,
    ///Personal notes or story about the item
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notes: Option<S>,
    ///Schema version for migrations (defaults to 1 if missing)  Defaults to `1`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_item_schema_version")]
    pub schema_version: Option<i64>,
    ///Tags for discovery (max 20)
    pub tags: Vec<S>,
    ///Item title
    pub title: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    pub visibility: ItemVisibility<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ItemVisibility<S: BosStr = DefaultStr> {
    Public,
    Unlisted,
    Private,
    Other(S),
}

impl<S: BosStr> ItemVisibility<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Public => "public",
            Self::Unlisted => "unlisted",
            Self::Private => "private",
            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() {
            "public" => Self::Public,
            "unlisted" => Self::Unlisted,
            "private" => Self::Private,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ItemVisibility<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 ItemVisibility<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 ItemVisibility<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ItemVisibility<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ItemVisibility<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ItemVisibility::Public => ItemVisibility::Public,
            ItemVisibility::Unlisted => ItemVisibility::Unlisted,
            ItemVisibility::Private => ItemVisibility::Private,
            ItemVisibility::Other(v) => ItemVisibility::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 ItemGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Item<S>,
}

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

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

#[derive(Debug, Serialize, Deserialize)]
pub struct ItemRecord;
impl XrpcResp for ItemRecord {
    const NSID: &'static str = "social.showcase.library.item";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = ItemGetRecordOutput<S>;
    type Err = RecordError;
}

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

impl<S: BosStr> Collection for Item<S> {
    const NSID: &'static str = "social.showcase.library.item";
    type Record = ItemRecord;
}

impl Collection for ItemRecord {
    const NSID: &'static str = "social.showcase.library.item";
    type Record = ItemRecord;
}

impl<S: BosStr> LexiconSchema for Item<S> {
    fn nsid() -> &'static str {
        "social.showcase.library.item"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_library_item()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.category {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("category"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 3000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 3000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.images;
            #[allow(unused_comparisons)]
            if value.len() > 6usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("images"),
                    max: 6usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("notes"),
                    max: 2000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.tags;
            #[allow(unused_comparisons)]
            if value.len() > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("tags"),
                    max: 20usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.title;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 300usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("title"),
                    max: 300usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.visibility;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("visibility"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

fn _default_item_schema_version() -> Option<i64> {
    Some(1i64)
}

pub mod item_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 CreatedAt;
        type Images;
        type Tags;
        type Title;
        type Visibility;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Images = Unset;
        type Tags = Unset;
        type Title = Unset;
        type Visibility = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `images` field to Set
    pub struct SetImages<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetImages<St> {}
    impl<St: State> State for SetImages<St> {
        type CreatedAt = St::CreatedAt;
        type Images = Set<members::images>;
        type Tags = St::Tags;
        type Title = St::Title;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `tags` field to Set
    pub struct SetTags<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTags<St> {}
    impl<St: State> State for SetTags<St> {
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = Set<members::tags>;
        type Title = St::Title;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `title` field to Set
    pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTitle<St> {}
    impl<St: State> State for SetTitle<St> {
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = Set<members::title>;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `visibility` field to Set
    pub struct SetVisibility<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetVisibility<St> {}
    impl<St: State> State for SetVisibility<St> {
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Visibility = Set<members::visibility>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `images` field
        pub struct images(());
        ///Marker type for the `tags` field
        pub struct tags(());
        ///Marker type for the `title` field
        pub struct title(());
        ///Marker type for the `visibility` field
        pub struct visibility(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ItemBuilder<St: item_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<Datetime>,
        Option<S>,
        Option<UriValue<S>>,
        Option<Vec<ItemImage<S>>>,
        Option<Data<S>>,
        Option<S>,
        Option<i64>,
        Option<Vec<S>>,
        Option<S>,
        Option<Datetime>,
        Option<ItemVisibility<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Item<S> {
    /// Create a new builder for this type
    pub fn builder() -> ItemBuilder<item_state::Empty, S> {
        ItemBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::CreatedAt: item_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ItemBuilder<item_state::SetCreatedAt<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: item_state::State, S: BosStr> ItemBuilder<St, S> {
    /// Set the `externalLink` field (optional)
    pub fn external_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `externalLink` field to an Option value (optional)
    pub fn maybe_external_link(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::Images: item_state::IsUnset,
{
    /// Set the `images` field (required)
    pub fn images(
        mut self,
        value: impl Into<Vec<ItemImage<S>>>,
    ) -> ItemBuilder<item_state::SetImages<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: item_state::State, S: BosStr> ItemBuilder<St, S> {
    /// Set the `metadata` field (optional)
    pub fn metadata(mut self, value: impl Into<Option<Data<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `metadata` field to an Option value (optional)
    pub fn maybe_metadata(mut self, value: Option<Data<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: item_state::State, S: BosStr> ItemBuilder<St, S> {
    /// Set the `notes` field (optional)
    pub fn notes(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `notes` field to an Option value (optional)
    pub fn maybe_notes(mut self, value: Option<S>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: item_state::State, S: BosStr> ItemBuilder<St, S> {
    /// Set the `schemaVersion` field (optional)
    pub fn schema_version(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `schemaVersion` field to an Option value (optional)
    pub fn maybe_schema_version(mut self, value: Option<i64>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::Tags: item_state::IsUnset,
{
    /// Set the `tags` field (required)
    pub fn tags(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ItemBuilder<item_state::SetTags<St>, S> {
        self._fields.8 = Option::Some(value.into());
        ItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::Title: item_state::IsUnset,
{
    /// Set the `title` field (required)
    pub fn title(
        mut self,
        value: impl Into<S>,
    ) -> ItemBuilder<item_state::SetTitle<St>, S> {
        self._fields.9 = Option::Some(value.into());
        ItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: item_state::State, S: BosStr> ItemBuilder<St, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `updatedAt` field to an Option value (optional)
    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::Visibility: item_state::IsUnset,
{
    /// Set the `visibility` field (required)
    pub fn visibility(
        mut self,
        value: impl Into<ItemVisibility<S>>,
    ) -> ItemBuilder<item_state::SetVisibility<St>, S> {
        self._fields.11 = Option::Some(value.into());
        ItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ItemBuilder<St, S>
where
    St: item_state::State,
    St::CreatedAt: item_state::IsSet,
    St::Images: item_state::IsSet,
    St::Tags: item_state::IsSet,
    St::Title: item_state::IsSet,
    St::Visibility: item_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Item<S> {
        Item {
            category: self._fields.0,
            created_at: self._fields.1.unwrap(),
            description: self._fields.2,
            external_link: self._fields.3,
            images: self._fields.4.unwrap(),
            metadata: self._fields.5,
            notes: self._fields.6,
            schema_version: self._fields.7.or_else(|| Some(1i64)),
            tags: self._fields.8.unwrap(),
            title: self._fields.9.unwrap(),
            updated_at: self._fields.10,
            visibility: self._fields.11.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>>) -> Item<S> {
        Item {
            category: self._fields.0,
            created_at: self._fields.1.unwrap(),
            description: self._fields.2,
            external_link: self._fields.3,
            images: self._fields.4.unwrap(),
            metadata: self._fields.5,
            notes: self._fields.6,
            schema_version: self._fields.7.or_else(|| Some(1i64)),
            tags: self._fields.8.unwrap(),
            title: self._fields.9.unwrap(),
            updated_at: self._fields.10,
            visibility: self._fields.11.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_showcase_library_item() -> 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("social.showcase.library.item"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(CowStr::new_static("Showcase item record")),
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("title"), SmolStr::new_static("tags"),
                                SmolStr::new_static("images"),
                                SmolStr::new_static("visibility"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("category"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Category/type of item"),
                                    ),
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("description"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Item description")),
                                    max_length: Some(3000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("externalLink"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Link to external site"),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("images"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Embedded image blobs (max 6 images, 2000x2000px max, 5MB each)",
                                        ),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static("social.showcase.defs#itemImage"),
                                        ..Default::default()
                                    }),
                                    max_length: Some(6usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("metadata"),
                                LexObjectProperty::Unknown(LexUnknown {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("notes"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Personal notes or story about the item"),
                                    ),
                                    max_length: Some(2000usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("schemaVersion"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("tags"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("Tags for discovery (max 20)"),
                                    ),
                                    items: LexArrayItem::String(LexString {
                                        max_length: Some(64usize),
                                        ..Default::default()
                                    }),
                                    max_length: Some(20usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("title"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Item title")),
                                    max_length: Some(300usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("updatedAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("visibility"),
                                LexObjectProperty::String(LexString {
                                    max_length: Some(10usize),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}