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

pub mod collection;
pub mod collection_item;
pub mod post;
pub mod reaction;
pub mod request;
pub mod request_response;
pub mod room_gate;


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

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

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

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::actor::ProfileViewBasic;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::tech_tokimeki::kaku;
/// Width and height representing the aspect ratio of an image

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct AspectRatio<'a> {
    ///Height component of aspect ratio
    pub height: i64,
    ///Width component of aspect ratio
    pub width: i64,
}

/// A view of a collection with author profile and item count

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CollectionView<'a> {
    ///Collection owner profile
    #[serde(borrow)]
    pub author: ProfileViewBasic<'a>,
    ///CID of the collection record
    #[serde(borrow)]
    pub cid: Cid<'a>,
    ///Timestamp when the collection was created
    pub created_at: Datetime,
    ///Collection description
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub description: Option<CowStr<'a>>,
    ///Timestamp when the collection was indexed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    ///Whether the collection is publicly visible  Defaults to `true`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_collection_view_is_public")]
    pub is_public: Option<bool>,
    ///Number of items in the collection
    #[serde(skip_serializing_if = "Option::is_none")]
    pub item_count: Option<i64>,
    ///Collection name
    #[serde(borrow)]
    pub name: CowStr<'a>,
    ///AT-URI of the collection record
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}

/// A view of a drawing post with author profile and metadata

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PostView<'a> {
    ///Aspect ratio of the image
    #[serde(borrow)]
    pub aspect_ratio: kaku::AspectRatio<'a>,
    ///Author profile
    #[serde(borrow)]
    pub author: ProfileViewBasic<'a>,
    ///CID of the post record
    #[serde(borrow)]
    pub cid: Cid<'a>,
    ///Timestamp when the post was created
    pub created_at: Datetime,
    ///URL of the drawing image
    #[serde(borrow)]
    pub image: UriValue<'a>,
    ///Timestamp when the post was indexed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    ///Reference to linked Bluesky post
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub linked_post: Option<StrongRef<'a>>,
    ///Counts of each reaction type
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub reaction_counts: Option<kaku::ReactionCounts<'a>>,
    ///Tags for categorization
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub tags: Option<Vec<CowStr<'a>>>,
    ///Optional description or title
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub text: Option<CowStr<'a>>,
    ///AT-URI of the post record
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    ///Current user's reaction to this post
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub viewer_reaction: Option<kaku::ReactionType<'a>>,
}

/// Counts of each reaction type on a post

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionCounts<'a> {
    ///Count of kami (godly) reactions  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_reaction_counts_kami")]
    pub kami: Option<i64>,
    ///Count of kawaii (cute) reactions  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_reaction_counts_kawaii")]
    pub kawaii: Option<i64>,
    ///Count of sugoi (amazing) reactions  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_reaction_counts_sugoi")]
    pub sugoi: Option<i64>,
    ///Count of suki (like) reactions  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_reaction_counts_suki")]
    pub suki: Option<i64>,
    ///Count of tasukaru (helpful) reactions  Defaults to `0`.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "_default_reaction_counts_tasukaru")]
    pub tasukaru: Option<i64>,
}

/// Type of reaction to a post

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReactionType<'a> {
    Suki,
    Tasukaru,
    Sugoi,
    Kawaii,
    Kami,
    Other(CowStr<'a>),
}

impl<'a> ReactionType<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Suki => "suki",
            Self::Tasukaru => "tasukaru",
            Self::Sugoi => "sugoi",
            Self::Kawaii => "kawaii",
            Self::Kami => "kami",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ReactionType<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "suki" => Self::Suki,
            "tasukaru" => Self::Tasukaru,
            "sugoi" => Self::Sugoi,
            "kawaii" => Self::Kawaii,
            "kami" => Self::Kami,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ReactionType<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "suki" => Self::Suki,
            "tasukaru" => Self::Tasukaru,
            "sugoi" => Self::Sugoi,
            "kawaii" => Self::Kawaii,
            "kami" => Self::Kami,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> AsRef<str> for ReactionType<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'a> serde::Serialize for ReactionType<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for ReactionType<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl jacquard_common::IntoStatic for ReactionType<'_> {
    type Output = ReactionType<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ReactionType::Suki => ReactionType::Suki,
            ReactionType::Tasukaru => ReactionType::Tasukaru,
            ReactionType::Sugoi => ReactionType::Sugoi,
            ReactionType::Kawaii => ReactionType::Kawaii,
            ReactionType::Kami => ReactionType::Kami,
            ReactionType::Other(v) => ReactionType::Other(v.into_static()),
        }
    }
}

