// @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.

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;
use jacquard_common::deps::bytes::Bytes;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Did, Handle, AtUri, Datetime, UriValue};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::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.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Author<'a> {
    #[serde(borrow)]
    pub did: Did<'a>,
    ///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>,
}

pub type PinnedList<'a> = Vec<StrongRef<'a>>;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ProfileDataView<'a> {
    #[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>,
    #[serde(borrow)]
    pub inner: ProfileDataViewInner<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notebook_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub viewer: Option<actor::ViewerState<'a>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ProfileDataViewInner<'a> {
    #[serde(rename = "sh.weaver.actor.defs#profileView")]
    ProfileView(Box<actor::ProfileView<'a>>),
    #[serde(rename = "app.bsky.actor.defs#profileViewDetailed")]
    ProfileViewDetailed(Box<ProfileViewDetailed<'a>>),
    #[serde(rename = "sh.weaver.actor.defs#tangledProfileView")]
    TangledProfileView(Box<actor::TangledProfileView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ProfileDataViewBasic<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub follower_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub following_count: Option<i64>,
    #[serde(borrow)]
    pub inner: ProfileDataViewBasicInner<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub viewer: Option<actor::ViewerStateBasic<'a>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ProfileDataViewBasicInner<'a> {
    #[serde(rename = "sh.weaver.actor.defs#profileViewBasic")]
    ProfileViewBasic(Box<crate::sh_weaver::actor::ProfileViewBasic<'a>>),
    #[serde(rename = "app.bsky.actor.defs#profileViewBasic")]
    BskyProfileViewBasic(Box<crate::app_bsky::actor::ProfileViewBasic<'a>>),
    #[serde(rename = "sh.weaver.actor.defs#tangledProfileView")]
    TangledProfileView(Box<actor::TangledProfileView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ProfileView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub avatar: Option<UriValue<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub banner: Option<UriValue<'a>>,
    ///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")]
    #[serde(borrow)]
    pub description: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub display_name: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub handle: Handle<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub labels: Option<Vec<Label<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub links: Option<Vec<UriValue<'a>>>,
    ///Free-form location text.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub location: Option<CowStr<'a>>,
    ///Notebooks or other records pinned for display.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub pinned: Option<actor::PinnedList<'a>>,
    ///Pronouns to use in user-generated content.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub pronouns: Option<actor::PronounsList<'a>>,
    ///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>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ProfileViewBasic<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub avatar: Option<UriValue<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub display_name: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub handle: Handle<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub labels: Option<Vec<Label<'a>>>,
    ///Pronouns to use in user-generated content.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub pronouns: Option<actor::PronounsList<'a>>,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SubscribedNotebook<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub path: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub title: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}


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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ViewerState<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub blocked: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked_by: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub follow_requested: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub follow_requested_by: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub followed_by: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub following: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub muted: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subscribed_notebooks: Option<Vec<actor::SubscribedNotebook<'a>>>,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ViewerStateBasic<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub blocked: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blocked_by: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub follow_requested: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub follow_requested_by: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub followed_by: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub following: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub muted: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subscribed_notebook_count: Option<i64>,
}

impl<'a> LexiconSchema for Author<'a> {
    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<'a> LexiconSchema for ProfileDataView<'a> {
    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<'a> LexiconSchema for ProfileDataViewBasic<'a> {
    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<'a> LexiconSchema for ProfileView<'a> {
    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<'a> LexiconSchema for ProfileViewBasic<'a> {
    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<'a> LexiconSchema for SubscribedNotebook<'a> {
    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<'a> LexiconSchema for TangledProfileView<'a> {
    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<'a> LexiconSchema for ViewerState<'a> {
    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<'a> LexiconSchema for ViewerStateBasic<'a> {
    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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        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<'a, S: author_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<Did<'a>>, Option<Bytes>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

impl<'a, S: author_state::State> AuthorBuilder<'a, 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<'a, S> AuthorBuilder<'a, S>
where
    S: author_state::State,
    S::Did: author_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Author<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Author<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetInner<S> {}
    impl<S: State> State for SetInner<S> {
        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<'a, S: profile_data_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<i64>,
        Option<ProfileDataViewInner<'a>>,
        Option<i64>,
        Option<actor::ViewerState<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

impl<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, 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<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, 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<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, 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<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, 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<'a, S> ProfileDataViewBuilder<'a, S>
where
    S: profile_data_view_state::State,
    S::Inner: profile_data_view_state::IsUnset,
{
    /// Set the `inner` field (required)
    pub fn inner(
        mut self,
        value: impl Into<ProfileDataViewInner<'a>>,
    ) -> ProfileDataViewBuilder<'a, profile_data_view_state::SetInner<S>> {
        self._fields.4 = Option::Some(value.into());
        ProfileDataViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, 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<'a, S: profile_data_view_state::State> ProfileDataViewBuilder<'a, S> {
    /// Set the `viewer` field (optional)
    pub fn viewer(mut self, value: impl Into<Option<actor::ViewerState<'a>>>) -> 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<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S> ProfileDataViewBuilder<'a, S>
where
    S: profile_data_view_state::State,
    S::Inner: profile_data_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ProfileDataView<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ProfileDataView<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetInner<S> {}
    impl<S: State> State for SetInner<S> {
        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<'a, S: profile_data_view_basic_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<i64>,
        Option<i64>,
        Option<ProfileDataViewBasicInner<'a>>,
        Option<actor::ViewerStateBasic<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

impl<'a, S: profile_data_view_basic_state::State> ProfileDataViewBasicBuilder<'a, 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<'a, S: profile_data_view_basic_state::State> ProfileDataViewBasicBuilder<'a, 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<'a, S> ProfileDataViewBasicBuilder<'a, S>
where
    S: profile_data_view_basic_state::State,
    S::Inner: profile_data_view_basic_state::IsUnset,
{
    /// Set the `inner` field (required)
    pub fn inner(
        mut self,
        value: impl Into<ProfileDataViewBasicInner<'a>>,
    ) -> ProfileDataViewBasicBuilder<'a, profile_data_view_basic_state::SetInner<S>> {
        self._fields.2 = Option::Some(value.into());
        ProfileDataViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_data_view_basic_state::State> ProfileDataViewBasicBuilder<'a, S> {
    /// Set the `viewer` field (optional)
    pub fn viewer(
        mut self,
        value: impl Into<Option<actor::ViewerStateBasic<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S> ProfileDataViewBasicBuilder<'a, S>
where
    S: profile_data_view_basic_state::State,
    S::Inner: profile_data_view_basic_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ProfileDataViewBasic<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ProfileDataViewBasic<'a> {
        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 Handle;
        type Did;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Handle = Unset;
        type Did = Unset;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHandle<S> {}
    impl<S: State> State for SetHandle<S> {
        type Handle = Set<members::handle>;
        type Did = S::Did;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Handle = S::Handle;
        type Did = Set<members::did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `handle` field
        pub struct handle(());
        ///Marker type for the `did` field
        pub struct did(());
    }
}

/// Builder for constructing an instance of this type
pub struct ProfileViewBuilder<'a, S: profile_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<UriValue<'a>>,
        Option<UriValue<'a>>,
        Option<bool>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<Handle<'a>>,
        Option<Datetime>,
        Option<Vec<Label<'a>>>,
        Option<Vec<UriValue<'a>>>,
        Option<CowStr<'a>>,
        Option<actor::PinnedList<'a>>,
        Option<actor::PronounsList<'a>>,
        Option<bool>,
        Option<i64>,
        Option<i64>,
        Option<bool>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

impl<'a> ProfileViewBuilder<'a, profile_view_state::Empty> {
    /// Create a new builder with all fields unset
    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,
            ),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `avatar` field (optional)
    pub fn avatar(mut self, value: impl Into<Option<UriValue<'a>>>) -> 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<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `banner` field (optional)
    pub fn banner(mut self, value: impl Into<Option<UriValue<'a>>>) -> 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<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `description` field (optional)
    pub fn description(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `description` field to an Option value (optional)
    pub fn maybe_description(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `displayName` field (optional)
    pub fn display_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> 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<CowStr<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

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

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<Vec<Label<'a>>>>) -> 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<'a>>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `links` field (optional)
    pub fn links(mut self, value: impl Into<Option<Vec<UriValue<'a>>>>) -> 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<'a>>>) -> Self {
        self._fields.10 = value;
        self
    }
}

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

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `pinned` field (optional)
    pub fn pinned(mut self, value: impl Into<Option<actor::PinnedList<'a>>>) -> 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<'a>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(
        mut self,
        value: impl Into<Option<actor::PronounsList<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S: profile_view_state::State> ProfileViewBuilder<'a, 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<'a, S> ProfileViewBuilder<'a, S>
where
    S: profile_view_state::State,
    S::Handle: profile_view_state::IsSet,
    S::Did: profile_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ProfileView<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ProfileView<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Did = Set<members::did>;
        type Handle = S::Handle;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHandle<S> {}
    impl<S: State> State for SetHandle<S> {
        type Did = S::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<'a, S: profile_view_basic_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<UriValue<'a>>,
        Option<Datetime>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<Handle<'a>>,
        Option<Datetime>,
        Option<Vec<Label<'a>>>,
        Option<actor::PronounsList<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> {
    /// Set the `avatar` field (optional)
    pub fn avatar(mut self, value: impl Into<Option<UriValue<'a>>>) -> 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<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, 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<'a, S> ProfileViewBasicBuilder<'a, S>
where
    S: profile_view_basic_state::State,
    S::Did: profile_view_basic_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<'a>>,
    ) -> ProfileViewBasicBuilder<'a, profile_view_basic_state::SetDid<S>> {
        self._fields.2 = Option::Some(value.into());
        ProfileViewBasicBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> {
    /// Set the `displayName` field (optional)
    pub fn display_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> 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<CowStr<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, 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<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> {
    /// Set the `labels` field (optional)
    pub fn labels(mut self, value: impl Into<Option<Vec<Label<'a>>>>) -> 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<'a>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: profile_view_basic_state::State> ProfileViewBasicBuilder<'a, S> {
    /// Set the `pronouns` field (optional)
    pub fn pronouns(
        mut self,
        value: impl Into<Option<actor::PronounsList<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S> ProfileViewBasicBuilder<'a, S>
where
    S: profile_view_basic_state::State,
    S::Did: profile_view_basic_state::IsSet,
    S::Handle: profile_view_basic_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ProfileViewBasic<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ProfileViewBasic<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        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<'a, S: subscribed_notebook_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<AtUri<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

impl<'a, S> SubscribedNotebookBuilder<'a, S>
where
    S: subscribed_notebook_state::State,
    S::Uri: subscribed_notebook_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> SubscribedNotebook<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> SubscribedNotebook<'a> {
        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 Did;
        type Handle;
        type Bluesky;
    }
    /// 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;
        type Bluesky = Unset;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Did = Set<members::did>;
        type Handle = S::Handle;
        type Bluesky = S::Bluesky;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHandle<S> {}
    impl<S: State> State for SetHandle<S> {
        type Did = S::Did;
        type Handle = Set<members::handle>;
        type Bluesky = S::Bluesky;
    }
    ///State transition - sets the `bluesky` field to Set
    pub struct SetBluesky<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetBluesky<S> {}
    impl<S: State> State for SetBluesky<S> {
        type Did = S::Did;
        type Handle = S::Handle;
        type Bluesky = Set<members::bluesky>;
    }
    /// 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(());
        ///Marker type for the `bluesky` field
        pub struct bluesky(());
    }
}

/// Builder for constructing an instance of this type
pub struct TangledProfileViewBuilder<'a, S: tangled_profile_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<bool>,
        Option<CowStr<'a>>,
        Option<Did<'a>>,
        Option<Handle<'a>>,
        Option<Vec<UriValue<'a>>>,
        Option<CowStr<'a>>,
        Option<Vec<AtUri<'a>>>,
        Option<Vec<CowStr<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

impl<'a, S: tangled_profile_view_state::State> TangledProfileViewBuilder<'a, S> {
    /// Set the `links` field (optional)
    pub fn links(mut self, value: impl Into<Option<Vec<UriValue<'a>>>>) -> 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<'a>>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

impl<'a, S: tangled_profile_view_state::State> TangledProfileViewBuilder<'a, S> {
    /// Set the `pinnedRepositories` field (optional)
    pub fn pinned_repositories(
        mut self,
        value: impl Into<Option<Vec<AtUri<'a>>>>,
    ) -> 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<'a>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: tangled_profile_view_state::State> TangledProfileViewBuilder<'a, S> {
    /// Set the `stats` field (optional)
    pub fn stats(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> 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<CowStr<'a>>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S> TangledProfileViewBuilder<'a, S>
where
    S: tangled_profile_view_state::State,
    S::Did: tangled_profile_view_state::IsSet,
    S::Handle: tangled_profile_view_state::IsSet,
    S::Bluesky: tangled_profile_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> TangledProfileView<'a> {
        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<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> TangledProfileView<'a> {
        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),
        }
    }
}