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

//! Generated bindings for the `sh.weaver.actor` Lexicon namespace/module.
pub mod get_actor_entries;
pub mod get_actor_notebooks;
pub mod get_profile;
pub mod get_suggested_authors;
pub mod profile;
pub mod search_actors;
pub mod search_actors_typeahead;


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

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

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{Did, Handle, AtUri, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, 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::app_bsky::actor::ProfileViewDetailed;
use crate::com_atproto::label::Label;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::sh_weaver::actor;
/// A single author in a Weaver notebook.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Author<S: BosStr = DefaultStr> {
    pub did: Did<S>,
    ///signed bytes of the corresponding notebook record in the author's repo
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default, with = "jacquard_common::opt_serde_bytes_helper")]
    pub signature: Option<Bytes>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

pub type PinnedList<S = DefaultStr> = Vec<StrongRef<S>>;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileDataView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub collaboration_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entry_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follower_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following_count: Option<i64>,
    pub inner: ProfileDataViewInner<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notebook_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer: Option<actor::ViewerState<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 ProfileDataViewInner<S: BosStr = DefaultStr> {
    #[serde(rename = "sh.weaver.actor.defs#profileView")]
    ProfileView(Box<actor::ProfileView<S>>),
    #[serde(rename = "app.bsky.actor.defs#profileViewDetailed")]
    ProfileViewDetailed(Box<ProfileViewDetailed<S>>),
    #[serde(rename = "sh.weaver.actor.defs#tangledProfileView")]
    TangledProfileView(Box<actor::TangledProfileView<S>>),
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileDataViewBasic<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follower_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following_count: Option<i64>,
    pub inner: ProfileDataViewBasicInner<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub viewer: Option<actor::ViewerStateBasic<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 ProfileDataViewBasicInner<S: BosStr = DefaultStr> {
    #[serde(rename = "sh.weaver.actor.defs#profileViewBasic")]
    ProfileViewBasic(Box<crate::sh_weaver::actor::ProfileViewBasic<S>>),
    #[serde(rename = "app.bsky.actor.defs#profileViewBasic")]
    BskyProfileViewBasic(Box<crate::app_bsky::actor::ProfileViewBasic<S>>),
    #[serde(rename = "sh.weaver.actor.defs#tangledProfileView")]
    TangledProfileView(Box<actor::TangledProfileView<S>>),
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<UriValue<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub banner: Option<UriValue<S>>,
    ///Include link to this account on Bluesky.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bluesky: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    pub handle: Handle<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<Label<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub links: Option<Vec<UriValue<S>>>,
    ///Free-form location text.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<S>,
    ///Notebooks or other records pinned for display.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pinned: Option<actor::PinnedList<S>>,
    ///Pronouns to use in user-generated content.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pronouns: Option<actor::PronounsList<S>>,
    ///Include link to this account on stream.place.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub streamplace: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribed_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscriber_count: Option<i64>,
    ///Include link to this account on Tangled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tangled: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileViewBasic<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<UriValue<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    pub handle: Handle<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<Label<S>>>,
    ///Pronouns to use in user-generated content.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pronouns: Option<actor::PronounsList<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

pub type PronounsList<S = DefaultStr> = Vec<S>;
/// A notebook the viewer subscribes to without a global follow.

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct TangledProfileView<S: BosStr = DefaultStr> {
    ///Include link to this account on Bluesky.
    pub bluesky: bool,
    ///Free-form profile description text.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    pub did: Did<S>,
    pub handle: Handle<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub links: Option<Vec<UriValue<S>>>,
    ///Free-form location text.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub location: Option<S>,
    ///Any ATURI, it is up to appviews to validate these fields.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pinned_repositories: Option<Vec<AtUri<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub stats: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Viewer's relationship state with an actor (detailed version).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ViewerState<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked_by: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follow_requested: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follow_requested_by: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub followed_by: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub muted: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribed_notebooks: Option<Vec<actor::SubscribedNotebook<S>>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Viewer's relationship state with an actor (basic version).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ViewerStateBasic<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked_by: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follow_requested: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follow_requested_by: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub followed_by: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub muted: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribed_notebook_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for Author<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "author"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileDataView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "profileDataView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileDataViewBasic<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "profileDataViewBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "profileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10240usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 10240usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.description {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 1024usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("description"),
                        max: 1024usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.display_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 640usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("display_name"),
                    max: 640usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.display_name {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 64usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("display_name"),
                        max: 64usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.links {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("links"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.links {
            #[allow(unused_comparisons)]
            if value.len() < 0usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("links"),
                    min: 0usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.location {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 400usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("location"),
                    max: 400usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.location {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 40usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("location"),
                        max: 40usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileViewBasic<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "profileViewBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.display_name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 640usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("display_name"),
                    max: 640usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.display_name {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 64usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("display_name"),
                        max: 64usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SubscribedNotebook<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "subscribedNotebook"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for TangledProfileView<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "tangledProfileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2560usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 2560usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.description {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 256usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("description"),
                        max: 256usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.links {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("links"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.links {
            #[allow(unused_comparisons)]
            if value.len() < 0usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("links"),
                    min: 0usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.location {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 400usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("location"),
                    max: 400usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.location {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 40usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("location"),
                        max: 40usize,
                        actual: count,
                    });
                }
            }
        }
        if let Some(ref value) = self.pinned_repositories {
            #[allow(unused_comparisons)]
            if value.len() > 6usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("pinned_repositories"),
                    max: 6usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.pinned_repositories {
            #[allow(unused_comparisons)]
            if value.len() < 0usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("pinned_repositories"),
                    min: 0usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.stats {
            #[allow(unused_comparisons)]
            if value.len() > 2usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("stats"),
                    max: 2usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.stats {
            #[allow(unused_comparisons)]
            if value.len() < 0usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("stats"),
                    min: 0usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ViewerState<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "viewerState"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ViewerStateBasic<S> {
    fn nsid() -> &'static str {
        "sh.weaver.actor.defs"
    }
    fn def_name() -> &'static str {
        "viewerStateBasic"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_weaver_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

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

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

impl<S: BosStr> Author<S> {
    /// Create a new builder for this type
    pub fn builder() -> AuthorBuilder<author_state::Empty, S> {
        AuthorBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> AuthorBuilder<St, S>
where
    St: author_state::State,
    St::Did: author_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> AuthorBuilder<author_state::SetDid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        AuthorBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> AuthorBuilder<St, S>
where
    St: author_state::State,
    St::Did: author_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Author<S> {
        Author {
            did: self._fields.0.unwrap(),
            signature: self._fields.1,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Author<S> {
        Author {
            did: self._fields.0.unwrap(),
            signature: self._fields.1,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_sh_weaver_actor_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("sh.weaver.actor.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("author"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A single author in a Weaver notebook."),
                    ),
                    required: Some(vec![SmolStr::new_static("did")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("signature"),
                            LexObjectProperty::Bytes(LexBytes { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pinnedList"),
                LexUserType::Array(LexArray {
                    items: LexArrayItem::Ref(LexRef {
                        r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileDataView"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("inner")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("collaborationCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("entryCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followerCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("inner"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#profileView"),
                                    CowStr::new_static("app.bsky.actor.defs#profileViewDetailed"),
                                    CowStr::new_static("#tangledProfileView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("notebookCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerState"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileDataViewBasic"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("inner")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("followerCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("inner"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#profileViewBasic"),
                                    CowStr::new_static("app.bsky.actor.defs#profileViewBasic"),
                                    CowStr::new_static("#tangledProfileView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#viewerStateBasic"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("banner"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("bluesky"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10240usize),
                                max_graphemes: Some(1024usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(640usize),
                                max_graphemes: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("links"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Any URI, intended for social profiles or websites, can be used to link DIDs/AT-URIs too.",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                                min_length: Some(0usize),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("location"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Free-form location text."),
                                ),
                                max_length: Some(400usize),
                                max_graphemes: Some(40usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pinned"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#pinnedList"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pronouns"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#pronounsList"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("streamplace"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscribedCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscriberCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tangled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileViewBasic"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("did"), SmolStr::new_static("handle")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Uri),
                                ..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 {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(640usize),
                                max_graphemes: Some(64usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pronouns"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#pronounsList"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pronounsList"),
                LexUserType::Array(LexArray {
                    items: LexArrayItem::String(LexString {
                        max_length: Some(500usize),
                        max_graphemes: Some(50usize),
                        ..Default::default()
                    }),
                    max_length: Some(5usize),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("subscribedNotebook"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A notebook the viewer subscribes to without a global follow.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("uri")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("path"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("title"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("tangledProfileView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("bluesky"), SmolStr::new_static("did"),
                            SmolStr::new_static("handle")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("bluesky"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Free-form profile description text."),
                                ),
                                max_length: Some(2560usize),
                                max_graphemes: Some(256usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("links"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    description: Some(
                                        CowStr::new_static(
                                            "Any URI, intended for social profiles or websites, can be used to link DIDs/AT-URIs too.",
                                        ),
                                    ),
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                                min_length: Some(0usize),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("location"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Free-form location text."),
                                ),
                                max_length: Some(400usize),
                                max_graphemes: Some(40usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pinnedRepositories"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Any ATURI, it is up to appviews to validate these fields.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::AtUri),
                                    ..Default::default()
                                }),
                                min_length: Some(0usize),
                                max_length: Some(6usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("stats"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    description: Some(CowStr::new_static("Vanity stats.")),
                                    ..Default::default()
                                }),
                                min_length: Some(0usize),
                                max_length: Some(2usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("viewerState"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Viewer's relationship state with an actor (detailed version).",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blocked"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("blockedBy"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followRequested"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followRequestedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("following"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muted"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscribedNotebooks"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#subscribedNotebook"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("viewerStateBasic"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Viewer's relationship state with an actor (basic version).",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blocked"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("blockedBy"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followRequested"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followRequestedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("followedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("following"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muted"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subscribedNotebookCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod profile_data_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Inner;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Inner = Unset;
    }
    ///State transition - sets the `inner` field to Set
    pub struct SetInner<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetInner<St> {}
    impl<St: State> State for SetInner<St> {
        type Inner = Set<members::inner>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `inner` field
        pub struct inner(());
    }
}

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

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

impl<S: BosStr> ProfileDataView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ProfileDataViewBuilder<profile_data_view_state::Empty, S> {
        ProfileDataViewBuilder::builder()
    }
}

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

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

impl<St: profile_data_view_state::State, S: BosStr> ProfileDataViewBuilder<St, S> {
    /// Set the `collaborationCount` field (optional)
    pub fn collaboration_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `collaborationCount` field to an Option value (optional)
    pub fn maybe_collaboration_count(mut self, value: Option<i64>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: profile_data_view_state::State, S: BosStr> ProfileDataViewBuilder<St, S> {
    /// Set the `entryCount` field (optional)
    pub fn entry_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `entryCount` field to an Option value (optional)
    pub fn maybe_entry_count(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: profile_data_view_state::State, S: BosStr> ProfileDataViewBuilder<St, S> {
    /// Set the `followerCount` field (optional)
    pub fn follower_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `followerCount` field to an Option value (optional)
    pub fn maybe_follower_count(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: profile_data_view_state::State, S: BosStr> ProfileDataViewBuilder<St, S> {
    /// Set the `followingCount` field (optional)
    pub fn following_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `followingCount` field to an Option value (optional)
    pub fn maybe_following_count(mut self, value: Option<i64>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> ProfileDataViewBuilder<St, S>
where
    St: profile_data_view_state::State,
    St::Inner: profile_data_view_state::IsUnset,
{
    /// Set the `inner` field (required)
    pub fn inner(
        mut self,
        value: impl Into<ProfileDataViewInner<S>>,
    ) -> ProfileDataViewBuilder<profile_data_view_state::SetInner<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ProfileDataViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: profile_data_view_state::State, S: BosStr> ProfileDataViewBuilder<St, S> {
    /// Set the `viewer` field (optional)
    pub fn viewer(mut self, value: impl Into<Option<actor::ViewerState<S>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `viewer` field to an Option value (optional)
    pub fn maybe_viewer(mut self, value: Option<actor::ViewerState<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St, S: BosStr> ProfileDataViewBuilder<St, S>
where
    St: profile_data_view_state::State,
    St::Inner: profile_data_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ProfileDataView<S> {
        ProfileDataView {
            collaboration_count: self._fields.0,
            entry_count: self._fields.1,
            follower_count: self._fields.2,
            following_count: self._fields.3,
            inner: self._fields.4.unwrap(),
            notebook_count: self._fields.5,
            viewer: self._fields.6,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ProfileDataView<S> {
        ProfileDataView {
            collaboration_count: self._fields.0,
            entry_count: self._fields.1,
            follower_count: self._fields.2,
            following_count: self._fields.3,
            inner: self._fields.4.unwrap(),
            notebook_count: self._fields.5,
            viewer: self._fields.6,
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ProfileDataViewBasic<S> {
    /// Create a new builder for this type
    pub fn builder() -> ProfileDataViewBasicBuilder<
        profile_data_view_basic_state::Empty,
        S,
    > {
        ProfileDataViewBasicBuilder::builder()
    }
}

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

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

impl<
    St: profile_data_view_basic_state::State,
    S: BosStr,
> ProfileDataViewBasicBuilder<St, S> {
    /// Set the `followerCount` field (optional)
    pub fn follower_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `followerCount` field to an Option value (optional)
    pub fn maybe_follower_count(mut self, value: Option<i64>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<
    St: profile_data_view_basic_state::State,
    S: BosStr,
> ProfileDataViewBasicBuilder<St, S> {
    /// Set the `followingCount` field (optional)
    pub fn following_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `followingCount` field to an Option value (optional)
    pub fn maybe_following_count(mut self, value: Option<i64>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> ProfileDataViewBasicBuilder<St, S>
where
    St: profile_data_view_basic_state::State,
    St::Inner: profile_data_view_basic_state::IsUnset,
{
    /// Set the `inner` field (required)
    pub fn inner(
        mut self,
        value: impl Into<ProfileDataViewBasicInner<S>>,
    ) -> ProfileDataViewBasicBuilder<profile_data_view_basic_state::SetInner<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ProfileDataViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<
    St: profile_data_view_basic_state::State,
    S: BosStr,
> ProfileDataViewBasicBuilder<St, S> {
    /// Set the `viewer` field (optional)
    pub fn viewer(
        mut self,
        value: impl Into<Option<actor::ViewerStateBasic<S>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `viewer` field to an Option value (optional)
    pub fn maybe_viewer(mut self, value: Option<actor::ViewerStateBasic<S>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> ProfileDataViewBasicBuilder<St, S>
where
    St: profile_data_view_basic_state::State,
    St::Inner: profile_data_view_basic_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ProfileDataViewBasic<S> {
        ProfileDataViewBasic {
            follower_count: self._fields.0,
            following_count: self._fields.1,
            inner: self._fields.2.unwrap(),
            viewer: self._fields.3,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ProfileDataViewBasic<S> {
        ProfileDataViewBasic {
            follower_count: self._fields.0,
            following_count: self._fields.1,
            inner: self._fields.2.unwrap(),
            viewer: self._fields.3,
            extra_data: Some(extra_data),
        }
    }
}

pub mod profile_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Did;
        type Handle;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type Handle = Unset;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Did = Set<members::did>;
        type Handle = St::Handle;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetHandle<St> {}
    impl<St: State> State for SetHandle<St> {
        type Did = St::Did;
        type Handle = Set<members::handle>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `handle` field
        pub struct handle(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ProfileViewBuilder<St: profile_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<UriValue<S>>,
        Option<UriValue<S>>,
        Option<bool>,
        Option<Datetime>,
        Option<S>,
        Option<Did<S>>,
        Option<S>,
        Option<Handle<S>>,
        Option<Datetime>,
        Option<Vec<Label<S>>>,
        Option<Vec<UriValue<S>>>,
        Option<S>,
        Option<actor::PinnedList<S>>,
        Option<actor::PronounsList<S>>,
        Option<bool>,
        Option<i64>,
        Option<i64>,
        Option<bool>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ProfileView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ProfileViewBuilder<profile_view_state::Empty, S> {
        ProfileViewBuilder::builder()
    }
}

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

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

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

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

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

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `createdAt` field (optional)
    pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `createdAt` field to an Option value (optional)
    pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St, S: BosStr> ProfileViewBuilder<St, S>
where
    St: profile_view_state::State,
    St::Did: profile_view_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> ProfileViewBuilder<profile_view_state::SetDid<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ProfileViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ProfileViewBuilder<St, S>
where
    St: profile_view_state::State,
    St::Handle: profile_view_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<Handle<S>>,
    ) -> ProfileViewBuilder<profile_view_state::SetHandle<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ProfileViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `indexedAt` field (optional)
    pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `indexedAt` field to an Option value (optional)
    pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `labels` field to an Option value (optional)
    pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `links` field (optional)
    pub fn links(mut self, value: impl Into<Option<Vec<UriValue<S>>>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `links` field to an Option value (optional)
    pub fn maybe_links(mut self, value: Option<Vec<UriValue<S>>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `location` field (optional)
    pub fn location(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `location` field to an Option value (optional)
    pub fn maybe_location(mut self, value: Option<S>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `pinned` field (optional)
    pub fn pinned(mut self, value: impl Into<Option<actor::PinnedList<S>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `pinned` field to an Option value (optional)
    pub fn maybe_pinned(mut self, value: Option<actor::PinnedList<S>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(mut self, value: impl Into<Option<actor::PronounsList<S>>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `pronouns` field to an Option value (optional)
    pub fn maybe_pronouns(mut self, value: Option<actor::PronounsList<S>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `streamplace` field (optional)
    pub fn streamplace(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `streamplace` field to an Option value (optional)
    pub fn maybe_streamplace(mut self, value: Option<bool>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `subscribedCount` field (optional)
    pub fn subscribed_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `subscribedCount` field to an Option value (optional)
    pub fn maybe_subscribed_count(mut self, value: Option<i64>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `subscriberCount` field (optional)
    pub fn subscriber_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `subscriberCount` field to an Option value (optional)
    pub fn maybe_subscriber_count(mut self, value: Option<i64>) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<St: profile_view_state::State, S: BosStr> ProfileViewBuilder<St, S> {
    /// Set the `tangled` field (optional)
    pub fn tangled(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.17 = value.into();
        self
    }
    /// Set the `tangled` field to an Option value (optional)
    pub fn maybe_tangled(mut self, value: Option<bool>) -> Self {
        self._fields.17 = value;
        self
    }
}

impl<St, S: BosStr> ProfileViewBuilder<St, S>
where
    St: profile_view_state::State,
    St::Did: profile_view_state::IsSet,
    St::Handle: profile_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ProfileView<S> {
        ProfileView {
            avatar: self._fields.0,
            banner: self._fields.1,
            bluesky: self._fields.2,
            created_at: self._fields.3,
            description: self._fields.4,
            did: self._fields.5.unwrap(),
            display_name: self._fields.6,
            handle: self._fields.7.unwrap(),
            indexed_at: self._fields.8,
            labels: self._fields.9,
            links: self._fields.10,
            location: self._fields.11,
            pinned: self._fields.12,
            pronouns: self._fields.13,
            streamplace: self._fields.14,
            subscribed_count: self._fields.15,
            subscriber_count: self._fields.16,
            tangled: self._fields.17,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ProfileView<S> {
        ProfileView {
            avatar: self._fields.0,
            banner: self._fields.1,
            bluesky: self._fields.2,
            created_at: self._fields.3,
            description: self._fields.4,
            did: self._fields.5.unwrap(),
            display_name: self._fields.6,
            handle: self._fields.7.unwrap(),
            indexed_at: self._fields.8,
            labels: self._fields.9,
            links: self._fields.10,
            location: self._fields.11,
            pinned: self._fields.12,
            pronouns: self._fields.13,
            streamplace: self._fields.14,
            subscribed_count: self._fields.15,
            subscriber_count: self._fields.16,
            tangled: self._fields.17,
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct ProfileViewBasicBuilder<
    St: profile_view_basic_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<UriValue<S>>,
        Option<Datetime>,
        Option<Did<S>>,
        Option<S>,
        Option<Handle<S>>,
        Option<Datetime>,
        Option<Vec<Label<S>>>,
        Option<actor::PronounsList<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ProfileViewBasic<S> {
    /// Create a new builder for this type
    pub fn builder() -> ProfileViewBasicBuilder<profile_view_basic_state::Empty, S> {
        ProfileViewBasicBuilder::builder()
    }
}

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

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

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

impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
    /// Set the `createdAt` field (optional)
    pub fn created_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `createdAt` field to an Option value (optional)
    pub fn maybe_created_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
where
    St: profile_view_basic_state::State,
    St::Did: profile_view_basic_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> ProfileViewBasicBuilder<profile_view_basic_state::SetDid<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ProfileViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
where
    St: profile_view_basic_state::State,
    St::Handle: profile_view_basic_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<Handle<S>>,
    ) -> ProfileViewBasicBuilder<profile_view_basic_state::SetHandle<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ProfileViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
    /// Set the `indexedAt` field (optional)
    pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `indexedAt` field to an Option value (optional)
    pub fn maybe_indexed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<Vec<Label<S>>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `labels` field to an Option value (optional)
    pub fn maybe_labels(mut self, value: Option<Vec<Label<S>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: profile_view_basic_state::State, S: BosStr> ProfileViewBasicBuilder<St, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(mut self, value: impl Into<Option<actor::PronounsList<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `pronouns` field to an Option value (optional)
    pub fn maybe_pronouns(mut self, value: Option<actor::PronounsList<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> ProfileViewBasicBuilder<St, S>
where
    St: profile_view_basic_state::State,
    St::Did: profile_view_basic_state::IsSet,
    St::Handle: profile_view_basic_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ProfileViewBasic<S> {
        ProfileViewBasic {
            avatar: self._fields.0,
            created_at: self._fields.1,
            did: self._fields.2.unwrap(),
            display_name: self._fields.3,
            handle: self._fields.4.unwrap(),
            indexed_at: self._fields.5,
            labels: self._fields.6,
            pronouns: self._fields.7,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ProfileViewBasic<S> {
        ProfileViewBasic {
            avatar: self._fields.0,
            created_at: self._fields.1,
            did: self._fields.2.unwrap(),
            display_name: self._fields.3,
            handle: self._fields.4.unwrap(),
            indexed_at: self._fields.5,
            labels: self._fields.6,
            pronouns: self._fields.7,
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SubscribedNotebook<S> {
    /// Create a new builder for this type
    pub fn builder() -> SubscribedNotebookBuilder<subscribed_notebook_state::Empty, S> {
        SubscribedNotebookBuilder::builder()
    }
}

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

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

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

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

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

impl<St, S: BosStr> SubscribedNotebookBuilder<St, S>
where
    St: subscribed_notebook_state::State,
    St::Uri: subscribed_notebook_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SubscribedNotebook<S> {
        SubscribedNotebook {
            path: self._fields.0,
            title: self._fields.1,
            uri: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> SubscribedNotebook<S> {
        SubscribedNotebook {
            path: self._fields.0,
            title: self._fields.1,
            uri: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod tangled_profile_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Bluesky;
        type Did;
        type Handle;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Bluesky = Unset;
        type Did = Unset;
        type Handle = Unset;
    }
    ///State transition - sets the `bluesky` field to Set
    pub struct SetBluesky<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBluesky<St> {}
    impl<St: State> State for SetBluesky<St> {
        type Bluesky = Set<members::bluesky>;
        type Did = St::Did;
        type Handle = St::Handle;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Bluesky = St::Bluesky;
        type Did = Set<members::did>;
        type Handle = St::Handle;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetHandle<St> {}
    impl<St: State> State for SetHandle<St> {
        type Bluesky = St::Bluesky;
        type Did = St::Did;
        type Handle = Set<members::handle>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `bluesky` field
        pub struct bluesky(());
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `handle` field
        pub struct handle(());
    }
}

/// Builder for constructing an instance of this type.
pub struct TangledProfileViewBuilder<
    St: tangled_profile_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<bool>,
        Option<S>,
        Option<Did<S>>,
        Option<Handle<S>>,
        Option<Vec<UriValue<S>>>,
        Option<S>,
        Option<Vec<AtUri<S>>>,
        Option<Vec<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> TangledProfileView<S> {
    /// Create a new builder for this type
    pub fn builder() -> TangledProfileViewBuilder<tangled_profile_view_state::Empty, S> {
        TangledProfileViewBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> TangledProfileViewBuilder<St, S>
where
    St: tangled_profile_view_state::State,
    St::Did: tangled_profile_view_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> TangledProfileViewBuilder<tangled_profile_view_state::SetDid<St>, S> {
        self._fields.2 = Option::Some(value.into());
        TangledProfileViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> TangledProfileViewBuilder<St, S>
where
    St: tangled_profile_view_state::State,
    St::Handle: tangled_profile_view_state::IsUnset,
{
    /// Set the `handle` field (required)
    pub fn handle(
        mut self,
        value: impl Into<Handle<S>>,
    ) -> TangledProfileViewBuilder<tangled_profile_view_state::SetHandle<St>, S> {
        self._fields.3 = Option::Some(value.into());
        TangledProfileViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: tangled_profile_view_state::State, S: BosStr> TangledProfileViewBuilder<St, S> {
    /// Set the `links` field (optional)
    pub fn links(mut self, value: impl Into<Option<Vec<UriValue<S>>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `links` field to an Option value (optional)
    pub fn maybe_links(mut self, value: Option<Vec<UriValue<S>>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

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

impl<St: tangled_profile_view_state::State, S: BosStr> TangledProfileViewBuilder<St, S> {
    /// Set the `stats` field (optional)
    pub fn stats(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `stats` field to an Option value (optional)
    pub fn maybe_stats(mut self, value: Option<Vec<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> TangledProfileViewBuilder<St, S>
where
    St: tangled_profile_view_state::State,
    St::Bluesky: tangled_profile_view_state::IsSet,
    St::Did: tangled_profile_view_state::IsSet,
    St::Handle: tangled_profile_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> TangledProfileView<S> {
        TangledProfileView {
            bluesky: self._fields.0.unwrap(),
            description: self._fields.1,
            did: self._fields.2.unwrap(),
            handle: self._fields.3.unwrap(),
            links: self._fields.4,
            location: self._fields.5,
            pinned_repositories: self._fields.6,
            stats: self._fields.7,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> TangledProfileView<S> {
        TangledProfileView {
            bluesky: self._fields.0.unwrap(),
            description: self._fields.1,
            did: self._fields.2.unwrap(),
            handle: self._fields.3.unwrap(),
            links: self._fields.4,
            location: self._fields.5,
            pinned_repositories: self._fields.6,
            stats: self._fields.7,
            extra_data: Some(extra_data),
        }
    }
}