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

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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::blob::BlobRef;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::types::value::Data;
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon, open_union};
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::me_linkna::linkinbio;
/// Saved service credentials/identifiers for pre-filling widget forms.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConnectedServices<S: BosStr = DefaultStr> {
    ///GitHub username.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub github_username: Option<S>,
    ///Goodreads numeric user ID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub goodreads_user_id: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A single day's contribution data from GitHub.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GithubContributionDay<S: BosStr = DefaultStr> {
    ///Number of contributions on this day.
    pub count: i64,
    ///Date in YYYY-MM-DD format.
    pub date: S,
    ///Contribution intensity level (0=none, 4=highest).
    pub level: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A book from a Goodreads shelf.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GoodreadsBook<S: BosStr = DefaultStr> {
    ///Book author.
    pub author: S,
    ///URL to the book cover image.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover_url: Option<S>,
    ///URL to the book on Goodreads.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub link: Option<S>,
    ///User's rating (1-5), or absent if unrated.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rating: Option<i64>,
    ///Book title.
    pub title: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A standard link card.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LinkCard<S: BosStr = DefaultStr> {
    ///Whether the card is visible on the public page. Defaults to true.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    ///Whether the card is visually highlighted.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub highlighted: Option<bool>,
    ///Unique identifier for the card.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<S>,
    ///Display text for the card (falls back to URL domain if empty).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub text: Option<S>,
    ///Card type discriminator. Value: 'link' or absent for link cards.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#type: Option<S>,
    ///URL the card links to.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub url: Option<UriValue<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A user's link-in-bio page containing cards, theme configuration, and social icons.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
    rename_all = "camelCase",
    rename = "me.linkna.linkinbio",
    tag = "$type",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Linkinbio<S: BosStr = DefaultStr> {
    ///Ordered list of cards on the page. Each card is a union of linkCard, widgetGoodreads, widgetGithub, or widgetTealfm.
    pub cards: Vec<LinkinbioCardsItem<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub connected_services: Option<linkinbio::ConnectedServices<S>>,
    ///Social media icons displayed on the profile.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub social_icons: Option<Vec<linkinbio::SocialIcon<S>>>,
    ///Deprecated: use themeConfig instead.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub theme: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub theme_config: Option<linkinbio::ThemeConfig<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum LinkinbioCardsItem<S: BosStr = DefaultStr> {
    #[serde(rename = "me.linkna.linkinbio#linkCard")]
    LinkCard(Box<linkinbio::LinkCard<S>>),
    #[serde(rename = "me.linkna.linkinbio#widgetGoodreads")]
    WidgetGoodreads(Box<linkinbio::WidgetGoodreads<S>>),
    #[serde(rename = "me.linkna.linkinbio#widgetGithub")]
    WidgetGithub(Box<linkinbio::WidgetGithub<S>>),
    #[serde(rename = "me.linkna.linkinbio#widgetTealfm")]
    WidgetTealfm(Box<linkinbio::WidgetTealfm<S>>),
}

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

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LinkinbioGetRecordOutput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    pub uri: AtUri<S>,
    pub value: Linkinbio<S>,
}

/// A social media icon link.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SocialIcon<S: BosStr = DefaultStr> {
    ///Unique identifier for the icon.
    pub id: S,
    ///Platform identifier (e.g., 'bluesky', 'twitter', 'instagram').
    pub platform: S,
    ///URL to the user's profile on this platform.
    pub url: UriValue<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A recently played track from teal.fm.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct TealfmPlay<S: BosStr = DefaultStr> {
    ///Artist name(s).
    pub artist_name: S,
    ///URL to the album cover image (from Cover Art Archive).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover_url: Option<S>,
    ///URL to the track on the original music service.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub origin_url: Option<S>,
    ///When the track was played.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub played_time: Option<Datetime>,
    ///Album/release name.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub release_name: Option<S>,
    ///Track/song name.
    pub track_name: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Theme configuration for the page appearance.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ThemeConfig<S: BosStr = DefaultStr> {
    ///Page background color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub background_color: Option<S>,
    ///CSS gradient for the page background.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub background_gradient: Option<S>,
    ///Background wallpaper image blob.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub background_image: Option<BlobRef<S>>,
    ///Optional credit URL for the wallpaper image artist. Stored for attribution purposes only, not displayed on the public page.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub background_image_credit: Option<UriValue<S>>,
    ///Button content alignment. Default: left.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub button_alignment: Option<ThemeConfigButtonAlignment<S>>,
    ///Whether buttons glow on hover. Default: false.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub button_hover_glow: Option<bool>,
    ///Color for the button hover glow effect.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub button_hover_glow_color: Option<S>,
    ///Individual card/button background color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_background_color: Option<S>,
    ///Card/button border color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_border_color: Option<S>,
    ///Card/button border radius.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_border_radius: Option<ThemeConfigCardBorderRadius<S>>,
    ///Card/button border color on hover.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_hover_color: Option<S>,
    ///Card/button shadow intensity.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_shadow: Option<ThemeConfigCardShadow<S>>,
    ///Card/button text color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub card_text_color: Option<S>,
    ///Card container background color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub content_card_color: Option<S>,
    ///Whether cursor has sparkle trail. Default: false.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor_sparkles: Option<bool>,
    ///Custom cursor style. Default: default.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor_style: Option<ThemeConfigCursorStyle<S>>,
    ///Font family for the page.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub font_family: Option<S>,
    ///Font size. Default: md.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub font_size: Option<ThemeConfigFontSize<S>>,
    ///Background particle effect. Default: none.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub particles: Option<ThemeConfigParticles<S>>,
    ///Theme preset ID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub preset: Option<S>,
    ///Profile section alignment. Default: center.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile_alignment: Option<ThemeConfigProfileAlignment<S>>,
    ///Profile picture shape. Default: circle.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile_picture_shape: Option<ThemeConfigProfilePictureShape<S>>,
    ///Profile picture size. Default: sm.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile_picture_size: Option<ThemeConfigProfilePictureSize<S>>,
    ///Profile section text color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile_text_color: Option<S>,
    ///Whether Linkname branding is visible. Default: true.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub show_branding: Option<bool>,
    ///Border color for social icons dock/sphere.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub social_icons_border_color: Option<S>,
    ///Social icons color.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub social_icons_color: Option<S>,
    ///Social icons container shape. Default: dock.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub social_icons_shape: Option<ThemeConfigSocialIconsShape<S>>,
    ///Background color for social icons dock/sphere.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub social_icons_shape_color: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Button content alignment. Default: left.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigButtonAlignment<S: BosStr = DefaultStr> {
    Left,
    Right,
    Other(S),
}

impl<S: BosStr> ThemeConfigButtonAlignment<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Left => "left",
            Self::Right => "right",
            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() {
            "left" => Self::Left,
            "right" => Self::Right,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Card/button border radius.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigCardBorderRadius<S: BosStr = DefaultStr> {
    None,
    Sm,
    Md,
    Lg,
    Full,
    Other(S),
}

impl<S: BosStr> ThemeConfigCardBorderRadius<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::None => "none",
            Self::Sm => "sm",
            Self::Md => "md",
            Self::Lg => "lg",
            Self::Full => "full",
            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() {
            "none" => Self::None,
            "sm" => Self::Sm,
            "md" => Self::Md,
            "lg" => Self::Lg,
            "full" => Self::Full,
            _ => Self::Other(s),
        }
    }
}

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

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

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

impl<S: BosStr> jacquard_common::IntoStatic for ThemeConfigCardBorderRadius<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ThemeConfigCardBorderRadius<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ThemeConfigCardBorderRadius::None => ThemeConfigCardBorderRadius::None,
            ThemeConfigCardBorderRadius::Sm => ThemeConfigCardBorderRadius::Sm,
            ThemeConfigCardBorderRadius::Md => ThemeConfigCardBorderRadius::Md,
            ThemeConfigCardBorderRadius::Lg => ThemeConfigCardBorderRadius::Lg,
            ThemeConfigCardBorderRadius::Full => ThemeConfigCardBorderRadius::Full,
            ThemeConfigCardBorderRadius::Other(v) => {
                ThemeConfigCardBorderRadius::Other(v.into_static())
            }
        }
    }
}