/// A view of a Bluesky reply to a linked post

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReplyView<'a> {
    ///Reply author profile
    #[serde(borrow)]
    pub author: ProfileViewBasic<'a>,
    ///CID of the Bluesky reply
    #[serde(borrow)]
    pub cid: Cid<'a>,
    ///Timestamp when the reply was created
    pub created_at: Datetime,
    ///Reply text content
    #[serde(borrow)]
    pub text: CowStr<'a>,
    ///AT-URI of the Bluesky reply
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}

/// A view of a response to a drawing request

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RequestResponseView<'a> {
    ///Response author profile
    #[serde(borrow)]
    pub author: ProfileViewBasic<'a>,
    ///CID of the response record
    #[serde(borrow)]
    pub cid: Cid<'a>,
    ///Timestamp when the response was created
    pub created_at: Datetime,
    ///Optional message to the requester
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub message: Option<CowStr<'a>>,
    ///The drawing post submitted as response
    #[serde(borrow)]
    pub post: kaku::PostView<'a>,
    ///AT-URI of the response record
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}

/// A view of a drawing request with author profile and response count

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RequestView<'a> {
    ///Request author profile
    #[serde(borrow)]
    pub author: ProfileViewBasic<'a>,
    ///CID of the request record
    #[serde(borrow)]
    pub cid: Cid<'a>,
    ///Timestamp when the request was created
    pub created_at: Datetime,
    ///Timestamp when the request was indexed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub indexed_at: Option<Datetime>,
    ///Whether the request is still accepting responses
    pub is_open: bool,
    ///URLs of reference images for the request
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub reference_images: Option<Vec<UriValue<'a>>>,
    ///Number of responses to this request
    #[serde(skip_serializing_if = "Option::is_none")]
    pub response_count: Option<i64>,
    ///Tags for categorization
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub tags: Option<Vec<CowStr<'a>>>,
    ///Specific artist the request is directed to
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub target_actor: Option<ProfileViewBasic<'a>>,
    ///Description of what to draw
    #[serde(borrow)]
    pub text: CowStr<'a>,
    ///AT-URI of the request record
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}

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

impl<'a> LexiconSchema for CollectionView<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "collectionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.description {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 200usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("description"),
                        max: 200usize,
                        actual: count,
                    });
                }
            }
        }
        {
            let value = &self.name;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.name;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 50usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("name"),
                        max: 50usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for PostView<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "postView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.tags {
            #[allow(unused_comparisons)]
            if value.len() > 8usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("tags"),
                    max: 8usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.text {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.text {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 300usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 300usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for ReactionCounts<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "reactionCounts"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ReplyView<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "replyView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.text;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 3000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 3000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 300usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 300usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for RequestResponseView<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "requestResponseView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.message {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("message"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.message {
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 150usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("message"),
                        max: 150usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for RequestView<'a> {
    fn nsid() -> &'static str {
        "tech.tokimeki.kaku.defs"
    }
    fn def_name() -> &'static str {
        "requestView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tech_tokimeki_kaku_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.reference_images {
            #[allow(unused_comparisons)]
            if value.len() > 4usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("reference_images"),
                    max: 4usize,
                    actual: value.len(),
                });
            }
        }
        if let Some(ref value) = self.tags {
            #[allow(unused_comparisons)]
            if value.len() > 8usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("tags"),
                    max: 8usize,
                    actual: value.len(),
                });
            }
        }
        {
            let value = &self.text;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 1000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 1000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 300usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 300usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

pub mod aspect_ratio_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 Height;
        type Width;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Height = Unset;
        type Width = Unset;
    }
    ///State transition - sets the `height` field to Set
    pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHeight<S> {}
    impl<S: State> State for SetHeight<S> {
        type Height = Set<members::height>;
        type Width = S::Width;
    }
    ///State transition - sets the `width` field to Set
    pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetWidth<S> {}
    impl<S: State> State for SetWidth<S> {
        type Height = S::Height;
        type Width = Set<members::width>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `height` field
        pub struct height(());
        ///Marker type for the `width` field
        pub struct width(());
    }
}

