// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: social.showcase.defs
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

//! Generated bindings for the `social.showcase` Lexicon namespace/module.
pub mod collection;
pub mod feed;
pub mod graph;
pub mod library;
pub mod profile;


#[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::blob::BlobRef;
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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;
/// Activity sharing preferences

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ActivitySettings<S: BosStr = DefaultStr> {
    ///Activity retention period  Defaults to `90`.
    #[serde(default = "_default_activity_settings_retention_days")]
    pub retention_days: i64,
    ///Who sees your activity feed
    pub share_activity: ActivitySettingsShareActivity<S>,
    ///Share new items in followers' feeds
    pub share_new_items: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Who sees your activity feed

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ActivitySettingsShareActivity<S: BosStr = DefaultStr> {
    All,
    Followers,
    None,
    Other(S),
}

impl<S: BosStr> ActivitySettingsShareActivity<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::All => "all",
            Self::Followers => "followers",
            Self::None => "none",
            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() {
            "all" => Self::All,
            "followers" => Self::Followers,
            "none" => Self::None,
            _ => Self::Other(s),
        }
    }
}

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

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

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

impl<S: BosStr> jacquard_common::IntoStatic for ActivitySettingsShareActivity<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ActivitySettingsShareActivity<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ActivitySettingsShareActivity::All => ActivitySettingsShareActivity::All,
            ActivitySettingsShareActivity::Followers => {
                ActivitySettingsShareActivity::Followers
            }
            ActivitySettingsShareActivity::None => ActivitySettingsShareActivity::None,
            ActivitySettingsShareActivity::Other(v) => {
                ActivitySettingsShareActivity::Other(v.into_static())
            }
        }
    }
}

/// Image aspect ratio

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AspectRatio<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub height: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub width: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Reference to an item in a collection

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CollectionItem<S: BosStr = DefaultStr> {
    pub added_at: Datetime,
    ///For custom sorting
    pub order: i64,
    ///AT-URI reference to item (always shows latest version)
    pub uri: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// View of a collection with items

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CollectionView<S: BosStr = DefaultStr> {
    pub author: social_showcase::ProfileView<S>,
    pub cid: Cid<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover_image: Option<BlobRef<S>>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub item_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<social_showcase::ItemView<S>>>,
    pub name: S,
    pub tags: Vec<S>,
    pub r#type: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    pub uri: AtUri<S>,
    pub visibility: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Display preferences

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DisplaySettings<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub grid_layout: Option<DisplaySettingsGridLayout<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub theme: Option<DisplaySettingsTheme<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 DisplaySettingsGridLayout<S: BosStr = DefaultStr> {
    Compact,
    Spacious,
    Other(S),
}

impl<S: BosStr> DisplaySettingsGridLayout<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Compact => "compact",
            Self::Spacious => "spacious",
            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() {
            "compact" => Self::Compact,
            "spacious" => Self::Spacious,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum DisplaySettingsTheme<S: BosStr = DefaultStr> {
    Light,
    Dark,
    Auto,
    Other(S),
}

impl<S: BosStr> DisplaySettingsTheme<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Light => "light",
            Self::Dark => "dark",
            Self::Auto => "auto",
            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() {
            "light" => Self::Light,
            "dark" => Self::Dark,
            "auto" => Self::Auto,
            _ => Self::Other(s),
        }
    }
}

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

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

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

impl<S: BosStr> jacquard_common::IntoStatic for DisplaySettingsTheme<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = DisplaySettingsTheme<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            DisplaySettingsTheme::Light => DisplaySettingsTheme::Light,
            DisplaySettingsTheme::Dark => DisplaySettingsTheme::Dark,
            DisplaySettingsTheme::Auto => DisplaySettingsTheme::Auto,
            DisplaySettingsTheme::Other(v) => {
                DisplaySettingsTheme::Other(v.into_static())
            }
        }
    }
}