/// Card/button shadow intensity.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigCardShadow<S: BosStr = DefaultStr> {
    None,
    Sm,
    Md,
    Lg,
    Xl,
    Other(S),
}

impl<S: BosStr> ThemeConfigCardShadow<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::None => "none",
            Self::Sm => "sm",
            Self::Md => "md",
            Self::Lg => "lg",
            Self::Xl => "xl",
            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() {
            "none" => Self::None,
            "sm" => Self::Sm,
            "md" => Self::Md,
            "lg" => Self::Lg,
            "xl" => Self::Xl,
            _ => Self::Other(s),
        }
    }
}

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

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

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

impl<S: BosStr> jacquard_common::IntoStatic for ThemeConfigCardShadow<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ThemeConfigCardShadow<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ThemeConfigCardShadow::None => ThemeConfigCardShadow::None,
            ThemeConfigCardShadow::Sm => ThemeConfigCardShadow::Sm,
            ThemeConfigCardShadow::Md => ThemeConfigCardShadow::Md,
            ThemeConfigCardShadow::Lg => ThemeConfigCardShadow::Lg,
            ThemeConfigCardShadow::Xl => ThemeConfigCardShadow::Xl,
            ThemeConfigCardShadow::Other(v) => {
                ThemeConfigCardShadow::Other(v.into_static())
            }
        }
    }
}

/// Custom cursor style. Default: default.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigCursorStyle<S: BosStr = DefaultStr> {
    Default,
    HelloKitty,
    Other(S),
}