/// Builder for constructing an instance of this type
pub struct AspectRatioBuilder<'a, S: aspect_ratio_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<i64>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> AspectRatio<'a> {
    /// Create a new builder for this type
    pub fn new() -> AspectRatioBuilder<'a, aspect_ratio_state::Empty> {
        AspectRatioBuilder::new()
    }
}

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

impl<'a, S> AspectRatioBuilder<'a, S>
where
    S: aspect_ratio_state::State,
    S::Height: aspect_ratio_state::IsUnset,
{
    /// Set the `height` field (required)
    pub fn height(
        mut self,
        value: impl Into<i64>,
    ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetHeight<S>> {
        self._fields.0 = Option::Some(value.into());
        AspectRatioBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> AspectRatioBuilder<'a, S>
where
    S: aspect_ratio_state::State,
    S::Width: aspect_ratio_state::IsUnset,
{
    /// Set the `width` field (required)
    pub fn width(
        mut self,
        value: impl Into<i64>,
    ) -> AspectRatioBuilder<'a, aspect_ratio_state::SetWidth<S>> {
        self._fields.1 = Option::Some(value.into());
        AspectRatioBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> AspectRatioBuilder<'a, S>
where
    S: aspect_ratio_state::State,
    S::Height: aspect_ratio_state::IsSet,
    S::Width: aspect_ratio_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> AspectRatio<'a> {
        AspectRatio {
            height: self._fields.0.unwrap(),
            width: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> AspectRatio<'a> {
        AspectRatio {
            height: self._fields.0.unwrap(),
            width: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_tech_tokimeki_kaku_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("tech.tokimeki.kaku.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("aspectRatio"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Width and height representing the aspect ratio of an image",
                        ),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("width"), SmolStr::new_static("height")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("height"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("width"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(1i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("collectionView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A view of a collection with author profile and item count",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("name"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CID of the collection record"),
                                ),
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp when the collection was created",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Collection description"),
                                ),
                                max_length: Some(500usize),
                                max_graphemes: Some(200usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp when the collection was indexed",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("isPublic"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("itemCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Collection name")),
                                max_length: Some(100usize),
                                max_graphemes: Some(50usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("AT-URI of the collection record"),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("postView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A view of a drawing post with author profile and metadata",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("image"),
                            SmolStr::new_static("aspectRatio"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("aspectRatio"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#aspectRatio"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CID of the post record"),
                                ),
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp when the post was created"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("image"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("URL of the drawing image"),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp when the post was indexed"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("linkedPost"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reactionCounts"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionCounts"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Tags for categorization"),
                                ),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(64usize),
                                    max_graphemes: Some(32usize),
                                    ..Default::default()
                                }),
                                max_length: Some(8usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Optional description or title"),
                                ),
                                max_length: Some(1000usize),
                                max_graphemes: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("AT-URI of the post record"),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("viewerReaction"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionType"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionCounts"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Counts of each reaction type on a post"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("kami"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("kawaii"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sugoi"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("suki"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tasukaru"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionType"),
                LexUserType::String(LexString {
                    description: Some(CowStr::new_static("Type of reaction to a post")),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("replyView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A view of a Bluesky reply to a linked post"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("text"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CID of the Bluesky reply"),
                                ),
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp when the reply was created"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Reply text content")),
                                max_length: Some(3000usize),
                                max_graphemes: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("AT-URI of the Bluesky reply"),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("requestResponseView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A view of a response to a drawing request"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("post"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CID of the response record"),
                                ),
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp when the response was created",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Optional message to the requester"),
                                ),
                                max_length: Some(500usize),
                                max_graphemes: Some(150usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("post"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#postView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("AT-URI of the response record"),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("requestView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A view of a drawing request with author profile and response count",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("author"), SmolStr::new_static("text"),
                            SmolStr::new_static("isOpen"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("CID of the request record"),
                                ),
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp when the request was created"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp when the request was indexed"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("isOpen"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("referenceImages"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "URLs of reference images for the request",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Uri),
                                    ..Default::default()
                                }),
                                max_length: Some(4usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("responseCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Tags for categorization"),
                                ),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(64usize),
                                    max_graphemes: Some(32usize),
                                    ..Default::default()
                                }),
                                max_length: Some(8usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("targetActor"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Description of what to draw"),
                                ),
                                max_length: Some(1000usize),
                                max_graphemes: Some(300usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("AT-URI of the request record"),
                                ),
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

fn _default_collection_view_is_public() -> Option<bool> {
    Some(true)
}

pub mod collection_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Name;
        type Uri;
        type Cid;
        type Author;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Name = Unset;
        type Uri = Unset;
        type Cid = Unset;
        type Author = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetName<S> {}
    impl<S: State> State for SetName<S> {
        type Name = Set<members::name>;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Author = S::Author;
        type CreatedAt = S::CreatedAt;
    }
    ///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 Name = S::Name;
        type Uri = Set<members::uri>;
        type Cid = S::Cid;
        type Author = S::Author;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type Name = S::Name;
        type Uri = S::Uri;
        type Cid = Set<members::cid>;
        type Author = S::Author;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAuthor<S> {}
    impl<S: State> State for SetAuthor<S> {
        type Name = S::Name;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Author = Set<members::author>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Name = S::Name;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Author = S::Author;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct CollectionViewBuilder<'a, S: collection_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ProfileViewBasic<'a>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<bool>,
        Option<i64>,
        Option<CowStr<'a>>,
        Option<AtUri<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
    /// Set the `indexedAt` field (optional)
    pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.4 = 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.4 = value;
        self
    }
}

impl<'a, S: collection_view_state::State> CollectionViewBuilder<'a, S> {
    /// Set the `isPublic` field (optional)
    pub fn is_public(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `isPublic` field to an Option value (optional)
    pub fn maybe_is_public(mut self, value: Option<bool>) -> Self {
        self._fields.5 = value;
        self
    }
}

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

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

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

impl<'a, S> CollectionViewBuilder<'a, S>
where
    S: collection_view_state::State,
    S::Name: collection_view_state::IsSet,
    S::Uri: collection_view_state::IsSet,
    S::Cid: collection_view_state::IsSet,
    S::Author: collection_view_state::IsSet,
    S::CreatedAt: collection_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> CollectionView<'a> {
        CollectionView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            description: self._fields.3,
            indexed_at: self._fields.4,
            is_public: self._fields.5.or_else(|| Some(true)),
            item_count: self._fields.6,
            name: self._fields.7.unwrap(),
            uri: self._fields.8.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> CollectionView<'a> {
        CollectionView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            description: self._fields.3,
            indexed_at: self._fields.4,
            is_public: self._fields.5.or_else(|| Some(true)),
            item_count: self._fields.6,
            name: self._fields.7.unwrap(),
            uri: self._fields.8.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod post_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 Image;
        type Author;
        type Cid;
        type AspectRatio;
        type Uri;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Image = Unset;
        type Author = Unset;
        type Cid = Unset;
        type AspectRatio = Unset;
        type Uri = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `image` field to Set
    pub struct SetImage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetImage<S> {}
    impl<S: State> State for SetImage<S> {
        type Image = Set<members::image>;
        type Author = S::Author;
        type Cid = S::Cid;
        type AspectRatio = S::AspectRatio;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAuthor<S> {}
    impl<S: State> State for SetAuthor<S> {
        type Image = S::Image;
        type Author = Set<members::author>;
        type Cid = S::Cid;
        type AspectRatio = S::AspectRatio;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type Image = S::Image;
        type Author = S::Author;
        type Cid = Set<members::cid>;
        type AspectRatio = S::AspectRatio;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `aspect_ratio` field to Set
    pub struct SetAspectRatio<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAspectRatio<S> {}
    impl<S: State> State for SetAspectRatio<S> {
        type Image = S::Image;
        type Author = S::Author;
        type Cid = S::Cid;
        type AspectRatio = Set<members::aspect_ratio>;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
    }
    ///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 Image = S::Image;
        type Author = S::Author;
        type Cid = S::Cid;
        type AspectRatio = S::AspectRatio;
        type Uri = Set<members::uri>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Image = S::Image;
        type Author = S::Author;
        type Cid = S::Cid;
        type AspectRatio = S::AspectRatio;
        type Uri = S::Uri;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `image` field
        pub struct image(());
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `aspect_ratio` field
        pub struct aspect_ratio(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct PostViewBuilder<'a, S: post_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<kaku::AspectRatio<'a>>,
        Option<ProfileViewBasic<'a>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<UriValue<'a>>,
        Option<Datetime>,
        Option<StrongRef<'a>>,
        Option<kaku::ReactionCounts<'a>>,
        Option<Vec<CowStr<'a>>>,
        Option<CowStr<'a>>,
        Option<AtUri<'a>>,
        Option<kaku::ReactionType<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> PostView<'a> {
    /// Create a new builder for this type
    pub fn new() -> PostViewBuilder<'a, post_view_state::Empty> {
        PostViewBuilder::new()
    }
}

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

impl<'a, S> PostViewBuilder<'a, S>
where
    S: post_view_state::State,
    S::AspectRatio: post_view_state::IsUnset,
{
    /// Set the `aspectRatio` field (required)
    pub fn aspect_ratio(
        mut self,
        value: impl Into<kaku::AspectRatio<'a>>,
    ) -> PostViewBuilder<'a, post_view_state::SetAspectRatio<S>> {
        self._fields.0 = Option::Some(value.into());
        PostViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PostViewBuilder<'a, S>
where
    S: post_view_state::State,
    S::Author: post_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<ProfileViewBasic<'a>>,
    ) -> PostViewBuilder<'a, post_view_state::SetAuthor<S>> {
        self._fields.1 = Option::Some(value.into());
        PostViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PostViewBuilder<'a, S>
where
    S: post_view_state::State,
    S::Cid: post_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<'a>>,
    ) -> PostViewBuilder<'a, post_view_state::SetCid<S>> {
        self._fields.2 = Option::Some(value.into());
        PostViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> PostViewBuilder<'a, S>
where
    S: post_view_state::State,
    S::Image: post_view_state::IsUnset,
{
    /// Set the `image` field (required)
    pub fn image(
        mut self,
        value: impl Into<UriValue<'a>>,
    ) -> PostViewBuilder<'a, post_view_state::SetImage<S>> {
        self._fields.4 = Option::Some(value.into());
        PostViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: post_view_state::State> PostViewBuilder<'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: post_view_state::State> PostViewBuilder<'a, S> {
    /// Set the `linkedPost` field (optional)
    pub fn linked_post(mut self, value: impl Into<Option<StrongRef<'a>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `linkedPost` field to an Option value (optional)
    pub fn maybe_linked_post(mut self, value: Option<StrongRef<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
    /// Set the `reactionCounts` field (optional)
    pub fn reaction_counts(
        mut self,
        value: impl Into<Option<kaku::ReactionCounts<'a>>>,
    ) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `reactionCounts` field to an Option value (optional)
    pub fn maybe_reaction_counts(
        mut self,
        value: Option<kaku::ReactionCounts<'a>>,
    ) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
    /// Set the `text` field (optional)
    pub fn text(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `text` field to an Option value (optional)
    pub fn maybe_text(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.9 = value;
        self
    }
}

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

impl<'a, S: post_view_state::State> PostViewBuilder<'a, S> {
    /// Set the `viewerReaction` field (optional)
    pub fn viewer_reaction(
        mut self,
        value: impl Into<Option<kaku::ReactionType<'a>>>,
    ) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `viewerReaction` field to an Option value (optional)
    pub fn maybe_viewer_reaction(
        mut self,
        value: Option<kaku::ReactionType<'a>>,
    ) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S> PostViewBuilder<'a, S>
where
    S: post_view_state::State,
    S::Image: post_view_state::IsSet,
    S::Author: post_view_state::IsSet,
    S::Cid: post_view_state::IsSet,
    S::AspectRatio: post_view_state::IsSet,
    S::Uri: post_view_state::IsSet,
    S::CreatedAt: post_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> PostView<'a> {
        PostView {
            aspect_ratio: self._fields.0.unwrap(),
            author: self._fields.1.unwrap(),
            cid: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            image: self._fields.4.unwrap(),
            indexed_at: self._fields.5,
            linked_post: self._fields.6,
            reaction_counts: self._fields.7,
            tags: self._fields.8,
            text: self._fields.9,
            uri: self._fields.10.unwrap(),
            viewer_reaction: self._fields.11,
            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>,
        >,
    ) -> PostView<'a> {
        PostView {
            aspect_ratio: self._fields.0.unwrap(),
            author: self._fields.1.unwrap(),
            cid: self._fields.2.unwrap(),
            created_at: self._fields.3.unwrap(),
            image: self._fields.4.unwrap(),
            indexed_at: self._fields.5,
            linked_post: self._fields.6,
            reaction_counts: self._fields.7,
            tags: self._fields.8,
            text: self._fields.9,
            uri: self._fields.10.unwrap(),
            viewer_reaction: self._fields.11,
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

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

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

impl Default for ReactionCounts<'_> {
    fn default() -> Self {
        Self {
            kami: Some(0i64),
            kawaii: Some(0i64),
            sugoi: Some(0i64),
            suki: Some(0i64),
            tasukaru: Some(0i64),
            extra_data: Default::default(),
        }
    }
}

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

/// Builder for constructing an instance of this type
pub struct ReplyViewBuilder<'a, S: reply_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ProfileViewBasic<'a>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<AtUri<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ReplyView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReplyViewBuilder<'a, reply_view_state::Empty> {
        ReplyViewBuilder::new()
    }
}

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

impl<'a, S> ReplyViewBuilder<'a, S>
where
    S: reply_view_state::State,
    S::Author: reply_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<ProfileViewBasic<'a>>,
    ) -> ReplyViewBuilder<'a, reply_view_state::SetAuthor<S>> {
        self._fields.0 = Option::Some(value.into());
        ReplyViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReplyViewBuilder<'a, S>
where
    S: reply_view_state::State,
    S::Cid: reply_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<'a>>,
    ) -> ReplyViewBuilder<'a, reply_view_state::SetCid<S>> {
        self._fields.1 = Option::Some(value.into());
        ReplyViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> ReplyViewBuilder<'a, S>
where
    S: reply_view_state::State,
    S::Text: reply_view_state::IsUnset,
{
    /// Set the `text` field (required)
    pub fn text(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ReplyViewBuilder<'a, reply_view_state::SetText<S>> {
        self._fields.3 = Option::Some(value.into());
        ReplyViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> ReplyViewBuilder<'a, S>
where
    S: reply_view_state::State,
    S::CreatedAt: reply_view_state::IsSet,
    S::Cid: reply_view_state::IsSet,
    S::Uri: reply_view_state::IsSet,
    S::Author: reply_view_state::IsSet,
    S::Text: reply_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ReplyView<'a> {
        ReplyView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            text: self._fields.3.unwrap(),
            uri: self._fields.4.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ReplyView<'a> {
        ReplyView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            text: self._fields.3.unwrap(),
            uri: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type
pub struct RequestResponseViewBuilder<'a, S: request_response_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ProfileViewBasic<'a>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<kaku::PostView<'a>>,
        Option<AtUri<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> RequestResponseView<'a> {
    /// Create a new builder for this type
    pub fn new() -> RequestResponseViewBuilder<'a, request_response_view_state::Empty> {
        RequestResponseViewBuilder::new()
    }
}

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

impl<'a, S> RequestResponseViewBuilder<'a, S>
where
    S: request_response_view_state::State,
    S::Author: request_response_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<ProfileViewBasic<'a>>,
    ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetAuthor<S>> {
        self._fields.0 = Option::Some(value.into());
        RequestResponseViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> RequestResponseViewBuilder<'a, S>
where
    S: request_response_view_state::State,
    S::Cid: request_response_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<'a>>,
    ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetCid<S>> {
        self._fields.1 = Option::Some(value.into());
        RequestResponseViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

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

impl<'a, S> RequestResponseViewBuilder<'a, S>
where
    S: request_response_view_state::State,
    S::Post: request_response_view_state::IsUnset,
{
    /// Set the `post` field (required)
    pub fn post(
        mut self,
        value: impl Into<kaku::PostView<'a>>,
    ) -> RequestResponseViewBuilder<'a, request_response_view_state::SetPost<S>> {
        self._fields.4 = Option::Some(value.into());
        RequestResponseViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> RequestResponseViewBuilder<'a, S>
where
    S: request_response_view_state::State,
    S::CreatedAt: request_response_view_state::IsSet,
    S::Post: request_response_view_state::IsSet,
    S::Uri: request_response_view_state::IsSet,
    S::Cid: request_response_view_state::IsSet,
    S::Author: request_response_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RequestResponseView<'a> {
        RequestResponseView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            message: self._fields.3,
            post: self._fields.4.unwrap(),
            uri: self._fields.5.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>,
        >,
    ) -> RequestResponseView<'a> {
        RequestResponseView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            message: self._fields.3,
            post: self._fields.4.unwrap(),
            uri: self._fields.5.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod request_view_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Author;
        type Uri;
        type IsOpen;
        type CreatedAt;
        type Text;
        type Cid;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Uri = Unset;
        type IsOpen = Unset;
        type CreatedAt = Unset;
        type Text = Unset;
        type Cid = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAuthor<S> {}
    impl<S: State> State for SetAuthor<S> {
        type Author = Set<members::author>;
        type Uri = S::Uri;
        type IsOpen = S::IsOpen;
        type CreatedAt = S::CreatedAt;
        type Text = S::Text;
        type Cid = S::Cid;
    }
    ///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 Author = S::Author;
        type Uri = Set<members::uri>;
        type IsOpen = S::IsOpen;
        type CreatedAt = S::CreatedAt;
        type Text = S::Text;
        type Cid = S::Cid;
    }
    ///State transition - sets the `is_open` field to Set
    pub struct SetIsOpen<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetIsOpen<S> {}
    impl<S: State> State for SetIsOpen<S> {
        type Author = S::Author;
        type Uri = S::Uri;
        type IsOpen = Set<members::is_open>;
        type CreatedAt = S::CreatedAt;
        type Text = S::Text;
        type Cid = S::Cid;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Author = S::Author;
        type Uri = S::Uri;
        type IsOpen = S::IsOpen;
        type CreatedAt = Set<members::created_at>;
        type Text = S::Text;
        type Cid = S::Cid;
    }
    ///State transition - sets the `text` field to Set
    pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetText<S> {}
    impl<S: State> State for SetText<S> {
        type Author = S::Author;
        type Uri = S::Uri;
        type IsOpen = S::IsOpen;
        type CreatedAt = S::CreatedAt;
        type Text = Set<members::text>;
        type Cid = S::Cid;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type Author = S::Author;
        type Uri = S::Uri;
        type IsOpen = S::IsOpen;
        type CreatedAt = S::CreatedAt;
        type Text = S::Text;
        type Cid = Set<members::cid>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `is_open` field
        pub struct is_open(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `text` field
        pub struct text(());
        ///Marker type for the `cid` field
        pub struct cid(());
    }
}

/// Builder for constructing an instance of this type
pub struct RequestViewBuilder<'a, S: request_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ProfileViewBasic<'a>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<Datetime>,
        Option<bool>,
        Option<Vec<UriValue<'a>>>,
        Option<i64>,
        Option<Vec<CowStr<'a>>>,
        Option<ProfileViewBasic<'a>>,
        Option<CowStr<'a>>,
        Option<AtUri<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> RequestView<'a> {
    /// Create a new builder for this type
    pub fn new() -> RequestViewBuilder<'a, request_view_state::Empty> {
        RequestViewBuilder::new()
    }
}

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

impl<'a, S> RequestViewBuilder<'a, S>
where
    S: request_view_state::State,
    S::Author: request_view_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<ProfileViewBasic<'a>>,
    ) -> RequestViewBuilder<'a, request_view_state::SetAuthor<S>> {
        self._fields.0 = Option::Some(value.into());
        RequestViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> RequestViewBuilder<'a, S>
where
    S: request_view_state::State,
    S::Cid: request_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<'a>>,
    ) -> RequestViewBuilder<'a, request_view_state::SetCid<S>> {
        self._fields.1 = Option::Some(value.into());
        RequestViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
    /// Set the `indexedAt` field (optional)
    pub fn indexed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.3 = 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.3 = value;
        self
    }
}

impl<'a, S> RequestViewBuilder<'a, S>
where
    S: request_view_state::State,
    S::IsOpen: request_view_state::IsUnset,
{
    /// Set the `isOpen` field (required)
    pub fn is_open(
        mut self,
        value: impl Into<bool>,
    ) -> RequestViewBuilder<'a, request_view_state::SetIsOpen<S>> {
        self._fields.4 = Option::Some(value.into());
        RequestViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
    /// Set the `referenceImages` field (optional)
    pub fn reference_images(
        mut self,
        value: impl Into<Option<Vec<UriValue<'a>>>>,
    ) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `referenceImages` field to an Option value (optional)
    pub fn maybe_reference_images(mut self, value: Option<Vec<UriValue<'a>>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
    /// Set the `responseCount` field (optional)
    pub fn response_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `responseCount` field to an Option value (optional)
    pub fn maybe_response_count(mut self, value: Option<i64>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
    /// Set the `targetActor` field (optional)
    pub fn target_actor(
        mut self,
        value: impl Into<Option<ProfileViewBasic<'a>>>,
    ) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `targetActor` field to an Option value (optional)
    pub fn maybe_target_actor(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<'a, S> RequestViewBuilder<'a, S>
where
    S: request_view_state::State,
    S::Text: request_view_state::IsUnset,
{
    /// Set the `text` field (required)
    pub fn text(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> RequestViewBuilder<'a, request_view_state::SetText<S>> {
        self._fields.9 = Option::Some(value.into());
        RequestViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> RequestViewBuilder<'a, S>
where
    S: request_view_state::State,
    S::Author: request_view_state::IsSet,
    S::Uri: request_view_state::IsSet,
    S::IsOpen: request_view_state::IsSet,
    S::CreatedAt: request_view_state::IsSet,
    S::Text: request_view_state::IsSet,
    S::Cid: request_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RequestView<'a> {
        RequestView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            indexed_at: self._fields.3,
            is_open: self._fields.4.unwrap(),
            reference_images: self._fields.5,
            response_count: self._fields.6,
            tags: self._fields.7,
            target_actor: self._fields.8,
            text: self._fields.9.unwrap(),
            uri: self._fields.10.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>,
        >,
    ) -> RequestView<'a> {
        RequestView {
            author: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            created_at: self._fields.2.unwrap(),
            indexed_at: self._fields.3,
            is_open: self._fields.4.unwrap(),
            reference_images: self._fields.5,
            response_count: self._fields.6,
            tags: self._fields.7,
            target_actor: self._fields.8,
            text: self._fields.9.unwrap(),
            uri: self._fields.10.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}