/// Image embedded in an item

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ItemImage<S: BosStr = DefaultStr> {
    ///Alt text for accessibility
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alt: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub aspect_ratio: Option<social_showcase::AspectRatio<S>>,
    pub blob: BlobRef<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// View of an item with metadata

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ItemView<S: BosStr = DefaultStr> {
    pub author: social_showcase::ProfileView<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub category: Option<S>,
    pub cid: Cid<S>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub external_link: Option<UriValue<S>>,
    pub images: Vec<social_showcase::ItemImage<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub metadata: Option<Data<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reaction_count: Option<i64>,
    pub tags: Vec<S>,
    pub title: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    pub uri: AtUri<S>,
    pub visibility: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Notification preferences

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct NotificationSettings<S: BosStr = DefaultStr> {
    pub comments: bool,
    pub follows: bool,
    pub reactions: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Privacy preferences

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PrivacySettings<S: BosStr = DefaultStr> {
    ///Let others comment
    pub allow_comments: bool,
    ///Let others react to your items
    pub allow_reactions: bool,
    ///Appear in search results
    pub indexable: bool,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// View of a user profile

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<BlobRef<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub banner: Option<BlobRef<S>>,
    pub did: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    pub handle: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Subject of a reaction

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReactionSubject<S: BosStr = DefaultStr> {
    pub cid: Cid<S>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// View of a reaction to content

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReactionView<S: BosStr = DefaultStr> {
    pub actor: social_showcase::ProfileView<S>,
    pub created_at: Datetime,
    pub subject: social_showcase::ReactionSubject<S>,
    ///Emoji shortcode
    pub r#type: S,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A reference to an item featured in a user's showcase (hydrated at read time)

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ShowcaseItem<S: BosStr = DefaultStr> {
    pub added_at: Datetime,
    ///Display order (0 = first)
    pub order: i64,
    ///AT-URI reference to the item (e.g., at://did:plc:.../social.showcase.library.item/abc123)
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Visibility preferences

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct VisibilitySettings<S: BosStr = DefaultStr> {
    pub default_collection_visibility: VisibilitySettingsDefaultCollectionVisibility<S>,
    pub default_item_visibility: VisibilitySettingsDefaultItemVisibility<S>,
    pub profile_visibility: VisibilitySettingsProfileVisibility<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 VisibilitySettingsDefaultCollectionVisibility<S: BosStr = DefaultStr> {
    Public,
    Private,
    Other(S),
}

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

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

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

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

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


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

impl<S: BosStr> VisibilitySettingsDefaultItemVisibility<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 VisibilitySettingsDefaultItemVisibility<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

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

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

impl<S: BosStr> jacquard_common::IntoStatic
for VisibilitySettingsDefaultItemVisibility<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = VisibilitySettingsDefaultItemVisibility<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            VisibilitySettingsDefaultItemVisibility::Public => {
                VisibilitySettingsDefaultItemVisibility::Public
            }
            VisibilitySettingsDefaultItemVisibility::Unlisted => {
                VisibilitySettingsDefaultItemVisibility::Unlisted
            }
            VisibilitySettingsDefaultItemVisibility::Private => {
                VisibilitySettingsDefaultItemVisibility::Private
            }
            VisibilitySettingsDefaultItemVisibility::Other(v) => {
                VisibilitySettingsDefaultItemVisibility::Other(v.into_static())
            }
        }
    }
}


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

impl<S: BosStr> VisibilitySettingsProfileVisibility<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 VisibilitySettingsProfileVisibility<S> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

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

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

impl<S: BosStr> jacquard_common::IntoStatic for VisibilitySettingsProfileVisibility<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = VisibilitySettingsProfileVisibility<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            VisibilitySettingsProfileVisibility::Public => {
                VisibilitySettingsProfileVisibility::Public
            }
            VisibilitySettingsProfileVisibility::Unlisted => {
                VisibilitySettingsProfileVisibility::Unlisted
            }
            VisibilitySettingsProfileVisibility::Private => {
                VisibilitySettingsProfileVisibility::Private
            }
            VisibilitySettingsProfileVisibility::Other(v) => {
                VisibilitySettingsProfileVisibility::Other(v.into_static())
            }
        }
    }
}

impl<S: BosStr> LexiconSchema for ActivitySettings<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "activitySettings"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.share_activity;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("share_activity"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AspectRatio<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "aspectRatio"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.height {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("height"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.width {
            if *value < 1i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("width"),
                    min: 1i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for CollectionItem<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "collectionItem"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.uri;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 8192usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("uri"),
                    max: 8192usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for CollectionView<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "collectionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 200usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 200usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.r#type;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 20usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("type"),
                    max: 20usize,
                    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(())
    }
}

impl<S: BosStr> LexiconSchema for DisplaySettings<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "displaySettings"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.grid_layout {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("grid_layout"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.theme {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("theme"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ItemImage<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "itemImage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.alt {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 300usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("alt"),
                    max: 300usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.blob;
            {
                let size = value.blob().size;
                if size > 5000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("blob"),
                        max: 5000000usize,
                        actual: size,
                    });
                }
            }
        }
        {
            let value = &self.blob;
            {
                let mime = value.blob().mime_type.as_str();
                let accepted: &[&str] = &["image/png", "image/jpeg", "image/webp"];
                let matched = accepted
                    .iter()
                    .any(|pattern| {
                        if *pattern == "*/*" {
                            true
                        } else if pattern.ends_with("/*") {
                            let prefix = &pattern[..pattern.len() - 2];
                            mime.starts_with(prefix)
                                && mime.as_bytes().get(prefix.len()) == Some(&b'/')
                        } else {
                            mime == *pattern
                        }
                    });
                if !matched {
                    return Err(ConstraintError::BlobMimeTypeNotAccepted {
                        path: ValidationPath::from_field("blob"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string(),
                            "image/webp".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ItemView<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "itemView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    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()),
                });
            }
        }
        if let Some(ref value) = self.external_link {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2048usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("external_link"),
                    max: 2048usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            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(())
    }
}

impl<S: BosStr> LexiconSchema for NotificationSettings<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "notificationSettings"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for PrivacySettings<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "privacySettings"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileView<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "profileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.did;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2048usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("did"),
                    max: 2048usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.display_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 64usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("display_name"),
                    max: 64usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.handle;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 253usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("handle"),
                    max: 253usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReactionSubject<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "reactionSubject"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReactionView<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "reactionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.r#type;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("type"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ShowcaseItem<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "showcaseItem"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for VisibilitySettings<S> {
    fn nsid() -> &'static str {
        "social.showcase.defs"
    }
    fn def_name() -> &'static str {
        "visibilitySettings"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.default_collection_visibility;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("default_collection_visibility"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.default_item_visibility;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("default_item_visibility"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.profile_visibility;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("profile_visibility"),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

fn _default_activity_settings_retention_days() -> i64 {
    90i64
}

pub mod activity_settings_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 RetentionDays;
        type ShareActivity;
        type ShareNewItems;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type RetentionDays = Unset;
        type ShareActivity = Unset;
        type ShareNewItems = Unset;
    }
    ///State transition - sets the `retention_days` field to Set
    pub struct SetRetentionDays<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRetentionDays<St> {}
    impl<St: State> State for SetRetentionDays<St> {
        type RetentionDays = Set<members::retention_days>;
        type ShareActivity = St::ShareActivity;
        type ShareNewItems = St::ShareNewItems;
    }
    ///State transition - sets the `share_activity` field to Set
    pub struct SetShareActivity<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetShareActivity<St> {}
    impl<St: State> State for SetShareActivity<St> {
        type RetentionDays = St::RetentionDays;
        type ShareActivity = Set<members::share_activity>;
        type ShareNewItems = St::ShareNewItems;
    }
    ///State transition - sets the `share_new_items` field to Set
    pub struct SetShareNewItems<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetShareNewItems<St> {}
    impl<St: State> State for SetShareNewItems<St> {
        type RetentionDays = St::RetentionDays;
        type ShareActivity = St::ShareActivity;
        type ShareNewItems = Set<members::share_new_items>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `retention_days` field
        pub struct retention_days(());
        ///Marker type for the `share_activity` field
        pub struct share_activity(());
        ///Marker type for the `share_new_items` field
        pub struct share_new_items(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ActivitySettingsBuilder<
    St: activity_settings_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<i64>, Option<ActivitySettingsShareActivity<S>>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ActivitySettings<S> {
    /// Create a new builder for this type
    pub fn builder() -> ActivitySettingsBuilder<activity_settings_state::Empty, S> {
        ActivitySettingsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ActivitySettingsBuilder<St, S>
where
    St: activity_settings_state::State,
    St::RetentionDays: activity_settings_state::IsUnset,
{
    /// Set the `retentionDays` field (required)
    pub fn retention_days(
        mut self,
        value: impl Into<i64>,
    ) -> ActivitySettingsBuilder<activity_settings_state::SetRetentionDays<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ActivitySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ActivitySettingsBuilder<St, S>
where
    St: activity_settings_state::State,
    St::ShareActivity: activity_settings_state::IsUnset,
{
    /// Set the `shareActivity` field (required)
    pub fn share_activity(
        mut self,
        value: impl Into<ActivitySettingsShareActivity<S>>,
    ) -> ActivitySettingsBuilder<activity_settings_state::SetShareActivity<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ActivitySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ActivitySettingsBuilder<St, S>
where
    St: activity_settings_state::State,
    St::ShareNewItems: activity_settings_state::IsUnset,
{
    /// Set the `shareNewItems` field (required)
    pub fn share_new_items(
        mut self,
        value: impl Into<bool>,
    ) -> ActivitySettingsBuilder<activity_settings_state::SetShareNewItems<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ActivitySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ActivitySettingsBuilder<St, S>
where
    St: activity_settings_state::State,
    St::RetentionDays: activity_settings_state::IsSet,
    St::ShareActivity: activity_settings_state::IsSet,
    St::ShareNewItems: activity_settings_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ActivitySettings<S> {
        ActivitySettings {
            retention_days: self._fields.0.unwrap(),
            share_activity: self._fields.1.unwrap(),
            share_new_items: self._fields.2.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>>,
    ) -> ActivitySettings<S> {
        ActivitySettings {
            retention_days: self._fields.0.unwrap(),
            share_activity: self._fields.1.unwrap(),
            share_new_items: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_showcase_defs() -> 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.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("activitySettings"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Activity sharing preferences"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("shareNewItems"),
                            SmolStr::new_static("shareActivity"),
                            SmolStr::new_static("retentionDays")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("retentionDays"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("shareActivity"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Who sees your activity feed"),
                                ),
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("shareNewItems"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("aspectRatio"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Image aspect ratio")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("height"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("width"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("collectionItem"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Reference to an item in a collection"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("addedAt"),
                            SmolStr::new_static("order")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("addedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("order"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT-URI reference to item (always shows latest version)",
                                    ),
                                ),
                                max_length: Some(8192usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("collectionView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("View of a collection with items"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("name"), SmolStr::new_static("tags"),
                            SmolStr::new_static("type"),
                            SmolStr::new_static("visibility"),
                            SmolStr::new_static("author"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#profileView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coverImage"),
                            LexObjectProperty::Blob(LexBlob { ..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 {
                                max_length: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("itemCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("items"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#itemView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(20usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("visibility"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("displaySettings"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Display preferences")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("gridLayout"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("theme"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("itemImage"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Image embedded in an item")),
                    required: Some(vec![SmolStr::new_static("blob")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("alt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Alt text for accessibility"),
                                ),
                                max_length: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("aspectRatio"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#aspectRatio"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("blob"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("itemView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("View of an item with metadata"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("title"), SmolStr::new_static("tags"),
                            SmolStr::new_static("images"),
                            SmolStr::new_static("visibility"),
                            SmolStr::new_static("author"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#profileView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("category"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..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 {
                                max_length: Some(3000usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("externalLink"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Uri),
                                max_length: Some(2048usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("images"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#itemImage"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("metadata"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reactionCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString {
                                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("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("visibility"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("notificationSettings"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Notification preferences")),
                    required: Some(
                        vec![
                            SmolStr::new_static("reactions"),
                            SmolStr::new_static("follows"),
                            SmolStr::new_static("comments")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comments"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("follows"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reactions"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("privacySettings"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Privacy preferences")),
                    required: Some(
                        vec![
                            SmolStr::new_static("allowReactions"),
                            SmolStr::new_static("allowComments"),
                            SmolStr::new_static("indexable")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("allowComments"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("allowReactions"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexable"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileView"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("View of a user profile")),
                    required: Some(
                        vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("banner"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(2048usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(253usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionSubject"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Subject of a reaction")),
                    required: Some(
                        vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("View of a reaction to content"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("actor"),
                            SmolStr::new_static("subject"), SmolStr::new_static("type"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("actor"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#profileView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionSubject"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Emoji shortcode")),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("showcaseItem"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A reference to an item featured in a user's showcase (hydrated at read time)",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("addedAt"),
                            SmolStr::new_static("order")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("addedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("order"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "AT-URI reference to the item (e.g., at://did:plc:.../social.showcase.library.item/abc123)",
                                    ),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("visibilitySettings"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Visibility preferences")),
                    required: Some(
                        vec![
                            SmolStr::new_static("profileVisibility"),
                            SmolStr::new_static("defaultItemVisibility"),
                            SmolStr::new_static("defaultCollectionVisibility")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("defaultCollectionVisibility"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("defaultItemVisibility"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("profileVisibility"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod collection_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 AddedAt;
        type Order;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type AddedAt = Unset;
        type Order = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `added_at` field to Set
    pub struct SetAddedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAddedAt<St> {}
    impl<St: State> State for SetAddedAt<St> {
        type AddedAt = Set<members::added_at>;
        type Order = St::Order;
        type Uri = St::Uri;
    }
    ///State transition - sets the `order` field to Set
    pub struct SetOrder<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetOrder<St> {}
    impl<St: State> State for SetOrder<St> {
        type AddedAt = St::AddedAt;
        type Order = Set<members::order>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type AddedAt = St::AddedAt;
        type Order = St::Order;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `added_at` field
        pub struct added_at(());
        ///Marker type for the `order` field
        pub struct order(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct CollectionItemBuilder<
    St: collection_item_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Datetime>, Option<i64>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> CollectionItem<S> {
    /// Create a new builder for this type
    pub fn builder() -> CollectionItemBuilder<collection_item_state::Empty, S> {
        CollectionItemBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> CollectionItemBuilder<St, S>
where
    St: collection_item_state::State,
    St::AddedAt: collection_item_state::IsUnset,
{
    /// Set the `addedAt` field (required)
    pub fn added_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> CollectionItemBuilder<collection_item_state::SetAddedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        CollectionItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CollectionItemBuilder<St, S>
where
    St: collection_item_state::State,
    St::Order: collection_item_state::IsUnset,
{
    /// Set the `order` field (required)
    pub fn order(
        mut self,
        value: impl Into<i64>,
    ) -> CollectionItemBuilder<collection_item_state::SetOrder<St>, S> {
        self._fields.1 = Option::Some(value.into());
        CollectionItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CollectionItemBuilder<St, S>
where
    St: collection_item_state::State,
    St::Uri: collection_item_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<S>,
    ) -> CollectionItemBuilder<collection_item_state::SetUri<St>, S> {
        self._fields.2 = Option::Some(value.into());
        CollectionItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CollectionItemBuilder<St, S>
where
    St: collection_item_state::State,
    St::AddedAt: collection_item_state::IsSet,
    St::Order: collection_item_state::IsSet,
    St::Uri: collection_item_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> CollectionItem<S> {
        CollectionItem {
            added_at: self._fields.0.unwrap(),
            order: self._fields.1.unwrap(),
            uri: self._fields.2.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>>,
    ) -> CollectionItem<S> {
        CollectionItem {
            added_at: self._fields.0.unwrap(),
            order: self._fields.1.unwrap(),
            uri: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod collection_view_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 Author;
        type Cid;
        type CreatedAt;
        type Name;
        type Tags;
        type Type;
        type Uri;
        type Visibility;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type CreatedAt = Unset;
        type Name = Unset;
        type Tags = Unset;
        type Type = Unset;
        type Uri = Unset;
        type Visibility = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Author = St::Author;
        type Cid = Set<members::cid>;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = Set<members::created_at>;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = Set<members::name>;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = St::Uri;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = Set<members::tags>;
        type Type = St::Type;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = Set<members::r#type>;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = Set<members::uri>;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Name = St::Name;
        type Tags = St::Tags;
        type Type = St::Type;
        type Uri = St::Uri;
        type Visibility = Set<members::visibility>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `tags` field
        pub struct tags(());
        ///Marker type for the `type` field
        pub struct r#type(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `visibility` field
        pub struct visibility(());
    }
}

/// Builder for constructing an instance of this type.
pub struct CollectionViewBuilder<
    St: collection_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<social_showcase::ProfileView<S>>,
        Option<Cid<S>>,
        Option<BlobRef<S>>,
        Option<Datetime>,
        Option<S>,
        Option<i64>,
        Option<Vec<social_showcase::ItemView<S>>>,
        Option<S>,
        Option<Vec<S>>,
        Option<S>,
        Option<Datetime>,
        Option<AtUri<S>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> CollectionView<S> {
    /// Create a new builder for this type
    pub fn builder() -> CollectionViewBuilder<collection_view_state::Empty, S> {
        CollectionViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> CollectionViewBuilder<St, S>
where
    St: collection_view_state::State,
    St::Author: collection_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<social_showcase::ProfileView<S>>,
    ) -> CollectionViewBuilder<collection_view_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        CollectionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CollectionViewBuilder<St, S>
where
    St: collection_view_state::State,
    St::Cid: collection_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> CollectionViewBuilder<collection_view_state::SetCid<St>, S> {
        self._fields.1 = Option::Some(value.into());
        CollectionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: collection_view_state::State, S: BosStr> CollectionViewBuilder<St, S> {
    /// Set the `coverImage` field (optional)
    pub fn cover_image(mut self, value: impl Into<Option<BlobRef<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `coverImage` field to an Option value (optional)
    pub fn maybe_cover_image(mut self, value: Option<BlobRef<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

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

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

impl<St: collection_view_state::State, S: BosStr> CollectionViewBuilder<St, S> {
    /// Set the `items` field (optional)
    pub fn items(
        mut self,
        value: impl Into<Option<Vec<social_showcase::ItemView<S>>>>,
    ) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `items` field to an Option value (optional)
    pub fn maybe_items(
        mut self,
        value: Option<Vec<social_showcase::ItemView<S>>>,
    ) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> CollectionViewBuilder<St, S>
where
    St: collection_view_state::State,
    St::Name: collection_view_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> CollectionViewBuilder<collection_view_state::SetName<St>, S> {
        self._fields.7 = Option::Some(value.into());
        CollectionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

impl<St: collection_view_state::State, S: BosStr> CollectionViewBuilder<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> CollectionViewBuilder<St, S>
where
    St: collection_view_state::State,
    St::Uri: collection_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> CollectionViewBuilder<collection_view_state::SetUri<St>, S> {
        self._fields.11 = Option::Some(value.into());
        CollectionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> CollectionViewBuilder<St, S>
where
    St: collection_view_state::State,
    St::Author: collection_view_state::IsSet,
    St::Cid: collection_view_state::IsSet,
    St::CreatedAt: collection_view_state::IsSet,
    St::Name: collection_view_state::IsSet,
    St::Tags: collection_view_state::IsSet,
    St::Type: collection_view_state::IsSet,
    St::Uri: collection_view_state::IsSet,
    St::Visibility: collection_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> CollectionView<S> {
        CollectionView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover_image: self._fields.2,
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            item_count: self._fields.5,
            items: self._fields.6,
            name: self._fields.7.unwrap(),
            tags: self._fields.8.unwrap(),
            r#type: self._fields.9.unwrap(),
            updated_at: self._fields.10,
            uri: self._fields.11.unwrap(),
            visibility: self._fields.12.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>>,
    ) -> CollectionView<S> {
        CollectionView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            cover_image: self._fields.2,
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            item_count: self._fields.5,
            items: self._fields.6,
            name: self._fields.7.unwrap(),
            tags: self._fields.8.unwrap(),
            r#type: self._fields.9.unwrap(),
            updated_at: self._fields.10,
            uri: self._fields.11.unwrap(),
            visibility: self._fields.12.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct ItemImageBuilder<St: item_image_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<social_showcase::AspectRatio<S>>, Option<BlobRef<S>>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ItemImage<S> {
    /// Create a new builder for this type
    pub fn builder() -> ItemImageBuilder<item_image_state::Empty, S> {
        ItemImageBuilder::builder()
    }
}

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

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

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

impl<St: item_image_state::State, S: BosStr> ItemImageBuilder<St, S> {
    /// Set the `aspectRatio` field (optional)
    pub fn aspect_ratio(
        mut self,
        value: impl Into<Option<social_showcase::AspectRatio<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `aspectRatio` field to an Option value (optional)
    pub fn maybe_aspect_ratio(
        mut self,
        value: Option<social_showcase::AspectRatio<S>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> ItemImageBuilder<St, S>
where
    St: item_image_state::State,
    St::Blob: item_image_state::IsUnset,
{
    /// Set the `blob` field (required)
    pub fn blob(
        mut self,
        value: impl Into<BlobRef<S>>,
    ) -> ItemImageBuilder<item_image_state::SetBlob<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ItemImageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ItemImageBuilder<St, S>
where
    St: item_image_state::State,
    St::Blob: item_image_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ItemImage<S> {
        ItemImage {
            alt: self._fields.0,
            aspect_ratio: self._fields.1,
            blob: self._fields.2.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>>,
    ) -> ItemImage<S> {
        ItemImage {
            alt: self._fields.0,
            aspect_ratio: self._fields.1,
            blob: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod item_view_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 Author;
        type Cid;
        type CreatedAt;
        type Images;
        type Tags;
        type Title;
        type Uri;
        type Visibility;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Cid = Unset;
        type CreatedAt = Unset;
        type Images = Unset;
        type Tags = Unset;
        type Title = Unset;
        type Uri = Unset;
        type Visibility = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Author = St::Author;
        type Cid = Set<members::cid>;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = Set<members::created_at>;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = St::Uri;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = Set<members::images>;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = St::Uri;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = Set<members::tags>;
        type Title = St::Title;
        type Uri = St::Uri;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = Set<members::title>;
        type Uri = St::Uri;
        type Visibility = St::Visibility;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = Set<members::uri>;
        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 Author = St::Author;
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type Images = St::Images;
        type Tags = St::Tags;
        type Title = St::Title;
        type Uri = St::Uri;
        type Visibility = Set<members::visibility>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///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 `uri` field
        pub struct uri(());
        ///Marker type for the `visibility` field
        pub struct visibility(());
    }
}

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

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

impl<S: BosStr> ItemView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ItemViewBuilder<item_view_state::Empty, S> {
        ItemViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ItemViewBuilder<St, S>
where
    St: item_view_state::State,
    St::Author: item_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<social_showcase::ProfileView<S>>,
    ) -> ItemViewBuilder<item_view_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ItemViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ItemViewBuilder<St, S>
where
    St: item_view_state::State,
    St::Cid: item_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> ItemViewBuilder<item_view_state::SetCid<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ItemViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

impl<St: item_view_state::State, S: BosStr> ItemViewBuilder<St, S> {
    /// Set the `externalLink` field (optional)
    pub fn external_link(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.5 = 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.5 = value;
        self
    }
}

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

impl<St: item_view_state::State, S: BosStr> ItemViewBuilder<St, S> {
    /// Set the `metadata` field (optional)
    pub fn metadata(mut self, value: impl Into<Option<Data<S>>>) -> Self {
        self._fields.7 = 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.7 = value;
        self
    }
}

impl<St: item_view_state::State, S: BosStr> ItemViewBuilder<St, S> {
    /// Set the `reactionCount` field (optional)
    pub fn reaction_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `reactionCount` field to an Option value (optional)
    pub fn maybe_reaction_count(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

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

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

impl<St: item_view_state::State, S: BosStr> ItemViewBuilder<St, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.11 = 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.11 = value;
        self
    }
}

impl<St, S: BosStr> ItemViewBuilder<St, S>
where
    St: item_view_state::State,
    St::Uri: item_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> ItemViewBuilder<item_view_state::SetUri<St>, S> {
        self._fields.12 = Option::Some(value.into());
        ItemViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ItemViewBuilder<St, S>
where
    St: item_view_state::State,
    St::Author: item_view_state::IsSet,
    St::Cid: item_view_state::IsSet,
    St::CreatedAt: item_view_state::IsSet,
    St::Images: item_view_state::IsSet,
    St::Tags: item_view_state::IsSet,
    St::Title: item_view_state::IsSet,
    St::Uri: item_view_state::IsSet,
    St::Visibility: item_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ItemView<S> {
        ItemView {
            author: self._fields.0.unwrap(),
            category: self._fields.1,
            cid: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            external_link: self._fields.5,
            images: self._fields.6.unwrap(),
            metadata: self._fields.7,
            reaction_count: self._fields.8,
            tags: self._fields.9.unwrap(),
            title: self._fields.10.unwrap(),
            updated_at: self._fields.11,
            uri: self._fields.12.unwrap(),
            visibility: self._fields.13.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>>) -> ItemView<S> {
        ItemView {
            author: self._fields.0.unwrap(),
            category: self._fields.1,
            cid: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            description: self._fields.4,
            external_link: self._fields.5,
            images: self._fields.6.unwrap(),
            metadata: self._fields.7,
            reaction_count: self._fields.8,
            tags: self._fields.9.unwrap(),
            title: self._fields.10.unwrap(),
            updated_at: self._fields.11,
            uri: self._fields.12.unwrap(),
            visibility: self._fields.13.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod notification_settings_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 Comments;
        type Follows;
        type Reactions;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Comments = Unset;
        type Follows = Unset;
        type Reactions = Unset;
    }
    ///State transition - sets the `comments` field to Set
    pub struct SetComments<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetComments<St> {}
    impl<St: State> State for SetComments<St> {
        type Comments = Set<members::comments>;
        type Follows = St::Follows;
        type Reactions = St::Reactions;
    }
    ///State transition - sets the `follows` field to Set
    pub struct SetFollows<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetFollows<St> {}
    impl<St: State> State for SetFollows<St> {
        type Comments = St::Comments;
        type Follows = Set<members::follows>;
        type Reactions = St::Reactions;
    }
    ///State transition - sets the `reactions` field to Set
    pub struct SetReactions<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReactions<St> {}
    impl<St: State> State for SetReactions<St> {
        type Comments = St::Comments;
        type Follows = St::Follows;
        type Reactions = Set<members::reactions>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `comments` field
        pub struct comments(());
        ///Marker type for the `follows` field
        pub struct follows(());
        ///Marker type for the `reactions` field
        pub struct reactions(());
    }
}

/// Builder for constructing an instance of this type.
pub struct NotificationSettingsBuilder<
    St: notification_settings_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<bool>, Option<bool>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> NotificationSettings<S> {
    /// Create a new builder for this type
    pub fn builder() -> NotificationSettingsBuilder<
        notification_settings_state::Empty,
        S,
    > {
        NotificationSettingsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> NotificationSettingsBuilder<St, S>
where
    St: notification_settings_state::State,
    St::Comments: notification_settings_state::IsUnset,
{
    /// Set the `comments` field (required)
    pub fn comments(
        mut self,
        value: impl Into<bool>,
    ) -> NotificationSettingsBuilder<notification_settings_state::SetComments<St>, S> {
        self._fields.0 = Option::Some(value.into());
        NotificationSettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> NotificationSettingsBuilder<St, S>
where
    St: notification_settings_state::State,
    St::Follows: notification_settings_state::IsUnset,
{
    /// Set the `follows` field (required)
    pub fn follows(
        mut self,
        value: impl Into<bool>,
    ) -> NotificationSettingsBuilder<notification_settings_state::SetFollows<St>, S> {
        self._fields.1 = Option::Some(value.into());
        NotificationSettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> NotificationSettingsBuilder<St, S>
where
    St: notification_settings_state::State,
    St::Reactions: notification_settings_state::IsUnset,
{
    /// Set the `reactions` field (required)
    pub fn reactions(
        mut self,
        value: impl Into<bool>,
    ) -> NotificationSettingsBuilder<notification_settings_state::SetReactions<St>, S> {
        self._fields.2 = Option::Some(value.into());
        NotificationSettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> NotificationSettingsBuilder<St, S>
where
    St: notification_settings_state::State,
    St::Comments: notification_settings_state::IsSet,
    St::Follows: notification_settings_state::IsSet,
    St::Reactions: notification_settings_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> NotificationSettings<S> {
        NotificationSettings {
            comments: self._fields.0.unwrap(),
            follows: self._fields.1.unwrap(),
            reactions: self._fields.2.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>>,
    ) -> NotificationSettings<S> {
        NotificationSettings {
            comments: self._fields.0.unwrap(),
            follows: self._fields.1.unwrap(),
            reactions: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod privacy_settings_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 AllowComments;
        type AllowReactions;
        type Indexable;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type AllowComments = Unset;
        type AllowReactions = Unset;
        type Indexable = Unset;
    }
    ///State transition - sets the `allow_comments` field to Set
    pub struct SetAllowComments<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAllowComments<St> {}
    impl<St: State> State for SetAllowComments<St> {
        type AllowComments = Set<members::allow_comments>;
        type AllowReactions = St::AllowReactions;
        type Indexable = St::Indexable;
    }
    ///State transition - sets the `allow_reactions` field to Set
    pub struct SetAllowReactions<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAllowReactions<St> {}
    impl<St: State> State for SetAllowReactions<St> {
        type AllowComments = St::AllowComments;
        type AllowReactions = Set<members::allow_reactions>;
        type Indexable = St::Indexable;
    }
    ///State transition - sets the `indexable` field to Set
    pub struct SetIndexable<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexable<St> {}
    impl<St: State> State for SetIndexable<St> {
        type AllowComments = St::AllowComments;
        type AllowReactions = St::AllowReactions;
        type Indexable = Set<members::indexable>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `allow_comments` field
        pub struct allow_comments(());
        ///Marker type for the `allow_reactions` field
        pub struct allow_reactions(());
        ///Marker type for the `indexable` field
        pub struct indexable(());
    }
}

/// Builder for constructing an instance of this type.
pub struct PrivacySettingsBuilder<
    St: privacy_settings_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<bool>, Option<bool>, Option<bool>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> PrivacySettings<S> {
    /// Create a new builder for this type
    pub fn builder() -> PrivacySettingsBuilder<privacy_settings_state::Empty, S> {
        PrivacySettingsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> PrivacySettingsBuilder<St, S>
where
    St: privacy_settings_state::State,
    St::AllowComments: privacy_settings_state::IsUnset,
{
    /// Set the `allowComments` field (required)
    pub fn allow_comments(
        mut self,
        value: impl Into<bool>,
    ) -> PrivacySettingsBuilder<privacy_settings_state::SetAllowComments<St>, S> {
        self._fields.0 = Option::Some(value.into());
        PrivacySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PrivacySettingsBuilder<St, S>
where
    St: privacy_settings_state::State,
    St::AllowReactions: privacy_settings_state::IsUnset,
{
    /// Set the `allowReactions` field (required)
    pub fn allow_reactions(
        mut self,
        value: impl Into<bool>,
    ) -> PrivacySettingsBuilder<privacy_settings_state::SetAllowReactions<St>, S> {
        self._fields.1 = Option::Some(value.into());
        PrivacySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PrivacySettingsBuilder<St, S>
where
    St: privacy_settings_state::State,
    St::Indexable: privacy_settings_state::IsUnset,
{
    /// Set the `indexable` field (required)
    pub fn indexable(
        mut self,
        value: impl Into<bool>,
    ) -> PrivacySettingsBuilder<privacy_settings_state::SetIndexable<St>, S> {
        self._fields.2 = Option::Some(value.into());
        PrivacySettingsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> PrivacySettingsBuilder<St, S>
where
    St: privacy_settings_state::State,
    St::AllowComments: privacy_settings_state::IsSet,
    St::AllowReactions: privacy_settings_state::IsSet,
    St::Indexable: privacy_settings_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> PrivacySettings<S> {
        PrivacySettings {
            allow_comments: self._fields.0.unwrap(),
            allow_reactions: self._fields.1.unwrap(),
            indexable: self._fields.2.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>>,
    ) -> PrivacySettings<S> {
        PrivacySettings {
            allow_comments: self._fields.0.unwrap(),
            allow_reactions: self._fields.1.unwrap(),
            indexable: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct ReactionSubjectBuilder<
    St: reaction_subject_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Cid<S>>, Option<AtUri<S>>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ReactionSubject<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReactionSubjectBuilder<reaction_subject_state::Empty, S> {
        ReactionSubjectBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReactionSubjectBuilder<St, S>
where
    St: reaction_subject_state::State,
    St::Cid: reaction_subject_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> ReactionSubjectBuilder<reaction_subject_state::SetCid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReactionSubjectBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReactionSubjectBuilder<St, S>
where
    St: reaction_subject_state::State,
    St::Uri: reaction_subject_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> ReactionSubjectBuilder<reaction_subject_state::SetUri<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ReactionSubjectBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReactionSubjectBuilder<St, S>
where
    St: reaction_subject_state::State,
    St::Cid: reaction_subject_state::IsSet,
    St::Uri: reaction_subject_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReactionSubject<S> {
        ReactionSubject {
            cid: self._fields.0.unwrap(),
            uri: self._fields.1.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>>,
    ) -> ReactionSubject<S> {
        ReactionSubject {
            cid: self._fields.0.unwrap(),
            uri: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reaction_view_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 Actor;
        type CreatedAt;
        type Subject;
        type Type;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Actor = Unset;
        type CreatedAt = Unset;
        type Subject = Unset;
        type Type = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `actor` field to Set
    pub struct SetActor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetActor<St> {}
    impl<St: State> State for SetActor<St> {
        type Actor = Set<members::actor>;
        type CreatedAt = St::CreatedAt;
        type Subject = St::Subject;
        type Type = St::Type;
        type Uri = St::Uri;
    }
    ///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 Actor = St::Actor;
        type CreatedAt = Set<members::created_at>;
        type Subject = St::Subject;
        type Type = St::Type;
        type Uri = St::Uri;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubject<St> {}
    impl<St: State> State for SetSubject<St> {
        type Actor = St::Actor;
        type CreatedAt = St::CreatedAt;
        type Subject = Set<members::subject>;
        type Type = St::Type;
        type Uri = St::Uri;
    }
    ///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 Actor = St::Actor;
        type CreatedAt = St::CreatedAt;
        type Subject = St::Subject;
        type Type = Set<members::r#type>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Actor = St::Actor;
        type CreatedAt = St::CreatedAt;
        type Subject = St::Subject;
        type Type = St::Type;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `actor` field
        pub struct actor(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `type` field
        pub struct r#type(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ReactionViewBuilder<St: reaction_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<social_showcase::ProfileView<S>>,
        Option<Datetime>,
        Option<social_showcase::ReactionSubject<S>>,
        Option<S>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ReactionView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReactionViewBuilder<reaction_view_state::Empty, S> {
        ReactionViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReactionViewBuilder<St, S>
where
    St: reaction_view_state::State,
    St::Actor: reaction_view_state::IsUnset,
{
    /// Set the `actor` field (required)
    pub fn actor(
        mut self,
        value: impl Into<social_showcase::ProfileView<S>>,
    ) -> ReactionViewBuilder<reaction_view_state::SetActor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ReactionViewBuilder<St, S>
where
    St: reaction_view_state::State,
    St::Subject: reaction_view_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<social_showcase::ReactionSubject<S>>,
    ) -> ReactionViewBuilder<reaction_view_state::SetSubject<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ReactionViewBuilder<St, S>
where
    St: reaction_view_state::State,
    St::Uri: reaction_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> ReactionViewBuilder<reaction_view_state::SetUri<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReactionViewBuilder<St, S>
where
    St: reaction_view_state::State,
    St::Actor: reaction_view_state::IsSet,
    St::CreatedAt: reaction_view_state::IsSet,
    St::Subject: reaction_view_state::IsSet,
    St::Type: reaction_view_state::IsSet,
    St::Uri: reaction_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReactionView<S> {
        ReactionView {
            actor: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            subject: self._fields.2.unwrap(),
            r#type: self._fields.3.unwrap(),
            uri: self._fields.4.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>>,
    ) -> ReactionView<S> {
        ReactionView {
            actor: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            subject: self._fields.2.unwrap(),
            r#type: self._fields.3.unwrap(),
            uri: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod showcase_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 AddedAt;
        type Order;
        type Uri;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type AddedAt = Unset;
        type Order = Unset;
        type Uri = Unset;
    }
    ///State transition - sets the `added_at` field to Set
    pub struct SetAddedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAddedAt<St> {}
    impl<St: State> State for SetAddedAt<St> {
        type AddedAt = Set<members::added_at>;
        type Order = St::Order;
        type Uri = St::Uri;
    }
    ///State transition - sets the `order` field to Set
    pub struct SetOrder<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetOrder<St> {}
    impl<St: State> State for SetOrder<St> {
        type AddedAt = St::AddedAt;
        type Order = Set<members::order>;
        type Uri = St::Uri;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type AddedAt = St::AddedAt;
        type Order = St::Order;
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `added_at` field
        pub struct added_at(());
        ///Marker type for the `order` field
        pub struct order(());
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ShowcaseItemBuilder<St: showcase_item_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Datetime>, Option<i64>, Option<AtUri<S>>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ShowcaseItem<S> {
    /// Create a new builder for this type
    pub fn builder() -> ShowcaseItemBuilder<showcase_item_state::Empty, S> {
        ShowcaseItemBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ShowcaseItemBuilder<St, S>
where
    St: showcase_item_state::State,
    St::AddedAt: showcase_item_state::IsUnset,
{
    /// Set the `addedAt` field (required)
    pub fn added_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ShowcaseItemBuilder<showcase_item_state::SetAddedAt<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ShowcaseItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ShowcaseItemBuilder<St, S>
where
    St: showcase_item_state::State,
    St::Order: showcase_item_state::IsUnset,
{
    /// Set the `order` field (required)
    pub fn order(
        mut self,
        value: impl Into<i64>,
    ) -> ShowcaseItemBuilder<showcase_item_state::SetOrder<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ShowcaseItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ShowcaseItemBuilder<St, S>
where
    St: showcase_item_state::State,
    St::Uri: showcase_item_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<S>>,
    ) -> ShowcaseItemBuilder<showcase_item_state::SetUri<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ShowcaseItemBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ShowcaseItemBuilder<St, S>
where
    St: showcase_item_state::State,
    St::AddedAt: showcase_item_state::IsSet,
    St::Order: showcase_item_state::IsSet,
    St::Uri: showcase_item_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ShowcaseItem<S> {
        ShowcaseItem {
            added_at: self._fields.0.unwrap(),
            order: self._fields.1.unwrap(),
            uri: self._fields.2.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>>,
    ) -> ShowcaseItem<S> {
        ShowcaseItem {
            added_at: self._fields.0.unwrap(),
            order: self._fields.1.unwrap(),
            uri: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}