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

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

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

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::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::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::social_showcase::ShowcaseItem;
/// User profile record

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Profile<'a> {
    ///Custom accent color hex code (e.g. #2e4a6e)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub accent_color: Option<CowStr<'a>>,
    ///Avatar image blob (1000x1000px max)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub avatar: Option<BlobRef<'a>>,
    ///Banner image blob (3000x1000px max)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub banner: Option<BlobRef<'a>>,
    ///Profile description
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub bio: Option<CowStr<'a>>,
    ///Total number of collections  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_profile_collection_count")]
    pub collection_count: Option<i64>,
    pub created_at: Datetime,
    ///User's DID
    #[serde(borrow)]
    pub did: CowStr<'a>,
    ///Display name
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub display_name: Option<CowStr<'a>>,
    ///User's handle
    #[serde(borrow)]
    pub handle: CowStr<'a>,
    ///Total number of items in the user's library  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_profile_item_count")]
    pub item_count: Option<i64>,
    ///Schema version for migrations (defaults to 1 if missing)  Defaults to `1`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_profile_schema_version")]
    pub schema_version: Option<i64>,
    ///Featured showcase items
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub showcase: Option<Vec<ShowcaseItem<'a>>>,
    ///Profile tags for discovery (max 10)
    #[serde(borrow)]
    pub tags: Vec<CowStr<'a>>,
    ///Profile theme preset name
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub theme: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    ///External website URL
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub website: Option<UriValue<'a>>,
}

/// 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 ProfileGetRecordOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Profile<'a>,
}

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

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

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

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

impl Collection for Profile<'_> {
    const NSID: &'static str = "social.showcase.profile.profile";
    type Record = ProfileRecord;
}

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