impl<S: BosStr> ThemeConfigCursorStyle<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Default => "default",
            Self::HelloKitty => "hello-kitty",
            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() {
            "default" => Self::Default,
            "hello-kitty" => Self::HelloKitty,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Font size. Default: md.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigFontSize<S: BosStr = DefaultStr> {
    Sm,
    Md,
    Lg,
    Other(S),
}

impl<S: BosStr> ThemeConfigFontSize<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Sm => "sm",
            Self::Md => "md",
            Self::Lg => "lg",
            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() {
            "sm" => Self::Sm,
            "md" => Self::Md,
            "lg" => Self::Lg,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Background particle effect. Default: none.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigParticles<S: BosStr = DefaultStr> {
    None,
    White,
    Blue,
    Leaves,
    Other(S),
}

impl<S: BosStr> ThemeConfigParticles<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::None => "none",
            Self::White => "white",
            Self::Blue => "blue",
            Self::Leaves => "leaves",
            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() {
            "none" => Self::None,
            "white" => Self::White,
            "blue" => Self::Blue,
            "leaves" => Self::Leaves,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Profile section alignment. Default: center.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigProfileAlignment<S: BosStr = DefaultStr> {
    Left,
    Center,
    Right,
    Other(S),
}

impl<S: BosStr> ThemeConfigProfileAlignment<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Left => "left",
            Self::Center => "center",
            Self::Right => "right",
            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() {
            "left" => Self::Left,
            "center" => Self::Center,
            "right" => Self::Right,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Profile picture shape. Default: circle.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigProfilePictureShape<S: BosStr = DefaultStr> {
    Circle,
    Rounded,
    Square,
    Other(S),
}

impl<S: BosStr> ThemeConfigProfilePictureShape<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Circle => "circle",
            Self::Rounded => "rounded",
            Self::Square => "square",
            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() {
            "circle" => Self::Circle,
            "rounded" => Self::Rounded,
            "square" => Self::Square,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Profile picture size. Default: sm.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigProfilePictureSize<S: BosStr = DefaultStr> {
    Sm,
    Md,
    Lg,
    Other(S),
}

impl<S: BosStr> ThemeConfigProfilePictureSize<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Sm => "sm",
            Self::Md => "md",
            Self::Lg => "lg",
            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() {
            "sm" => Self::Sm,
            "md" => Self::Md,
            "lg" => Self::Lg,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// Social icons container shape. Default: dock.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ThemeConfigSocialIconsShape<S: BosStr = DefaultStr> {
    Dock,
    Sphere,
    Other(S),
}

impl<S: BosStr> ThemeConfigSocialIconsShape<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Dock => "dock",
            Self::Sphere => "sphere",
            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() {
            "dock" => Self::Dock,
            "sphere" => Self::Sphere,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// A GitHub contributions graph widget card.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct WidgetGithub<S: BosStr = DefaultStr> {
    ///Contribution data for the last year.
    pub contributions: Vec<linkinbio::GithubContributionDay<S>>,
    ///Whether the widget is visible on the public page. Defaults to true.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    ///GitHub username.
    pub github_username: S,
    ///Unique identifier for the card.
    pub id: S,
    ///When the contribution data was last fetched from GitHub.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_synced_at: Option<Datetime>,
    ///Widget display size. Default: 1x1.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub size: Option<WidgetGithubSize<S>>,
    ///Total number of contributions in the last year.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_contributions: Option<i64>,
    ///Card type discriminator.
    pub r#type: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Widget display size. Default: 1x1.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WidgetGithubSize<S: BosStr = DefaultStr> {
    _1x1,
    _1x2,
    _2x2,
    Other(S),
}

impl<S: BosStr> WidgetGithubSize<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::_1x1 => "1x1",
            Self::_1x2 => "1x2",
            Self::_2x2 => "2x2",
            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() {
            "1x1" => Self::_1x1,
            "1x2" => Self::_1x2,
            "2x2" => Self::_2x2,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// A Goodreads bookshelf widget card.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct WidgetGoodreads<S: BosStr = DefaultStr> {
    ///Books on the currently-reading shelf.
    pub books: Vec<linkinbio::GoodreadsBook<S>>,
    ///Whether the widget is visible on the public page. Defaults to true.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    ///Goodreads numeric user ID.
    pub goodreads_user_id: S,
    ///Unique identifier for the card.
    pub id: S,
    ///When the book data was last fetched from Goodreads.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_synced_at: Option<Datetime>,
    ///Books on the read shelf (used by 1x2 size).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub read_books: Option<Vec<linkinbio::GoodreadsBook<S>>>,
    ///Shelf name (currently-reading, read, or to-read).
    pub shelf: S,
    ///Widget display size. Default: 1x1.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub size: Option<WidgetGoodreadsSize<S>>,
    ///Card type discriminator.
    pub r#type: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Widget display size. Default: 1x1.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WidgetGoodreadsSize<S: BosStr = DefaultStr> {
    _1x1,
    _1x2,
    _2x2,
    Other(S),
}

impl<S: BosStr> WidgetGoodreadsSize<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::_1x1 => "1x1",
            Self::_1x2 => "1x2",
            Self::_2x2 => "2x2",
            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() {
            "1x1" => Self::_1x1,
            "1x2" => Self::_1x2,
            "2x2" => Self::_2x2,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

/// A teal.fm recently played tracks widget card.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct WidgetTealfm<S: BosStr = DefaultStr> {
    ///Copyright notice for cover art images.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cover_art_notice: Option<S>,
    ///Whether the widget is visible on the public page. Defaults to true.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    ///Unique identifier for the card.
    pub id: S,
    ///When the play data was last fetched from the PDS.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_synced_at: Option<Datetime>,
    ///Recently played tracks.
    pub plays: Vec<linkinbio::TealfmPlay<S>>,
    ///Widget display size. Default: 1x1.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub size: Option<WidgetTealfmSize<S>>,
    ///Card type discriminator.
    pub r#type: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Widget display size. Default: 1x1.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum WidgetTealfmSize<S: BosStr = DefaultStr> {
    _1x1,
    _1x2,
    _2x2,
    Other(S),
}

impl<S: BosStr> WidgetTealfmSize<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::_1x1 => "1x1",
            Self::_1x2 => "1x2",
            Self::_2x2 => "2x2",
            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() {
            "1x1" => Self::_1x1,
            "1x2" => Self::_1x2,
            "2x2" => Self::_2x2,
            _ => Self::Other(s),
        }
    }
}

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

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

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

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

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

impl<S: BosStr> LexiconSchema for ConnectedServices<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "connectedServices"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for GithubContributionDay<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "githubContributionDay"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.level;
            if *value > 4i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("level"),
                    max: 4i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.level;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("level"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for GoodreadsBook<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "goodreadsBook"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.rating {
            if *value > 5i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("rating"),
                    max: 5i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.rating {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("rating"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for LinkCard<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "linkCard"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.text {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

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

#[derive(Debug, Serialize, Deserialize)]
pub struct LinkinbioRecord;
impl XrpcResp for LinkinbioRecord {
    const NSID: &'static str = "me.linkna.linkinbio";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = LinkinbioGetRecordOutput<S>;
    type Err = RecordError;
}

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

impl<S: BosStr> Collection for Linkinbio<S> {
    const NSID: &'static str = "me.linkna.linkinbio";
    type Record = LinkinbioRecord;
}

impl Collection for LinkinbioRecord {
    const NSID: &'static str = "me.linkna.linkinbio";
    type Record = LinkinbioRecord;
}

impl<S: BosStr> LexiconSchema for Linkinbio<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SocialIcon<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "socialIcon"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for TealfmPlay<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "tealfmPlay"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ThemeConfig<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "themeConfig"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.background_image {
            {
                let size = value.blob().size;
                if size > 10000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("background_image"),
                        max: 10000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.background_image {
            {
                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("background_image"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string(),
                            "image/webp".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for WidgetGithub<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "widgetGithub"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for WidgetGoodreads<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "widgetGoodreads"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for WidgetTealfm<S> {
    fn nsid() -> &'static str {
        "me.linkna.linkinbio"
    }
    fn def_name() -> &'static str {
        "widgetTealfm"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_me_linkna_linkinbio()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_me_linkna_linkinbio() -> 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("me.linkna.linkinbio"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("connectedServices"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Saved service credentials/identifiers for pre-filling widget forms.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("githubUsername"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("GitHub username.")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("goodreadsUserId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Goodreads numeric user ID."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("githubContributionDay"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A single day's contribution data from GitHub.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("date"), SmolStr::new_static("count"),
                            SmolStr::new_static("level")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("count"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("date"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Date in YYYY-MM-DD format."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("level"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(4i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("goodreadsBook"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A book from a Goodreads shelf."),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("title"), SmolStr::new_static("author")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Book author.")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coverUrl"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("URL to the book cover image."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("link"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("URL to the book on Goodreads."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rating"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(5i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Book title.")),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("linkCard"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("A standard link card.")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("enabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("highlighted"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for the card."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Display text for the card (falls back to URL domain if empty).",
                                    ),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Card type discriminator. Value: 'link' or absent for link cards.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("url"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("URL the card links to."),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(
                        CowStr::new_static(
                            "A user's link-in-bio page containing cards, theme configuration, and social icons.",
                        ),
                    ),
                    key: Some(CowStr::new_static("literal:self")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(vec![SmolStr::new_static("cards")]),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("cards"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Ordered list of cards on the page. Each card is a union of linkCard, widgetGoodreads, widgetGithub, or widgetTealfm.",
                                        ),
                                    ),
                                    items: LexArrayItem::Union(LexRefUnion {
                                        refs: vec![
                                            CowStr::new_static("#linkCard"),
                                            CowStr::new_static("#widgetGoodreads"),
                                            CowStr::new_static("#widgetGithub"),
                                            CowStr::new_static("#widgetTealfm")
                                        ],
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("connectedServices"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#connectedServices"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("socialIcons"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static(
                                            "Social media icons displayed on the profile.",
                                        ),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static("#socialIcon"),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("theme"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Deprecated: use themeConfig instead."),
                                    ),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("themeConfig"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#themeConfig"),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("socialIcon"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("A social media icon link.")),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("platform"),
                            SmolStr::new_static("url")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for the icon."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("platform"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Platform identifier (e.g., 'bluesky', 'twitter', 'instagram').",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("url"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "URL to the user's profile on this platform.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("tealfmPlay"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A recently played track from teal.fm."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("trackName"),
                            SmolStr::new_static("artistName")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("artistName"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Artist name(s).")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coverUrl"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "URL to the album cover image (from Cover Art Archive).",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("originUrl"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "URL to the track on the original music service.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("playedTime"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("When the track was played."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("releaseName"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Album/release name."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("trackName"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Track/song name.")),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("themeConfig"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Theme configuration for the page appearance.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("backgroundColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Page background color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("backgroundGradient"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CSS gradient for the page background."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("backgroundImage"),
                            LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("backgroundImageCredit"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Optional credit URL for the wallpaper image artist. Stored for attribution purposes only, not displayed on the public page.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("buttonAlignment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Button content alignment. Default: left.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("buttonHoverGlow"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("buttonHoverGlowColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Color for the button hover glow effect.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardBackgroundColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Individual card/button background color.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardBorderColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card/button border color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardBorderRadius"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card/button border radius."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardHoverColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card/button border color on hover."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardShadow"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card/button shadow intensity."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cardTextColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card/button text color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("contentCardColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card container background color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cursorSparkles"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cursorStyle"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Custom cursor style. Default: default."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("fontFamily"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Font family for the page."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("fontSize"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Font size. Default: md."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("particles"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Background particle effect. Default: none.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("preset"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Theme preset ID.")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("profileAlignment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Profile section alignment. Default: center.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("profilePictureShape"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Profile picture shape. Default: circle.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("profilePictureSize"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Profile picture size. Default: sm."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("profileTextColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Profile section text color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("showBranding"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("socialIconsBorderColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Border color for social icons dock/sphere.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("socialIconsColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Social icons color."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("socialIconsShape"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Social icons container shape. Default: dock.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("socialIconsShapeColor"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Background color for social icons dock/sphere.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("widgetGithub"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A GitHub contributions graph widget card."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("githubUsername"),
                            SmolStr::new_static("contributions")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("contributions"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Contribution data for the last year."),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#githubContributionDay"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("enabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("githubUsername"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("GitHub username.")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for the card."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastSyncedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the contribution data was last fetched from GitHub.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Widget display size. Default: 1x1."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("totalContributions"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card type discriminator."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("widgetGoodreads"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A Goodreads bookshelf widget card."),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("goodreadsUserId"),
                            SmolStr::new_static("shelf"), SmolStr::new_static("books")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("books"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Books on the currently-reading shelf."),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#goodreadsBook"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("enabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("goodreadsUserId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Goodreads numeric user ID."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for the card."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastSyncedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the book data was last fetched from Goodreads.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("readBooks"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Books on the read shelf (used by 1x2 size).",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#goodreadsBook"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("shelf"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Shelf name (currently-reading, read, or to-read).",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Widget display size. Default: 1x1."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card type discriminator."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("widgetTealfm"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A teal.fm recently played tracks widget card.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("plays")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("coverArtNotice"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Copyright notice for cover art images."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("enabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for the card."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastSyncedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the play data was last fetched from the PDS.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("plays"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Recently played tracks."),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#tealfmPlay"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Widget display size. Default: 1x1."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Card type discriminator."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod github_contribution_day_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 Count;
        type Date;
        type Level;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Count = Unset;
        type Date = Unset;
        type Level = Unset;
    }
    ///State transition - sets the `count` field to Set
    pub struct SetCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCount<St> {}
    impl<St: State> State for SetCount<St> {
        type Count = Set<members::count>;
        type Date = St::Date;
        type Level = St::Level;
    }
    ///State transition - sets the `date` field to Set
    pub struct SetDate<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDate<St> {}
    impl<St: State> State for SetDate<St> {
        type Count = St::Count;
        type Date = Set<members::date>;
        type Level = St::Level;
    }
    ///State transition - sets the `level` field to Set
    pub struct SetLevel<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLevel<St> {}
    impl<St: State> State for SetLevel<St> {
        type Count = St::Count;
        type Date = St::Date;
        type Level = Set<members::level>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `count` field
        pub struct count(());
        ///Marker type for the `date` field
        pub struct date(());
        ///Marker type for the `level` field
        pub struct level(());
    }
}

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

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

impl<S: BosStr> GithubContributionDay<S> {
    /// Create a new builder for this type
    pub fn builder() -> GithubContributionDayBuilder<
        github_contribution_day_state::Empty,
        S,
    > {
        GithubContributionDayBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> GithubContributionDayBuilder<St, S>
where
    St: github_contribution_day_state::State,
    St::Count: github_contribution_day_state::IsUnset,
{
    /// Set the `count` field (required)
    pub fn count(
        mut self,
        value: impl Into<i64>,
    ) -> GithubContributionDayBuilder<github_contribution_day_state::SetCount<St>, S> {
        self._fields.0 = Option::Some(value.into());
        GithubContributionDayBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GithubContributionDayBuilder<St, S>
where
    St: github_contribution_day_state::State,
    St::Date: github_contribution_day_state::IsUnset,
{
    /// Set the `date` field (required)
    pub fn date(
        mut self,
        value: impl Into<S>,
    ) -> GithubContributionDayBuilder<github_contribution_day_state::SetDate<St>, S> {
        self._fields.1 = Option::Some(value.into());
        GithubContributionDayBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GithubContributionDayBuilder<St, S>
where
    St: github_contribution_day_state::State,
    St::Level: github_contribution_day_state::IsUnset,
{
    /// Set the `level` field (required)
    pub fn level(
        mut self,
        value: impl Into<i64>,
    ) -> GithubContributionDayBuilder<github_contribution_day_state::SetLevel<St>, S> {
        self._fields.2 = Option::Some(value.into());
        GithubContributionDayBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GithubContributionDayBuilder<St, S>
where
    St: github_contribution_day_state::State,
    St::Count: github_contribution_day_state::IsSet,
    St::Date: github_contribution_day_state::IsSet,
    St::Level: github_contribution_day_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> GithubContributionDay<S> {
        GithubContributionDay {
            count: self._fields.0.unwrap(),
            date: self._fields.1.unwrap(),
            level: 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>>,
    ) -> GithubContributionDay<S> {
        GithubContributionDay {
            count: self._fields.0.unwrap(),
            date: self._fields.1.unwrap(),
            level: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct LinkinbioBuilder<St: linkinbio_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<LinkinbioCardsItem<S>>>,
        Option<linkinbio::ConnectedServices<S>>,
        Option<Vec<linkinbio::SocialIcon<S>>>,
        Option<S>,
        Option<linkinbio::ThemeConfig<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> Linkinbio<S> {
    /// Create a new builder for this type
    pub fn builder() -> LinkinbioBuilder<linkinbio_state::Empty, S> {
        LinkinbioBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LinkinbioBuilder<St, S>
where
    St: linkinbio_state::State,
    St::Cards: linkinbio_state::IsUnset,
{
    /// Set the `cards` field (required)
    pub fn cards(
        mut self,
        value: impl Into<Vec<LinkinbioCardsItem<S>>>,
    ) -> LinkinbioBuilder<linkinbio_state::SetCards<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LinkinbioBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: linkinbio_state::State, S: BosStr> LinkinbioBuilder<St, S> {
    /// Set the `connectedServices` field (optional)
    pub fn connected_services(
        mut self,
        value: impl Into<Option<linkinbio::ConnectedServices<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `connectedServices` field to an Option value (optional)
    pub fn maybe_connected_services(
        mut self,
        value: Option<linkinbio::ConnectedServices<S>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: linkinbio_state::State, S: BosStr> LinkinbioBuilder<St, S> {
    /// Set the `socialIcons` field (optional)
    pub fn social_icons(
        mut self,
        value: impl Into<Option<Vec<linkinbio::SocialIcon<S>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `socialIcons` field to an Option value (optional)
    pub fn maybe_social_icons(
        mut self,
        value: Option<Vec<linkinbio::SocialIcon<S>>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: linkinbio_state::State, S: BosStr> LinkinbioBuilder<St, S> {
    /// Set the `theme` field (optional)
    pub fn theme(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `theme` field to an Option value (optional)
    pub fn maybe_theme(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: linkinbio_state::State, S: BosStr> LinkinbioBuilder<St, S> {
    /// Set the `themeConfig` field (optional)
    pub fn theme_config(
        mut self,
        value: impl Into<Option<linkinbio::ThemeConfig<S>>>,
    ) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `themeConfig` field to an Option value (optional)
    pub fn maybe_theme_config(
        mut self,
        value: Option<linkinbio::ThemeConfig<S>>,
    ) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St, S: BosStr> LinkinbioBuilder<St, S>
where
    St: linkinbio_state::State,
    St::Cards: linkinbio_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Linkinbio<S> {
        Linkinbio {
            cards: self._fields.0.unwrap(),
            connected_services: self._fields.1,
            social_icons: self._fields.2,
            theme: self._fields.3,
            theme_config: self._fields.4,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> Linkinbio<S> {
        Linkinbio {
            cards: self._fields.0.unwrap(),
            connected_services: self._fields.1,
            social_icons: self._fields.2,
            theme: self._fields.3,
            theme_config: self._fields.4,
            extra_data: Some(extra_data),
        }
    }
}

pub mod social_icon_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 Id;
        type Platform;
        type Url;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type Platform = Unset;
        type Url = Unset;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetId<St> {}
    impl<St: State> State for SetId<St> {
        type Id = Set<members::id>;
        type Platform = St::Platform;
        type Url = St::Url;
    }
    ///State transition - sets the `platform` field to Set
    pub struct SetPlatform<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetPlatform<St> {}
    impl<St: State> State for SetPlatform<St> {
        type Id = St::Id;
        type Platform = Set<members::platform>;
        type Url = St::Url;
    }
    ///State transition - sets the `url` field to Set
    pub struct SetUrl<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUrl<St> {}
    impl<St: State> State for SetUrl<St> {
        type Id = St::Id;
        type Platform = St::Platform;
        type Url = Set<members::url>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `platform` field
        pub struct platform(());
        ///Marker type for the `url` field
        pub struct url(());
    }
}

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

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

impl<S: BosStr> SocialIcon<S> {
    /// Create a new builder for this type
    pub fn builder() -> SocialIconBuilder<social_icon_state::Empty, S> {
        SocialIconBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SocialIconBuilder<St, S>
where
    St: social_icon_state::State,
    St::Id: social_icon_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<S>,
    ) -> SocialIconBuilder<social_icon_state::SetId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SocialIconBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SocialIconBuilder<St, S>
where
    St: social_icon_state::State,
    St::Platform: social_icon_state::IsUnset,
{
    /// Set the `platform` field (required)
    pub fn platform(
        mut self,
        value: impl Into<S>,
    ) -> SocialIconBuilder<social_icon_state::SetPlatform<St>, S> {
        self._fields.1 = Option::Some(value.into());
        SocialIconBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SocialIconBuilder<St, S>
where
    St: social_icon_state::State,
    St::Url: social_icon_state::IsUnset,
{
    /// Set the `url` field (required)
    pub fn url(
        mut self,
        value: impl Into<UriValue<S>>,
    ) -> SocialIconBuilder<social_icon_state::SetUrl<St>, S> {
        self._fields.2 = Option::Some(value.into());
        SocialIconBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SocialIconBuilder<St, S>
where
    St: social_icon_state::State,
    St::Id: social_icon_state::IsSet,
    St::Platform: social_icon_state::IsSet,
    St::Url: social_icon_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SocialIcon<S> {
        SocialIcon {
            id: self._fields.0.unwrap(),
            platform: self._fields.1.unwrap(),
            url: 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>>,
    ) -> SocialIcon<S> {
        SocialIcon {
            id: self._fields.0.unwrap(),
            platform: self._fields.1.unwrap(),
            url: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct WidgetGithubBuilder<St: widget_github_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<linkinbio::GithubContributionDay<S>>>,
        Option<bool>,
        Option<S>,
        Option<S>,
        Option<Datetime>,
        Option<WidgetGithubSize<S>>,
        Option<i64>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> WidgetGithub<S> {
    /// Create a new builder for this type
    pub fn builder() -> WidgetGithubBuilder<widget_github_state::Empty, S> {
        WidgetGithubBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> WidgetGithubBuilder<St, S>
where
    St: widget_github_state::State,
    St::Contributions: widget_github_state::IsUnset,
{
    /// Set the `contributions` field (required)
    pub fn contributions(
        mut self,
        value: impl Into<Vec<linkinbio::GithubContributionDay<S>>>,
    ) -> WidgetGithubBuilder<widget_github_state::SetContributions<St>, S> {
        self._fields.0 = Option::Some(value.into());
        WidgetGithubBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> WidgetGithubBuilder<St, S>
where
    St: widget_github_state::State,
    St::GithubUsername: widget_github_state::IsUnset,
{
    /// Set the `githubUsername` field (required)
    pub fn github_username(
        mut self,
        value: impl Into<S>,
    ) -> WidgetGithubBuilder<widget_github_state::SetGithubUsername<St>, S> {
        self._fields.2 = Option::Some(value.into());
        WidgetGithubBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> WidgetGithubBuilder<St, S>
where
    St: widget_github_state::State,
    St::Id: widget_github_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<S>,
    ) -> WidgetGithubBuilder<widget_github_state::SetId<St>, S> {
        self._fields.3 = Option::Some(value.into());
        WidgetGithubBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: widget_github_state::State, S: BosStr> WidgetGithubBuilder<St, S> {
    /// Set the `lastSyncedAt` field (optional)
    pub fn last_synced_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `lastSyncedAt` field to an Option value (optional)
    pub fn maybe_last_synced_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: widget_github_state::State, S: BosStr> WidgetGithubBuilder<St, S> {
    /// Set the `size` field (optional)
    pub fn size(mut self, value: impl Into<Option<WidgetGithubSize<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `size` field to an Option value (optional)
    pub fn maybe_size(mut self, value: Option<WidgetGithubSize<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: widget_github_state::State, S: BosStr> WidgetGithubBuilder<St, S> {
    /// Set the `totalContributions` field (optional)
    pub fn total_contributions(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `totalContributions` field to an Option value (optional)
    pub fn maybe_total_contributions(mut self, value: Option<i64>) -> Self {
        self._fields.6 = value;
        self
    }
}

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

impl<St, S: BosStr> WidgetGithubBuilder<St, S>
where
    St: widget_github_state::State,
    St::Contributions: widget_github_state::IsSet,
    St::GithubUsername: widget_github_state::IsSet,
    St::Id: widget_github_state::IsSet,
    St::Type: widget_github_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> WidgetGithub<S> {
        WidgetGithub {
            contributions: self._fields.0.unwrap(),
            enabled: self._fields.1,
            github_username: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            last_synced_at: self._fields.4,
            size: self._fields.5,
            total_contributions: self._fields.6,
            r#type: self._fields.7.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>>,
    ) -> WidgetGithub<S> {
        WidgetGithub {
            contributions: self._fields.0.unwrap(),
            enabled: self._fields.1,
            github_username: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            last_synced_at: self._fields.4,
            size: self._fields.5,
            total_contributions: self._fields.6,
            r#type: self._fields.7.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod widget_goodreads_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 Books;
        type GoodreadsUserId;
        type Id;
        type Shelf;
        type Type;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Books = Unset;
        type GoodreadsUserId = Unset;
        type Id = Unset;
        type Shelf = Unset;
        type Type = Unset;
    }
    ///State transition - sets the `books` field to Set
    pub struct SetBooks<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBooks<St> {}
    impl<St: State> State for SetBooks<St> {
        type Books = Set<members::books>;
        type GoodreadsUserId = St::GoodreadsUserId;
        type Id = St::Id;
        type Shelf = St::Shelf;
        type Type = St::Type;
    }
    ///State transition - sets the `goodreads_user_id` field to Set
    pub struct SetGoodreadsUserId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetGoodreadsUserId<St> {}
    impl<St: State> State for SetGoodreadsUserId<St> {
        type Books = St::Books;
        type GoodreadsUserId = Set<members::goodreads_user_id>;
        type Id = St::Id;
        type Shelf = St::Shelf;
        type Type = St::Type;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetId<St> {}
    impl<St: State> State for SetId<St> {
        type Books = St::Books;
        type GoodreadsUserId = St::GoodreadsUserId;
        type Id = Set<members::id>;
        type Shelf = St::Shelf;
        type Type = St::Type;
    }
    ///State transition - sets the `shelf` field to Set
    pub struct SetShelf<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetShelf<St> {}
    impl<St: State> State for SetShelf<St> {
        type Books = St::Books;
        type GoodreadsUserId = St::GoodreadsUserId;
        type Id = St::Id;
        type Shelf = Set<members::shelf>;
        type Type = St::Type;
    }
    ///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 Books = St::Books;
        type GoodreadsUserId = St::GoodreadsUserId;
        type Id = St::Id;
        type Shelf = St::Shelf;
        type Type = Set<members::r#type>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `books` field
        pub struct books(());
        ///Marker type for the `goodreads_user_id` field
        pub struct goodreads_user_id(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `shelf` field
        pub struct shelf(());
        ///Marker type for the `type` field
        pub struct r#type(());
    }
}

/// Builder for constructing an instance of this type.
pub struct WidgetGoodreadsBuilder<
    St: widget_goodreads_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<linkinbio::GoodreadsBook<S>>>,
        Option<bool>,
        Option<S>,
        Option<S>,
        Option<Datetime>,
        Option<Vec<linkinbio::GoodreadsBook<S>>>,
        Option<S>,
        Option<WidgetGoodreadsSize<S>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> WidgetGoodreads<S> {
    /// Create a new builder for this type
    pub fn builder() -> WidgetGoodreadsBuilder<widget_goodreads_state::Empty, S> {
        WidgetGoodreadsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> WidgetGoodreadsBuilder<St, S>
where
    St: widget_goodreads_state::State,
    St::Books: widget_goodreads_state::IsUnset,
{
    /// Set the `books` field (required)
    pub fn books(
        mut self,
        value: impl Into<Vec<linkinbio::GoodreadsBook<S>>>,
    ) -> WidgetGoodreadsBuilder<widget_goodreads_state::SetBooks<St>, S> {
        self._fields.0 = Option::Some(value.into());
        WidgetGoodreadsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> WidgetGoodreadsBuilder<St, S>
where
    St: widget_goodreads_state::State,
    St::GoodreadsUserId: widget_goodreads_state::IsUnset,
{
    /// Set the `goodreadsUserId` field (required)
    pub fn goodreads_user_id(
        mut self,
        value: impl Into<S>,
    ) -> WidgetGoodreadsBuilder<widget_goodreads_state::SetGoodreadsUserId<St>, S> {
        self._fields.2 = Option::Some(value.into());
        WidgetGoodreadsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> WidgetGoodreadsBuilder<St, S>
where
    St: widget_goodreads_state::State,
    St::Id: widget_goodreads_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<S>,
    ) -> WidgetGoodreadsBuilder<widget_goodreads_state::SetId<St>, S> {
        self._fields.3 = Option::Some(value.into());
        WidgetGoodreadsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: widget_goodreads_state::State, S: BosStr> WidgetGoodreadsBuilder<St, S> {
    /// Set the `lastSyncedAt` field (optional)
    pub fn last_synced_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `lastSyncedAt` field to an Option value (optional)
    pub fn maybe_last_synced_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St: widget_goodreads_state::State, S: BosStr> WidgetGoodreadsBuilder<St, S> {
    /// Set the `readBooks` field (optional)
    pub fn read_books(
        mut self,
        value: impl Into<Option<Vec<linkinbio::GoodreadsBook<S>>>>,
    ) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `readBooks` field to an Option value (optional)
    pub fn maybe_read_books(
        mut self,
        value: Option<Vec<linkinbio::GoodreadsBook<S>>>,
    ) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> WidgetGoodreadsBuilder<St, S>
where
    St: widget_goodreads_state::State,
    St::Shelf: widget_goodreads_state::IsUnset,
{
    /// Set the `shelf` field (required)
    pub fn shelf(
        mut self,
        value: impl Into<S>,
    ) -> WidgetGoodreadsBuilder<widget_goodreads_state::SetShelf<St>, S> {
        self._fields.6 = Option::Some(value.into());
        WidgetGoodreadsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: widget_goodreads_state::State, S: BosStr> WidgetGoodreadsBuilder<St, S> {
    /// Set the `size` field (optional)
    pub fn size(mut self, value: impl Into<Option<WidgetGoodreadsSize<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `size` field to an Option value (optional)
    pub fn maybe_size(mut self, value: Option<WidgetGoodreadsSize<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

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

impl<St, S: BosStr> WidgetGoodreadsBuilder<St, S>
where
    St: widget_goodreads_state::State,
    St::Books: widget_goodreads_state::IsSet,
    St::GoodreadsUserId: widget_goodreads_state::IsSet,
    St::Id: widget_goodreads_state::IsSet,
    St::Shelf: widget_goodreads_state::IsSet,
    St::Type: widget_goodreads_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> WidgetGoodreads<S> {
        WidgetGoodreads {
            books: self._fields.0.unwrap(),
            enabled: self._fields.1,
            goodreads_user_id: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            last_synced_at: self._fields.4,
            read_books: self._fields.5,
            shelf: self._fields.6.unwrap(),
            size: self._fields.7,
            r#type: self._fields.8.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>>,
    ) -> WidgetGoodreads<S> {
        WidgetGoodreads {
            books: self._fields.0.unwrap(),
            enabled: self._fields.1,
            goodreads_user_id: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            last_synced_at: self._fields.4,
            read_books: self._fields.5,
            shelf: self._fields.6.unwrap(),
            size: self._fields.7,
            r#type: self._fields.8.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct WidgetTealfmBuilder<St: widget_tealfm_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<bool>,
        Option<S>,
        Option<Datetime>,
        Option<Vec<linkinbio::TealfmPlay<S>>>,
        Option<WidgetTealfmSize<S>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> WidgetTealfm<S> {
    /// Create a new builder for this type
    pub fn builder() -> WidgetTealfmBuilder<widget_tealfm_state::Empty, S> {
        WidgetTealfmBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> WidgetTealfmBuilder<St, S>
where
    St: widget_tealfm_state::State,
    St::Id: widget_tealfm_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<S>,
    ) -> WidgetTealfmBuilder<widget_tealfm_state::SetId<St>, S> {
        self._fields.2 = Option::Some(value.into());
        WidgetTealfmBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: widget_tealfm_state::State, S: BosStr> WidgetTealfmBuilder<St, S> {
    /// Set the `lastSyncedAt` field (optional)
    pub fn last_synced_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `lastSyncedAt` field to an Option value (optional)
    pub fn maybe_last_synced_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> WidgetTealfmBuilder<St, S>
where
    St: widget_tealfm_state::State,
    St::Plays: widget_tealfm_state::IsUnset,
{
    /// Set the `plays` field (required)
    pub fn plays(
        mut self,
        value: impl Into<Vec<linkinbio::TealfmPlay<S>>>,
    ) -> WidgetTealfmBuilder<widget_tealfm_state::SetPlays<St>, S> {
        self._fields.4 = Option::Some(value.into());
        WidgetTealfmBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: widget_tealfm_state::State, S: BosStr> WidgetTealfmBuilder<St, S> {
    /// Set the `size` field (optional)
    pub fn size(mut self, value: impl Into<Option<WidgetTealfmSize<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `size` field to an Option value (optional)
    pub fn maybe_size(mut self, value: Option<WidgetTealfmSize<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

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

impl<St, S: BosStr> WidgetTealfmBuilder<St, S>
where
    St: widget_tealfm_state::State,
    St::Id: widget_tealfm_state::IsSet,
    St::Plays: widget_tealfm_state::IsSet,
    St::Type: widget_tealfm_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> WidgetTealfm<S> {
        WidgetTealfm {
            cover_art_notice: self._fields.0,
            enabled: self._fields.1,
            id: self._fields.2.unwrap(),
            last_synced_at: self._fields.3,
            plays: self._fields.4.unwrap(),
            size: self._fields.5,
            r#type: self._fields.6.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>>,
    ) -> WidgetTealfm<S> {
        WidgetTealfm {
            cover_art_notice: self._fields.0,
            enabled: self._fields.1,
            id: self._fields.2.unwrap(),
            last_synced_at: self._fields.3,
            plays: self._fields.4.unwrap(),
            size: self._fields.5,
            r#type: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}