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

pub mod accept_convo;
pub mod add_reaction;
pub mod delete_message_for_self;
pub mod get_convo;
pub mod get_convo_availability;
pub mod get_convo_for_members;
pub mod get_log;
pub mod get_messages;
pub mod leave_convo;
pub mod list_convos;
pub mod mute_convo;
pub mod remove_reaction;
pub mod send_message;
pub mod send_message_batch;
pub mod unmute_convo;
pub mod update_all_read;
pub mod update_read;


#[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::{Did, Datetime};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::embed::record::Record;
use crate::app_bsky::embed::record::View;
use crate::app_bsky::richtext::facet::Facet;
use crate::chat_bsky::actor::ProfileViewBasic;
use crate::chat_bsky::convo;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ConvoView<'a> {
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub last_message: Option<ConvoViewLastMessage<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub last_reaction: Option<convo::MessageAndReactionView<'a>>,
    #[serde(borrow)]
    pub members: Vec<ProfileViewBasic<'a>>,
    pub muted: bool,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<ConvoViewStatus<'a>>,
    pub unread_count: i64,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ConvoViewLastMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConvoViewStatus<'a> {
    Request,
    Accepted,
    Other(CowStr<'a>),
}

impl<'a> ConvoViewStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Request => "request",
            Self::Accepted => "accepted",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ConvoViewStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "request" => Self::Request,
            "accepted" => Self::Accepted,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ConvoViewStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "request" => Self::Request,
            "accepted" => Self::Accepted,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

impl<'a> serde::Serialize for ConvoViewStatus<'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 ConvoViewStatus<'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<'a> Default for ConvoViewStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ConvoViewStatus<'_> {
    type Output = ConvoViewStatus<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ConvoViewStatus::Request => ConvoViewStatus::Request,
            ConvoViewStatus::Accepted => ConvoViewStatus::Accepted,
            ConvoViewStatus::Other(v) => ConvoViewStatus::Other(v.into_static()),
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DeletedMessageView<'a> {
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
    #[serde(borrow)]
    pub sender: convo::MessageViewSender<'a>,
    pub sent_at: Datetime,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LogAcceptConvo<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LogAddReaction<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub message: LogAddReactionMessage<'a>,
    #[serde(borrow)]
    pub reaction: convo::ReactionView<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum LogAddReactionMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LogBeginConvo<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LogCreateMessage<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub message: LogCreateMessageMessage<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum LogCreateMessageMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LogDeleteMessage<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub message: LogDeleteMessageMessage<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum LogDeleteMessageMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LogLeaveConvo<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LogMuteConvo<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LogReadMessage<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub message: LogReadMessageMessage<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum LogReadMessageMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LogRemoveReaction<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub message: LogRemoveReactionMessage<'a>,
    #[serde(borrow)]
    pub reaction: convo::ReactionView<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum LogRemoveReactionMessage<'a> {
    #[serde(rename = "chat.bsky.convo.defs#messageView")]
    MessageView(Box<convo::MessageView<'a>>),
    #[serde(rename = "chat.bsky.convo.defs#deletedMessageView")]
    DeletedMessageView(Box<convo::DeletedMessageView<'a>>),
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct LogUnmuteConvo<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct MessageAndReactionView<'a> {
    #[serde(borrow)]
    pub message: convo::MessageView<'a>,
    #[serde(borrow)]
    pub reaction: convo::ReactionView<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct MessageInput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub embed: Option<Record<'a>>,
    ///Annotations of text (mentions, URLs, hashtags, etc)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub facets: Option<Vec<Facet<'a>>>,
    #[serde(borrow)]
    pub text: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct MessageRef<'a> {
    #[serde(borrow)]
    pub convo_id: CowStr<'a>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(borrow)]
    pub message_id: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct MessageView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub embed: Option<View<'a>>,
    ///Annotations of text (mentions, URLs, hashtags, etc)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub facets: Option<Vec<Facet<'a>>>,
    #[serde(borrow)]
    pub id: CowStr<'a>,
    ///Reactions to this message, in ascending order of creation time.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub reactions: Option<Vec<convo::ReactionView<'a>>>,
    #[serde(borrow)]
    pub rev: CowStr<'a>,
    #[serde(borrow)]
    pub sender: convo::MessageViewSender<'a>,
    pub sent_at: Datetime,
    #[serde(borrow)]
    pub text: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct MessageViewSender<'a> {
    #[serde(borrow)]
    pub did: Did<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionView<'a> {
    pub created_at: Datetime,
    #[serde(borrow)]
    pub sender: convo::ReactionViewSender<'a>,
    #[serde(borrow)]
    pub value: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReactionViewSender<'a> {
    #[serde(borrow)]
    pub did: Did<'a>,
}

impl<'a> LexiconSchema for ConvoView<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "convoView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for DeletedMessageView<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "deletedMessageView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogAcceptConvo<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logAcceptConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogAddReaction<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logAddReaction"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogBeginConvo<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logBeginConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogCreateMessage<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logCreateMessage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogDeleteMessage<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logDeleteMessage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogLeaveConvo<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logLeaveConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogMuteConvo<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logMuteConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogReadMessage<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logReadMessage"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogRemoveReaction<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logRemoveReaction"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for LogUnmuteConvo<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logUnmuteConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for MessageAndReactionView<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "messageAndReactionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for MessageInput<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "messageInput"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.text;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 10000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 1000usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 1000usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for MessageRef<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "messageRef"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for MessageView<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "messageView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.text;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10000usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("text"),
                    max: 10000usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.text;
            {
                let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
                if count > 1000usize {
                    return Err(ConstraintError::MaxGraphemes {
                        path: ValidationPath::from_field("text"),
                        max: 1000usize,
                        actual: count,
                    });
                }
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for MessageViewSender<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "messageViewSender"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ReactionView<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "reactionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ReactionViewSender<'a> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "reactionViewSender"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod convo_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 Rev;
        type Muted;
        type UnreadCount;
        type Members;
        type Id;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Rev = Unset;
        type Muted = Unset;
        type UnreadCount = Unset;
        type Members = Unset;
        type Id = Unset;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type Rev = Set<members::rev>;
        type Muted = S::Muted;
        type UnreadCount = S::UnreadCount;
        type Members = S::Members;
        type Id = S::Id;
    }
    ///State transition - sets the `muted` field to Set
    pub struct SetMuted<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMuted<S> {}
    impl<S: State> State for SetMuted<S> {
        type Rev = S::Rev;
        type Muted = Set<members::muted>;
        type UnreadCount = S::UnreadCount;
        type Members = S::Members;
        type Id = S::Id;
    }
    ///State transition - sets the `unread_count` field to Set
    pub struct SetUnreadCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUnreadCount<S> {}
    impl<S: State> State for SetUnreadCount<S> {
        type Rev = S::Rev;
        type Muted = S::Muted;
        type UnreadCount = Set<members::unread_count>;
        type Members = S::Members;
        type Id = S::Id;
    }
    ///State transition - sets the `members` field to Set
    pub struct SetMembers<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMembers<S> {}
    impl<S: State> State for SetMembers<S> {
        type Rev = S::Rev;
        type Muted = S::Muted;
        type UnreadCount = S::UnreadCount;
        type Members = Set<members::members>;
        type Id = S::Id;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Rev = S::Rev;
        type Muted = S::Muted;
        type UnreadCount = S::UnreadCount;
        type Members = S::Members;
        type Id = Set<members::id>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `rev` field
        pub struct rev(());
        ///Marker type for the `muted` field
        pub struct muted(());
        ///Marker type for the `unread_count` field
        pub struct unread_count(());
        ///Marker type for the `members` field
        pub struct members(());
        ///Marker type for the `id` field
        pub struct id(());
    }
}