impl<'a> LexiconSchema for Profile<'a> {
    fn nsid() -> &'static str {
        "social.showcase.profile.profile"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_social_showcase_profile_profile()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.accent_color {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 7usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("accent_color"),
                    max: 7usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.avatar {
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("avatar"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.avatar {
            {
                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("avatar"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string(),
                            "image/webp".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        if let Some(ref value) = self.banner {
            {
                let size = value.blob().size;
                if size > 1000000usize {
                    return Err(ConstraintError::BlobTooLarge {
                        path: ValidationPath::from_field("banner"),
                        max: 1000000usize,
                        actual: size,
                    });
                }
            }
        }
        if let Some(ref value) = self.banner {
            {
                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("banner"),
                        accepted: vec![
                            "image/png".to_string(), "image/jpeg".to_string(),
                            "image/webp".to_string()
                        ],
                        actual: mime.to_string(),
                    });
                }
            }
        }
        if let Some(ref value) = self.bio {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("bio"),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.did;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2048usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("did"),
                    max: 2048usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.display_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 64usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("display_name"),
                    max: 64usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.handle;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 253usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("handle"),
                    max: 253usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.showcase {
            #[allow(unused_comparisons)]
            if value.len() > 4usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("showcase"),
                    max: 4usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.tags;
            #[allow(unused_comparisons)]
            if value.len() > 10usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("tags"),
                    max: 10usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.theme {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 64usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("theme"),
                    max: 64usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.website {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2048usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("website"),
                    max: 2048usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

fn _default_profile_collection_count() -> Option<i64> {
    Some(0i64)
}

fn _default_profile_item_count() -> Option<i64> {
    Some(0i64)
}

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

pub mod profile_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 Handle;
        type Did;
        type CreatedAt;
        type Tags;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Handle = Unset;
        type Did = Unset;
        type CreatedAt = Unset;
        type Tags = Unset;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHandle<S> {}
    impl<S: State> State for SetHandle<S> {
        type Handle = Set<members::handle>;
        type Did = S::Did;
        type CreatedAt = S::CreatedAt;
        type Tags = S::Tags;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Handle = S::Handle;
        type Did = Set<members::did>;
        type CreatedAt = S::CreatedAt;
        type Tags = S::Tags;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Handle = S::Handle;
        type Did = S::Did;
        type CreatedAt = Set<members::created_at>;
        type Tags = S::Tags;
    }
    ///State transition - sets the `tags` field to Set
    pub struct SetTags<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTags<S> {}
    impl<S: State> State for SetTags<S> {
        type Handle = S::Handle;
        type Did = S::Did;
        type CreatedAt = S::CreatedAt;
        type Tags = Set<members::tags>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `handle` field
        pub struct handle(());
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `tags` field
        pub struct tags(());
    }
}

/// Builder for constructing an instance of this type
pub struct ProfileBuilder<'a, S: profile_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<BlobRef<'a>>,
        Option<BlobRef<'a>>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<i64>,
        Option<Vec<ShowcaseItem<'a>>>,
        Option<Vec<CowStr<'a>>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<UriValue<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Profile<'a> {
    /// Create a new builder for this type
    pub fn new() -> ProfileBuilder<'a, profile_state::Empty> {
        ProfileBuilder::new()
    }
}

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

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `accentColor` field (optional)
    pub fn accent_color(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `accentColor` field to an Option value (optional)
    pub fn maybe_accent_color(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `avatar` field (optional)
    pub fn avatar(mut self, value: impl Into<Option<BlobRef<'a>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `avatar` field to an Option value (optional)
    pub fn maybe_avatar(mut self, value: Option<BlobRef<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `banner` field (optional)
    pub fn banner(mut self, value: impl Into<Option<BlobRef<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `banner` field to an Option value (optional)
    pub fn maybe_banner(mut self, value: Option<BlobRef<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `bio` field (optional)
    pub fn bio(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `bio` field to an Option value (optional)
    pub fn maybe_bio(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `collectionCount` field (optional)
    pub fn collection_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `collectionCount` field to an Option value (optional)
    pub fn maybe_collection_count(mut self, value: Option<i64>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S> ProfileBuilder<'a, S>
where
    S: profile_state::State,
    S::CreatedAt: profile_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ProfileBuilder<'a, profile_state::SetCreatedAt<S>> {
        self._fields.5 = Option::Some(value.into());
        ProfileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ProfileBuilder<'a, S>
where
    S: profile_state::State,
    S::Did: profile_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ProfileBuilder<'a, profile_state::SetDid<S>> {
        self._fields.6 = Option::Some(value.into());
        ProfileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `displayName` field (optional)
    pub fn display_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `displayName` field to an Option value (optional)
    pub fn maybe_display_name(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S> ProfileBuilder<'a, S>
where
    S: profile_state::State,
    S::Handle: profile_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ProfileBuilder<'a, profile_state::SetHandle<S>> {
        self._fields.8 = Option::Some(value.into());
        ProfileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `itemCount` field (optional)
    pub fn item_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `itemCount` field to an Option value (optional)
    pub fn maybe_item_count(mut self, value: Option<i64>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `schemaVersion` field (optional)
    pub fn schema_version(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `schemaVersion` field to an Option value (optional)
    pub fn maybe_schema_version(mut self, value: Option<i64>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `showcase` field (optional)
    pub fn showcase(mut self, value: impl Into<Option<Vec<ShowcaseItem<'a>>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `showcase` field to an Option value (optional)
    pub fn maybe_showcase(mut self, value: Option<Vec<ShowcaseItem<'a>>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S> ProfileBuilder<'a, S>
where
    S: profile_state::State,
    S::Tags: profile_state::IsUnset,
{
    /// Set the `tags` field (required)
    pub fn tags(
        mut self,
        value: impl Into<Vec<CowStr<'a>>>,
    ) -> ProfileBuilder<'a, profile_state::SetTags<S>> {
        self._fields.12 = Option::Some(value.into());
        ProfileBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `theme` field (optional)
    pub fn theme(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `theme` field to an Option value (optional)
    pub fn maybe_theme(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `updatedAt` field to an Option value (optional)
    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<'a, S: profile_state::State> ProfileBuilder<'a, S> {
    /// Set the `website` field (optional)
    pub fn website(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `website` field to an Option value (optional)
    pub fn maybe_website(mut self, value: Option<UriValue<'a>>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<'a, S> ProfileBuilder<'a, S>
where
    S: profile_state::State,
    S::Handle: profile_state::IsSet,
    S::Did: profile_state::IsSet,
    S::CreatedAt: profile_state::IsSet,
    S::Tags: profile_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Profile<'a> {
        Profile {
            accent_color: self._fields.0,
            avatar: self._fields.1,
            banner: self._fields.2,
            bio: self._fields.3,
            collection_count: self._fields.4.or_else(|| Some(0i64)),
            created_at: self._fields.5.unwrap(),
            did: self._fields.6.unwrap(),
            display_name: self._fields.7,
            handle: self._fields.8.unwrap(),
            item_count: self._fields.9.or_else(|| Some(0i64)),
            schema_version: self._fields.10.or_else(|| Some(1i64)),
            showcase: self._fields.11,
            tags: self._fields.12.unwrap(),
            theme: self._fields.13,
            updated_at: self._fields.14,
            website: self._fields.15,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Profile<'a> {
        Profile {
            accent_color: self._fields.0,
            avatar: self._fields.1,
            banner: self._fields.2,
            bio: self._fields.3,
            collection_count: self._fields.4.or_else(|| Some(0i64)),
            created_at: self._fields.5.unwrap(),
            did: self._fields.6.unwrap(),
            display_name: self._fields.7,
            handle: self._fields.8.unwrap(),
            item_count: self._fields.9.or_else(|| Some(0i64)),
            schema_version: self._fields.10.or_else(|| Some(1i64)),
            showcase: self._fields.11,
            tags: self._fields.12.unwrap(),
            theme: self._fields.13,
            updated_at: self._fields.14,
            website: self._fields.15,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_social_showcase_profile_profile() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("social.showcase.profile.profile"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    description: Some(CowStr::new_static("User profile record")),
                    key: Some(CowStr::new_static("literal:self")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("did"), SmolStr::new_static("handle"),
                                SmolStr::new_static("tags"),
                                SmolStr::new_static("createdAt")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("accentColor"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Custom accent color hex code (e.g. #2e4a6e)",
                                        ),
                                    ),
                                    max_length: Some(7usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("avatar"),
                                LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("banner"),
                                LexObjectProperty::Blob(LexBlob { ..Default::default() }),
                            );
                            map.insert(
                                SmolStr::new_static("bio"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Profile description"),
                                    ),
                                    max_length: Some(256usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("collectionCount"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("createdAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("did"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("User's DID")),
                                    max_length: Some(2048usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("displayName"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("Display name")),
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("handle"),
                                LexObjectProperty::String(LexString {
                                    description: Some(CowStr::new_static("User's handle")),
                                    max_length: Some(253usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("itemCount"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("schemaVersion"),
                                LexObjectProperty::Integer(LexInteger {
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("showcase"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("Featured showcase items"),
                                    ),
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static(
                                            "social.showcase.defs#showcaseItem",
                                        ),
                                        ..Default::default()
                                    }),
                                    max_length: Some(4usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("tags"),
                                LexObjectProperty::Array(LexArray {
                                    description: Some(
                                        CowStr::new_static("Profile tags for discovery (max 10)"),
                                    ),
                                    items: LexArrayItem::String(LexString {
                                        max_length: Some(64usize),
                                        ..Default::default()
                                    }),
                                    max_length: Some(10usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("theme"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("Profile theme preset name"),
                                    ),
                                    max_length: Some(64usize),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("updatedAt"),
                                LexObjectProperty::String(LexString {
                                    format: Some(LexStringFormat::Datetime),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("website"),
                                LexObjectProperty::String(LexString {
                                    description: Some(
                                        CowStr::new_static("External website URL"),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    max_length: Some(2048usize),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}