/// Builder for constructing an instance of this type
pub struct ConvoViewBuilder<'a, S: convo_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<ConvoViewLastMessage<'a>>,
        Option<convo::MessageAndReactionView<'a>>,
        Option<Vec<ProfileViewBasic<'a>>>,
        Option<bool>,
        Option<CowStr<'a>>,
        Option<ConvoViewStatus<'a>>,
        Option<i64>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ConvoView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ConvoViewBuilder<'a, convo_view_state::Empty> {
        ConvoViewBuilder::new()
    }
}

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

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::Id: convo_view_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ConvoViewBuilder<'a, convo_view_state::SetId<S>> {
        self._fields.0 = Option::Some(value.into());
        ConvoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: convo_view_state::State> ConvoViewBuilder<'a, S> {
    /// Set the `lastMessage` field (optional)
    pub fn last_message(
        mut self,
        value: impl Into<Option<ConvoViewLastMessage<'a>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `lastMessage` field to an Option value (optional)
    pub fn maybe_last_message(
        mut self,
        value: Option<ConvoViewLastMessage<'a>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: convo_view_state::State> ConvoViewBuilder<'a, S> {
    /// Set the `lastReaction` field (optional)
    pub fn last_reaction(
        mut self,
        value: impl Into<Option<convo::MessageAndReactionView<'a>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `lastReaction` field to an Option value (optional)
    pub fn maybe_last_reaction(
        mut self,
        value: Option<convo::MessageAndReactionView<'a>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::Members: convo_view_state::IsUnset,
{
    /// Set the `members` field (required)
    pub fn members(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<'a>>>,
    ) -> ConvoViewBuilder<'a, convo_view_state::SetMembers<S>> {
        self._fields.3 = Option::Some(value.into());
        ConvoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::Muted: convo_view_state::IsUnset,
{
    /// Set the `muted` field (required)
    pub fn muted(
        mut self,
        value: impl Into<bool>,
    ) -> ConvoViewBuilder<'a, convo_view_state::SetMuted<S>> {
        self._fields.4 = Option::Some(value.into());
        ConvoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::Rev: convo_view_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ConvoViewBuilder<'a, convo_view_state::SetRev<S>> {
        self._fields.5 = Option::Some(value.into());
        ConvoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: convo_view_state::State> ConvoViewBuilder<'a, S> {
    /// Set the `status` field (optional)
    pub fn status(mut self, value: impl Into<Option<ConvoViewStatus<'a>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `status` field to an Option value (optional)
    pub fn maybe_status(mut self, value: Option<ConvoViewStatus<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::UnreadCount: convo_view_state::IsUnset,
{
    /// Set the `unreadCount` field (required)
    pub fn unread_count(
        mut self,
        value: impl Into<i64>,
    ) -> ConvoViewBuilder<'a, convo_view_state::SetUnreadCount<S>> {
        self._fields.7 = Option::Some(value.into());
        ConvoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ConvoViewBuilder<'a, S>
where
    S: convo_view_state::State,
    S::Rev: convo_view_state::IsSet,
    S::Muted: convo_view_state::IsSet,
    S::UnreadCount: convo_view_state::IsSet,
    S::Members: convo_view_state::IsSet,
    S::Id: convo_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ConvoView<'a> {
        ConvoView {
            id: self._fields.0.unwrap(),
            last_message: self._fields.1,
            last_reaction: self._fields.2,
            members: self._fields.3.unwrap(),
            muted: self._fields.4.unwrap(),
            rev: self._fields.5.unwrap(),
            status: self._fields.6,
            unread_count: self._fields.7.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ConvoView<'a> {
        ConvoView {
            id: self._fields.0.unwrap(),
            last_message: self._fields.1,
            last_reaction: self._fields.2,
            members: self._fields.3.unwrap(),
            muted: self._fields.4.unwrap(),
            rev: self._fields.5.unwrap(),
            status: self._fields.6,
            unread_count: self._fields.7.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_chat_bsky_convo_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("chat.bsky.convo.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("convoView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("rev"),
                            SmolStr::new_static("members"), SmolStr::new_static("muted"),
                            SmolStr::new_static("unreadCount")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("lastMessage"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastReaction"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![CowStr::new_static("#messageAndReactionView")],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("members"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muted"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("unreadCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("deletedMessageView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("rev"),
                            SmolStr::new_static("sender"), SmolStr::new_static("sentAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("sender"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#messageViewSender"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sentAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logAcceptConvo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("rev"), SmolStr::new_static("convoId")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logAddReaction"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("reaction")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reaction"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logBeginConvo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("rev"), SmolStr::new_static("convoId")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logCreateMessage"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logDeleteMessage"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logLeaveConvo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("rev"), SmolStr::new_static("convoId")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logMuteConvo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("rev"), SmolStr::new_static("convoId")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logReadMessage"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logRemoveReaction"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("reaction")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reaction"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logUnmuteConvo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("rev"), SmolStr::new_static("convoId")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("messageAndReactionView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("message"),
                            SmolStr::new_static("reaction")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#messageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reaction"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionView"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("messageInput"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("text")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("embed"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![CowStr::new_static("app.bsky.embed.record")],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("facets"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Annotations of text (mentions, URLs, hashtags, etc)",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("app.bsky.richtext.facet"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10000usize),
                                max_graphemes: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("messageRef"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("did"), SmolStr::new_static("messageId"),
                            SmolStr::new_static("convoId")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("convoId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("messageId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("messageView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("rev"),
                            SmolStr::new_static("text"), SmolStr::new_static("sender"),
                            SmolStr::new_static("sentAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("embed"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("app.bsky.embed.record#view")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("facets"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Annotations of text (mentions, URLs, hashtags, etc)",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("app.bsky.richtext.facet"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("reactions"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Reactions to this message, in ascending order of creation time.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#reactionView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("sender"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#messageViewSender"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sentAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("text"),
                            LexObjectProperty::String(LexString {
                                max_length: Some(10000usize),
                                max_graphemes: Some(1000usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("messageViewSender"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("did")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("value"), SmolStr::new_static("sender"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("sender"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reactionViewSender"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reactionViewSender"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("did")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod deleted_message_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 SentAt;
        type Id;
        type Sender;
        type Rev;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type SentAt = Unset;
        type Id = Unset;
        type Sender = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `sent_at` field to Set
    pub struct SetSentAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSentAt<S> {}
    impl<S: State> State for SetSentAt<S> {
        type SentAt = Set<members::sent_at>;
        type Id = S::Id;
        type Sender = S::Sender;
        type Rev = S::Rev;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type SentAt = S::SentAt;
        type Id = Set<members::id>;
        type Sender = S::Sender;
        type Rev = S::Rev;
    }
    ///State transition - sets the `sender` field to Set
    pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSender<S> {}
    impl<S: State> State for SetSender<S> {
        type SentAt = S::SentAt;
        type Id = S::Id;
        type Sender = Set<members::sender>;
        type Rev = S::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type SentAt = S::SentAt;
        type Id = S::Id;
        type Sender = S::Sender;
        type Rev = Set<members::rev>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `sent_at` field
        pub struct sent_at(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `sender` field
        pub struct sender(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type
pub struct DeletedMessageViewBuilder<'a, S: deleted_message_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<convo::MessageViewSender<'a>>,
        Option<Datetime>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> DeletedMessageView<'a> {
    /// Create a new builder for this type
    pub fn new() -> DeletedMessageViewBuilder<'a, deleted_message_view_state::Empty> {
        DeletedMessageViewBuilder::new()
    }
}

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

impl<'a, S> DeletedMessageViewBuilder<'a, S>
where
    S: deleted_message_view_state::State,
    S::Id: deleted_message_view_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> DeletedMessageViewBuilder<'a, deleted_message_view_state::SetId<S>> {
        self._fields.0 = Option::Some(value.into());
        DeletedMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> DeletedMessageViewBuilder<'a, S>
where
    S: deleted_message_view_state::State,
    S::Rev: deleted_message_view_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> DeletedMessageViewBuilder<'a, deleted_message_view_state::SetRev<S>> {
        self._fields.1 = Option::Some(value.into());
        DeletedMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> DeletedMessageViewBuilder<'a, S>
where
    S: deleted_message_view_state::State,
    S::Sender: deleted_message_view_state::IsUnset,
{
    /// Set the `sender` field (required)
    pub fn sender(
        mut self,
        value: impl Into<convo::MessageViewSender<'a>>,
    ) -> DeletedMessageViewBuilder<'a, deleted_message_view_state::SetSender<S>> {
        self._fields.2 = Option::Some(value.into());
        DeletedMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> DeletedMessageViewBuilder<'a, S>
where
    S: deleted_message_view_state::State,
    S::SentAt: deleted_message_view_state::IsUnset,
{
    /// Set the `sentAt` field (required)
    pub fn sent_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> DeletedMessageViewBuilder<'a, deleted_message_view_state::SetSentAt<S>> {
        self._fields.3 = Option::Some(value.into());
        DeletedMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> DeletedMessageViewBuilder<'a, S>
where
    S: deleted_message_view_state::State,
    S::SentAt: deleted_message_view_state::IsSet,
    S::Id: deleted_message_view_state::IsSet,
    S::Sender: deleted_message_view_state::IsSet,
    S::Rev: deleted_message_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> DeletedMessageView<'a> {
        DeletedMessageView {
            id: self._fields.0.unwrap(),
            rev: self._fields.1.unwrap(),
            sender: self._fields.2.unwrap(),
            sent_at: self._fields.3.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>,
        >,
    ) -> DeletedMessageView<'a> {
        DeletedMessageView {
            id: self._fields.0.unwrap(),
            rev: self._fields.1.unwrap(),
            sender: self._fields.2.unwrap(),
            sent_at: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_add_reaction_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 ConvoId;
        type Rev;
        type Message;
        type Reaction;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ConvoId = Unset;
        type Rev = Unset;
        type Message = Unset;
        type Reaction = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetConvoId<S> {}
    impl<S: State> State for SetConvoId<S> {
        type ConvoId = Set<members::convo_id>;
        type Rev = S::Rev;
        type Message = S::Message;
        type Reaction = S::Reaction;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type ConvoId = S::ConvoId;
        type Rev = Set<members::rev>;
        type Message = S::Message;
        type Reaction = S::Reaction;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type ConvoId = S::ConvoId;
        type Rev = S::Rev;
        type Message = Set<members::message>;
        type Reaction = S::Reaction;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReaction<S> {}
    impl<S: State> State for SetReaction<S> {
        type ConvoId = S::ConvoId;
        type Rev = S::Rev;
        type Message = S::Message;
        type Reaction = Set<members::reaction>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `convo_id` field
        pub struct convo_id(());
        ///Marker type for the `rev` field
        pub struct rev(());
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `reaction` field
        pub struct reaction(());
    }
}

/// Builder for constructing an instance of this type
pub struct LogAddReactionBuilder<'a, S: log_add_reaction_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<LogAddReactionMessage<'a>>,
        Option<convo::ReactionView<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> LogAddReaction<'a> {
    /// Create a new builder for this type
    pub fn new() -> LogAddReactionBuilder<'a, log_add_reaction_state::Empty> {
        LogAddReactionBuilder::new()
    }
}

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

impl<'a, S> LogAddReactionBuilder<'a, S>
where
    S: log_add_reaction_state::State,
    S::ConvoId: log_add_reaction_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogAddReactionBuilder<'a, log_add_reaction_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        LogAddReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogAddReactionBuilder<'a, S>
where
    S: log_add_reaction_state::State,
    S::Message: log_add_reaction_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogAddReactionMessage<'a>>,
    ) -> LogAddReactionBuilder<'a, log_add_reaction_state::SetMessage<S>> {
        self._fields.1 = Option::Some(value.into());
        LogAddReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogAddReactionBuilder<'a, S>
where
    S: log_add_reaction_state::State,
    S::Reaction: log_add_reaction_state::IsUnset,
{
    /// Set the `reaction` field (required)
    pub fn reaction(
        mut self,
        value: impl Into<convo::ReactionView<'a>>,
    ) -> LogAddReactionBuilder<'a, log_add_reaction_state::SetReaction<S>> {
        self._fields.2 = Option::Some(value.into());
        LogAddReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> LogAddReactionBuilder<'a, S>
where
    S: log_add_reaction_state::State,
    S::ConvoId: log_add_reaction_state::IsSet,
    S::Rev: log_add_reaction_state::IsSet,
    S::Message: log_add_reaction_state::IsSet,
    S::Reaction: log_add_reaction_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> LogAddReaction<'a> {
        LogAddReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            rev: self._fields.3.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>,
        >,
    ) -> LogAddReaction<'a> {
        LogAddReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_create_message_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 Rev;
        type Message;
        type ConvoId;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Rev = Unset;
        type Message = Unset;
        type ConvoId = Unset;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type Rev = Set<members::rev>;
        type Message = S::Message;
        type ConvoId = S::ConvoId;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type Rev = S::Rev;
        type Message = Set<members::message>;
        type ConvoId = S::ConvoId;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetConvoId<S> {}
    impl<S: State> State for SetConvoId<S> {
        type Rev = S::Rev;
        type Message = S::Message;
        type ConvoId = Set<members::convo_id>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `rev` field
        pub struct rev(());
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `convo_id` field
        pub struct convo_id(());
    }
}

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

impl<'a> LogCreateMessage<'a> {
    /// Create a new builder for this type
    pub fn new() -> LogCreateMessageBuilder<'a, log_create_message_state::Empty> {
        LogCreateMessageBuilder::new()
    }
}

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

impl<'a, S> LogCreateMessageBuilder<'a, S>
where
    S: log_create_message_state::State,
    S::ConvoId: log_create_message_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogCreateMessageBuilder<'a, log_create_message_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        LogCreateMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogCreateMessageBuilder<'a, S>
where
    S: log_create_message_state::State,
    S::Message: log_create_message_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogCreateMessageMessage<'a>>,
    ) -> LogCreateMessageBuilder<'a, log_create_message_state::SetMessage<S>> {
        self._fields.1 = Option::Some(value.into());
        LogCreateMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogCreateMessageBuilder<'a, S>
where
    S: log_create_message_state::State,
    S::Rev: log_create_message_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogCreateMessageBuilder<'a, log_create_message_state::SetRev<S>> {
        self._fields.2 = Option::Some(value.into());
        LogCreateMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogCreateMessageBuilder<'a, S>
where
    S: log_create_message_state::State,
    S::Rev: log_create_message_state::IsSet,
    S::Message: log_create_message_state::IsSet,
    S::ConvoId: log_create_message_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> LogCreateMessage<'a> {
        LogCreateMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> LogCreateMessage<'a> {
        LogCreateMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_delete_message_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 ConvoId;
        type Message;
        type Rev;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ConvoId = Unset;
        type Message = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetConvoId<S> {}
    impl<S: State> State for SetConvoId<S> {
        type ConvoId = Set<members::convo_id>;
        type Message = S::Message;
        type Rev = S::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type ConvoId = S::ConvoId;
        type Message = Set<members::message>;
        type Rev = S::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type ConvoId = S::ConvoId;
        type Message = S::Message;
        type Rev = Set<members::rev>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `convo_id` field
        pub struct convo_id(());
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

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

impl<'a> LogDeleteMessage<'a> {
    /// Create a new builder for this type
    pub fn new() -> LogDeleteMessageBuilder<'a, log_delete_message_state::Empty> {
        LogDeleteMessageBuilder::new()
    }
}

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

impl<'a, S> LogDeleteMessageBuilder<'a, S>
where
    S: log_delete_message_state::State,
    S::ConvoId: log_delete_message_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogDeleteMessageBuilder<'a, log_delete_message_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        LogDeleteMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogDeleteMessageBuilder<'a, S>
where
    S: log_delete_message_state::State,
    S::Message: log_delete_message_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogDeleteMessageMessage<'a>>,
    ) -> LogDeleteMessageBuilder<'a, log_delete_message_state::SetMessage<S>> {
        self._fields.1 = Option::Some(value.into());
        LogDeleteMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogDeleteMessageBuilder<'a, S>
where
    S: log_delete_message_state::State,
    S::Rev: log_delete_message_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogDeleteMessageBuilder<'a, log_delete_message_state::SetRev<S>> {
        self._fields.2 = Option::Some(value.into());
        LogDeleteMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogDeleteMessageBuilder<'a, S>
where
    S: log_delete_message_state::State,
    S::ConvoId: log_delete_message_state::IsSet,
    S::Message: log_delete_message_state::IsSet,
    S::Rev: log_delete_message_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> LogDeleteMessage<'a> {
        LogDeleteMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> LogDeleteMessage<'a> {
        LogDeleteMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_read_message_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 Message;
        type Rev;
        type ConvoId;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Message = Unset;
        type Rev = Unset;
        type ConvoId = Unset;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type Message = Set<members::message>;
        type Rev = S::Rev;
        type ConvoId = S::ConvoId;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type Message = S::Message;
        type Rev = Set<members::rev>;
        type ConvoId = S::ConvoId;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetConvoId<S> {}
    impl<S: State> State for SetConvoId<S> {
        type Message = S::Message;
        type Rev = S::Rev;
        type ConvoId = Set<members::convo_id>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `rev` field
        pub struct rev(());
        ///Marker type for the `convo_id` field
        pub struct convo_id(());
    }
}

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

impl<'a> LogReadMessage<'a> {
    /// Create a new builder for this type
    pub fn new() -> LogReadMessageBuilder<'a, log_read_message_state::Empty> {
        LogReadMessageBuilder::new()
    }
}

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

impl<'a, S> LogReadMessageBuilder<'a, S>
where
    S: log_read_message_state::State,
    S::ConvoId: log_read_message_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogReadMessageBuilder<'a, log_read_message_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        LogReadMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogReadMessageBuilder<'a, S>
where
    S: log_read_message_state::State,
    S::Message: log_read_message_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogReadMessageMessage<'a>>,
    ) -> LogReadMessageBuilder<'a, log_read_message_state::SetMessage<S>> {
        self._fields.1 = Option::Some(value.into());
        LogReadMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogReadMessageBuilder<'a, S>
where
    S: log_read_message_state::State,
    S::Rev: log_read_message_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogReadMessageBuilder<'a, log_read_message_state::SetRev<S>> {
        self._fields.2 = Option::Some(value.into());
        LogReadMessageBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogReadMessageBuilder<'a, S>
where
    S: log_read_message_state::State,
    S::Message: log_read_message_state::IsSet,
    S::Rev: log_read_message_state::IsSet,
    S::ConvoId: log_read_message_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> LogReadMessage<'a> {
        LogReadMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> LogReadMessage<'a> {
        LogReadMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_remove_reaction_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 Reaction;
        type Message;
        type ConvoId;
        type Rev;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Reaction = Unset;
        type Message = Unset;
        type ConvoId = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReaction<S> {}
    impl<S: State> State for SetReaction<S> {
        type Reaction = Set<members::reaction>;
        type Message = S::Message;
        type ConvoId = S::ConvoId;
        type Rev = S::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type Reaction = S::Reaction;
        type Message = Set<members::message>;
        type ConvoId = S::ConvoId;
        type Rev = S::Rev;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetConvoId<S> {}
    impl<S: State> State for SetConvoId<S> {
        type Reaction = S::Reaction;
        type Message = S::Message;
        type ConvoId = Set<members::convo_id>;
        type Rev = S::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type Reaction = S::Reaction;
        type Message = S::Message;
        type ConvoId = S::ConvoId;
        type Rev = Set<members::rev>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `reaction` field
        pub struct reaction(());
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `convo_id` field
        pub struct convo_id(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type
pub struct LogRemoveReactionBuilder<'a, S: log_remove_reaction_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<LogRemoveReactionMessage<'a>>,
        Option<convo::ReactionView<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> LogRemoveReaction<'a> {
    /// Create a new builder for this type
    pub fn new() -> LogRemoveReactionBuilder<'a, log_remove_reaction_state::Empty> {
        LogRemoveReactionBuilder::new()
    }
}

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

impl<'a, S> LogRemoveReactionBuilder<'a, S>
where
    S: log_remove_reaction_state::State,
    S::ConvoId: log_remove_reaction_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> LogRemoveReactionBuilder<'a, log_remove_reaction_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        LogRemoveReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogRemoveReactionBuilder<'a, S>
where
    S: log_remove_reaction_state::State,
    S::Message: log_remove_reaction_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogRemoveReactionMessage<'a>>,
    ) -> LogRemoveReactionBuilder<'a, log_remove_reaction_state::SetMessage<S>> {
        self._fields.1 = Option::Some(value.into());
        LogRemoveReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> LogRemoveReactionBuilder<'a, S>
where
    S: log_remove_reaction_state::State,
    S::Reaction: log_remove_reaction_state::IsUnset,
{
    /// Set the `reaction` field (required)
    pub fn reaction(
        mut self,
        value: impl Into<convo::ReactionView<'a>>,
    ) -> LogRemoveReactionBuilder<'a, log_remove_reaction_state::SetReaction<S>> {
        self._fields.2 = Option::Some(value.into());
        LogRemoveReactionBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> LogRemoveReactionBuilder<'a, S>
where
    S: log_remove_reaction_state::State,
    S::Reaction: log_remove_reaction_state::IsSet,
    S::Message: log_remove_reaction_state::IsSet,
    S::ConvoId: log_remove_reaction_state::IsSet,
    S::Rev: log_remove_reaction_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> LogRemoveReaction<'a> {
        LogRemoveReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            rev: self._fields.3.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>,
        >,
    ) -> LogRemoveReaction<'a> {
        LogRemoveReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod message_and_reaction_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 Message;
        type Reaction;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Message = Unset;
        type Reaction = Unset;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMessage<S> {}
    impl<S: State> State for SetMessage<S> {
        type Message = Set<members::message>;
        type Reaction = S::Reaction;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReaction<S> {}
    impl<S: State> State for SetReaction<S> {
        type Message = S::Message;
        type Reaction = Set<members::reaction>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `reaction` field
        pub struct reaction(());
    }
}

/// Builder for constructing an instance of this type
pub struct MessageAndReactionViewBuilder<'a, S: message_and_reaction_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<convo::MessageView<'a>>, Option<convo::ReactionView<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> MessageAndReactionView<'a> {
    /// Create a new builder for this type
    pub fn new() -> MessageAndReactionViewBuilder<
        'a,
        message_and_reaction_view_state::Empty,
    > {
        MessageAndReactionViewBuilder::new()
    }
}

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

impl<'a, S> MessageAndReactionViewBuilder<'a, S>
where
    S: message_and_reaction_view_state::State,
    S::Message: message_and_reaction_view_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::MessageView<'a>>,
    ) -> MessageAndReactionViewBuilder<
        'a,
        message_and_reaction_view_state::SetMessage<S>,
    > {
        self._fields.0 = Option::Some(value.into());
        MessageAndReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> MessageAndReactionViewBuilder<'a, S>
where
    S: message_and_reaction_view_state::State,
    S::Reaction: message_and_reaction_view_state::IsUnset,
{
    /// Set the `reaction` field (required)
    pub fn reaction(
        mut self,
        value: impl Into<convo::ReactionView<'a>>,
    ) -> MessageAndReactionViewBuilder<
        'a,
        message_and_reaction_view_state::SetReaction<S>,
    > {
        self._fields.1 = Option::Some(value.into());
        MessageAndReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> MessageAndReactionViewBuilder<'a, S>
where
    S: message_and_reaction_view_state::State,
    S::Message: message_and_reaction_view_state::IsSet,
    S::Reaction: message_and_reaction_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> MessageAndReactionView<'a> {
        MessageAndReactionView {
            message: self._fields.0.unwrap(),
            reaction: 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>,
        >,
    ) -> MessageAndReactionView<'a> {
        MessageAndReactionView {
            message: self._fields.0.unwrap(),
            reaction: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod message_ref_state {

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

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

impl<'a> MessageRef<'a> {
    /// Create a new builder for this type
    pub fn new() -> MessageRefBuilder<'a, message_ref_state::Empty> {
        MessageRefBuilder::new()
    }
}

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

impl<'a, S> MessageRefBuilder<'a, S>
where
    S: message_ref_state::State,
    S::ConvoId: message_ref_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> MessageRefBuilder<'a, message_ref_state::SetConvoId<S>> {
        self._fields.0 = Option::Some(value.into());
        MessageRefBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> MessageRefBuilder<'a, S>
where
    S: message_ref_state::State,
    S::MessageId: message_ref_state::IsUnset,
{
    /// Set the `messageId` field (required)
    pub fn message_id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> MessageRefBuilder<'a, message_ref_state::SetMessageId<S>> {
        self._fields.2 = Option::Some(value.into());
        MessageRefBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> MessageRefBuilder<'a, S>
where
    S: message_ref_state::State,
    S::Did: message_ref_state::IsSet,
    S::MessageId: message_ref_state::IsSet,
    S::ConvoId: message_ref_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> MessageRef<'a> {
        MessageRef {
            convo_id: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            message_id: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> MessageRef<'a> {
        MessageRef {
            convo_id: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            message_id: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod message_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 Id;
        type SentAt;
        type Rev;
        type Text;
        type Sender;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type SentAt = Unset;
        type Rev = Unset;
        type Text = Unset;
        type Sender = Unset;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Id = Set<members::id>;
        type SentAt = S::SentAt;
        type Rev = S::Rev;
        type Text = S::Text;
        type Sender = S::Sender;
    }
    ///State transition - sets the `sent_at` field to Set
    pub struct SetSentAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSentAt<S> {}
    impl<S: State> State for SetSentAt<S> {
        type Id = S::Id;
        type SentAt = Set<members::sent_at>;
        type Rev = S::Rev;
        type Text = S::Text;
        type Sender = S::Sender;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRev<S> {}
    impl<S: State> State for SetRev<S> {
        type Id = S::Id;
        type SentAt = S::SentAt;
        type Rev = Set<members::rev>;
        type Text = S::Text;
        type Sender = S::Sender;
    }
    ///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 Id = S::Id;
        type SentAt = S::SentAt;
        type Rev = S::Rev;
        type Text = Set<members::text>;
        type Sender = S::Sender;
    }
    ///State transition - sets the `sender` field to Set
    pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSender<S> {}
    impl<S: State> State for SetSender<S> {
        type Id = S::Id;
        type SentAt = S::SentAt;
        type Rev = S::Rev;
        type Text = S::Text;
        type Sender = Set<members::sender>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `sent_at` field
        pub struct sent_at(());
        ///Marker type for the `rev` field
        pub struct rev(());
        ///Marker type for the `text` field
        pub struct text(());
        ///Marker type for the `sender` field
        pub struct sender(());
    }
}

/// Builder for constructing an instance of this type
pub struct MessageViewBuilder<'a, S: message_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<View<'a>>,
        Option<Vec<Facet<'a>>>,
        Option<CowStr<'a>>,
        Option<Vec<convo::ReactionView<'a>>>,
        Option<CowStr<'a>>,
        Option<convo::MessageViewSender<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> MessageView<'a> {
    /// Create a new builder for this type
    pub fn new() -> MessageViewBuilder<'a, message_view_state::Empty> {
        MessageViewBuilder::new()
    }
}

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

impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
    /// Set the `embed` field (optional)
    pub fn embed(mut self, value: impl Into<Option<View<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `embed` field to an Option value (optional)
    pub fn maybe_embed(mut self, value: Option<View<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
    /// Set the `facets` field (optional)
    pub fn facets(mut self, value: impl Into<Option<Vec<Facet<'a>>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `facets` field to an Option value (optional)
    pub fn maybe_facets(mut self, value: Option<Vec<Facet<'a>>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S> MessageViewBuilder<'a, S>
where
    S: message_view_state::State,
    S::Id: message_view_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> MessageViewBuilder<'a, message_view_state::SetId<S>> {
        self._fields.2 = Option::Some(value.into());
        MessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: message_view_state::State> MessageViewBuilder<'a, S> {
    /// Set the `reactions` field (optional)
    pub fn reactions(
        mut self,
        value: impl Into<Option<Vec<convo::ReactionView<'a>>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `reactions` field to an Option value (optional)
    pub fn maybe_reactions(
        mut self,
        value: Option<Vec<convo::ReactionView<'a>>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S> MessageViewBuilder<'a, S>
where
    S: message_view_state::State,
    S::Rev: message_view_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> MessageViewBuilder<'a, message_view_state::SetRev<S>> {
        self._fields.4 = Option::Some(value.into());
        MessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> MessageViewBuilder<'a, S>
where
    S: message_view_state::State,
    S::Sender: message_view_state::IsUnset,
{
    /// Set the `sender` field (required)
    pub fn sender(
        mut self,
        value: impl Into<convo::MessageViewSender<'a>>,
    ) -> MessageViewBuilder<'a, message_view_state::SetSender<S>> {
        self._fields.5 = Option::Some(value.into());
        MessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> MessageViewBuilder<'a, S>
where
    S: message_view_state::State,
    S::SentAt: message_view_state::IsUnset,
{
    /// Set the `sentAt` field (required)
    pub fn sent_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> MessageViewBuilder<'a, message_view_state::SetSentAt<S>> {
        self._fields.6 = Option::Some(value.into());
        MessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> MessageViewBuilder<'a, S>
where
    S: message_view_state::State,
    S::Id: message_view_state::IsSet,
    S::SentAt: message_view_state::IsSet,
    S::Rev: message_view_state::IsSet,
    S::Text: message_view_state::IsSet,
    S::Sender: message_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> MessageView<'a> {
        MessageView {
            embed: self._fields.0,
            facets: self._fields.1,
            id: self._fields.2.unwrap(),
            reactions: self._fields.3,
            rev: self._fields.4.unwrap(),
            sender: self._fields.5.unwrap(),
            sent_at: self._fields.6.unwrap(),
            text: self._fields.7.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> MessageView<'a> {
        MessageView {
            embed: self._fields.0,
            facets: self._fields.1,
            id: self._fields.2.unwrap(),
            reactions: self._fields.3,
            rev: self._fields.4.unwrap(),
            sender: self._fields.5.unwrap(),
            sent_at: self._fields.6.unwrap(),
            text: self._fields.7.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod message_view_sender_state {

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

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

impl<'a> MessageViewSender<'a> {
    /// Create a new builder for this type
    pub fn new() -> MessageViewSenderBuilder<'a, message_view_sender_state::Empty> {
        MessageViewSenderBuilder::new()
    }
}

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

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

impl<'a, S> MessageViewSenderBuilder<'a, S>
where
    S: message_view_sender_state::State,
    S::Did: message_view_sender_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> MessageViewSender<'a> {
        MessageViewSender {
            did: self._fields.0.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>,
        >,
    ) -> MessageViewSender<'a> {
        MessageViewSender {
            did: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reaction_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 Value;
        type Sender;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Value = Unset;
        type Sender = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `value` field to Set
    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetValue<S> {}
    impl<S: State> State for SetValue<S> {
        type Value = Set<members::value>;
        type Sender = S::Sender;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `sender` field to Set
    pub struct SetSender<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSender<S> {}
    impl<S: State> State for SetSender<S> {
        type Value = S::Value;
        type Sender = Set<members::sender>;
        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 Value = S::Value;
        type Sender = S::Sender;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `value` field
        pub struct value(());
        ///Marker type for the `sender` field
        pub struct sender(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct ReactionViewBuilder<'a, S: reaction_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<convo::ReactionViewSender<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ReactionView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReactionViewBuilder<'a, reaction_view_state::Empty> {
        ReactionViewBuilder::new()
    }
}

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

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

impl<'a, S> ReactionViewBuilder<'a, S>
where
    S: reaction_view_state::State,
    S::Sender: reaction_view_state::IsUnset,
{
    /// Set the `sender` field (required)
    pub fn sender(
        mut self,
        value: impl Into<convo::ReactionViewSender<'a>>,
    ) -> ReactionViewBuilder<'a, reaction_view_state::SetSender<S>> {
        self._fields.1 = Option::Some(value.into());
        ReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReactionViewBuilder<'a, S>
where
    S: reaction_view_state::State,
    S::Value: reaction_view_state::IsUnset,
{
    /// Set the `value` field (required)
    pub fn value(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> ReactionViewBuilder<'a, reaction_view_state::SetValue<S>> {
        self._fields.2 = Option::Some(value.into());
        ReactionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReactionViewBuilder<'a, S>
where
    S: reaction_view_state::State,
    S::Value: reaction_view_state::IsSet,
    S::Sender: reaction_view_state::IsSet,
    S::CreatedAt: reaction_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ReactionView<'a> {
        ReactionView {
            created_at: self._fields.0.unwrap(),
            sender: self._fields.1.unwrap(),
            value: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> ReactionView<'a> {
        ReactionView {
            created_at: self._fields.0.unwrap(),
            sender: self._fields.1.unwrap(),
            value: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod reaction_view_sender_state {

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

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

impl<'a> ReactionViewSender<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReactionViewSenderBuilder<'a, reaction_view_sender_state::Empty> {
        ReactionViewSenderBuilder::new()
    }
}

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

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

impl<'a, S> ReactionViewSenderBuilder<'a, S>
where
    S: reaction_view_sender_state::State,
    S::Did: reaction_view_sender_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ReactionViewSender<'a> {
        ReactionViewSender {
            did: self._fields.0.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>,
        >,
    ) -> ReactionViewSender<'a> {
        ReactionViewSender {
            did: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}