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

//! Generated bindings for the `chat.bsky.convo` Lexicon namespace/module.
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_convo_members;
pub mod get_log;
pub mod get_messages;
pub mod get_unread_counts;
pub mod leave_convo;
pub mod list_convo_requests;
pub mod list_convos;
pub mod lock_convo;
pub mod mute_convo;
pub mod remove_reaction;
pub mod send_message;
pub mod send_message_batch;
pub mod unlock_convo;
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, BosStr, DefaultStr, FromStaticStr};

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

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

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConvoKind<S: BosStr = DefaultStr> {
    Direct,
    Group,
    Other(S),
}

impl<S: BosStr> ConvoKind<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Direct => "direct",
            Self::Group => "group",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "direct" => Self::Direct,
            "group" => Self::Group,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for ConvoKind<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ConvoKind<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ConvoKind<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ConvoKind<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ConvoKind::Direct => ConvoKind::Direct,
            ConvoKind::Group => ConvoKind::Group,
            ConvoKind::Other(v) => ConvoKind::Other(v.into_static()),
        }
    }
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConvoLockStatus<S: BosStr = DefaultStr> {
    Unlocked,
    Locked,
    LockedPermanently,
    Other(S),
}

impl<S: BosStr> ConvoLockStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Unlocked => "unlocked",
            Self::Locked => "locked",
            Self::LockedPermanently => "locked-permanently",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "unlocked" => Self::Unlocked,
            "locked" => Self::Locked,
            "locked-permanently" => Self::LockedPermanently,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for ConvoLockStatus<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ConvoLockStatus<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ConvoLockStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ConvoLockStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ConvoLockStatus::Unlocked => ConvoLockStatus::Unlocked,
            ConvoLockStatus::Locked => ConvoLockStatus::Locked,
            ConvoLockStatus::LockedPermanently => ConvoLockStatus::LockedPermanently,
            ConvoLockStatus::Other(v) => ConvoLockStatus::Other(v.into_static()),
        }
    }
}


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


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ConvoStatus<S: BosStr = DefaultStr> {
    Request,
    Accepted,
    Other(S),
}

impl<S: BosStr> ConvoStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Request => "request",
            Self::Accepted => "accepted",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "request" => Self::Request,
            "accepted" => Self::Accepted,
            _ => Self::Other(s),
        }
    }
}

impl<S: BosStr> AsRef<str> for ConvoStatus<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ConvoStatus<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ConvoStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ConvoStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ConvoStatus::Request => ConvoStatus::Request,
            ConvoStatus::Accepted => ConvoStatus::Accepted,
            ConvoStatus::Other(v) => ConvoStatus::Other(v.into_static()),
        }
    }
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ConvoView<S: BosStr = DefaultStr> {
    pub id: S,
    ///Union field that has data specific to different kinds of convos.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub kind: Option<ConvoViewKind<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_message: Option<ConvoViewLastMessage<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reaction: Option<convo::MessageAndReactionView<S>>,
    ///Members of this conversation. For direct convos, it will be an immutable list of the 2 members. For group convos, it will a list of important members (the first few members, the viewer, the member who added the viewer, the member who sent the last message, the member who sent the last reaction), but will not contain the full list of members. Use chat.bsky.convo.getConvoMembers to list all members.
    pub members: Vec<ProfileViewBasic<S>>,
    pub muted: bool,
    pub rev: S,
    ///Convo status for the viewer member (not the convo itself).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<convo::ConvoStatus<S>>,
    pub unread_count: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ConvoViewKind<S: BosStr = DefaultStr> {
    #[serde(rename = "chat.bsky.convo.defs#directConvo")]
    DirectConvo(Box<convo::DirectConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#groupConvo")]
    GroupConvo(Box<convo::GroupConvo<S>>),
}


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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct DeletedMessageView<S: BosStr = DefaultStr> {
    pub id: S,
    pub rev: S,
    pub sender: convo::MessageViewSender<S>,
    pub sent_at: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here].

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

/// [NOTE: This is under active development and should be considered unstable while this note is here].

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GroupConvo<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub join_link: Option<JoinLinkView<S>>,
    ///The total number of pending join requests for the group conversation. Only present for the owner. Capped at 21.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub join_request_count: Option<i64>,
    ///The lock status of the conversation.
    pub lock_status: convo::ConvoLockStatus<S>,
    ///Whether the lock status is being forced by a moderation override (account inactivation or convo takedown) rather than the owner's own setting.
    pub lock_status_moderation_override: bool,
    ///The total number of members in the group conversation.
    pub member_count: i64,
    ///The maximum number of members allowed in the group conversation.
    pub member_limit: i64,
    ///The display name of the group conversation.
    pub name: S,
    ///The number of unread join requests for the group conversation. Only present for the owner.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unread_join_request_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating the viewer accepted a convo, and it can be moved out of the request inbox. Can be direct or group.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was added to a group convo. The member who was added gets a logBeginConvo (to create the convo) but also a logAddMember (to show the system message as the first message the user sees).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogAddMember<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataAddMember
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating a reaction was added to a message.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogAddReaction<S: BosStr = DefaultStr> {
    pub convo_id: S,
    pub message: LogAddReactionMessage<S>,
    pub reaction: convo::ReactionView<S>,
    ///Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub related_profiles: Option<Vec<ProfileViewBasic<S>>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was approved by the viewer. Only the owner gets this. The approved member gets a logBeginConvo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogApproveJoinRequest<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///Prospective member who requested to join.
    pub member: ProfileViewBasic<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating a convo containing the viewer was started. Can be direct or group. When a member is added to a group convo, they also get this event.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was created for a group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogCreateJoinLink<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataCreateJoinLink
    pub message: convo::SystemMessageView<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating a user-originated message was created. Is not emitted for system messages.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogCreateMessage<S: BosStr = DefaultStr> {
    pub convo_id: S,
    pub message: LogCreateMessageMessage<S>,
    ///Profiles referred to in the message view. This isn't required for compatibility, because it was added later, but should generally be present.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub related_profiles: Option<Vec<ProfileViewBasic<S>>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// Event indicating a user-originated message was deleted. Is not emitted for system messages.

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


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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was disabled for a group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogDisableJoinLink<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataDisableJoinLink
    pub message: convo::SystemMessageView<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating info about group convo was edited.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogEditGroup<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataEditGroup
    pub message: convo::SystemMessageView<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a settings about a join link for a group convo were edited.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogEditJoinLink<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataEditJoinLink
    pub message: convo::SystemMessageView<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was enabled for a group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogEnableJoinLink<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataEnableJoinLink
    pub message: convo::SystemMessageView<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made to a group the viewer owns. Only the owner gets this.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogIncomingJoinRequest<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///Prospective member who requested to join.
    pub member: ProfileViewBasic<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating the viewer left a convo. Can be direct or group.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogLockConvo<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataLockConvo
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked permanently.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogLockConvoPermanently<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataLockConvoPermanently
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member joined a group convo via join link. The member who was added gets a logBeginConvo (to create the convo) but also a logMemberJoin (to show the system message as the first message the user sees).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogMemberJoin<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataMemberJoin
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member voluntarily left a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logMemberLeave (because they already left, so can't see the system message).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogMemberLeave<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataMemberLeave
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating the viewer muted a convo. Can be direct or group.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made by the requester. Only requester actor gets this.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a convo was read up to a certain message.

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


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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the group owner marked join requests as read. Only the owner gets this.

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

/// DEPRECATED: use logReadConvo instead. Event indicating a convo was read up to a certain message.

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


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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was rejected by the viewer. Only the owner gets this.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogRejectJoinRequest<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///Prospective member who requested to join.
    pub member: ProfileViewBasic<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was removed from a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logRemoveMember (because they already left, so can't see the system message).

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogRemoveMember<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataRemoveMember
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating a reaction was removed from a message.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogRemoveReaction<S: BosStr = DefaultStr> {
    pub convo_id: S,
    pub message: LogRemoveReactionMessage<S>,
    pub reaction: convo::ReactionView<S>,
    ///Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub related_profiles: Option<Vec<ProfileViewBasic<S>>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was unlocked.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogUnlockConvo<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///A system message with data of type #systemMessageDataUnlockConvo
    pub message: convo::SystemMessageView<S>,
    ///Profiles referred in the system message.
    pub related_profiles: Vec<ProfileViewBasic<S>>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Event indicating the viewer unmuted a convo. Can be direct or group.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a prospective member withdrew their join request. Only the owner gets this.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct LogWithdrawIncomingJoinRequest<S: BosStr = DefaultStr> {
    pub convo_id: S,
    ///Prospective member who withdrew their join request.
    pub member: ProfileViewBasic<S>,
    pub rev: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the viewer withdrew their own join request. Only requester actor gets this.

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct MessageAndReactionView<S: BosStr = DefaultStr> {
    pub message: convo::MessageView<S>,
    pub reaction: convo::ReactionView<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct MessageInput<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed: Option<MessageInputEmbed<S>>,
    ///Annotations of text (mentions, URLs, hashtags, etc)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub facets: Option<Vec<Facet<S>>>,
    ///If set, the message this message is replying to. The referenced message must be in the same convo.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reply_to: Option<convo::ReplyRef<S>>,
    pub text: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum MessageInputEmbed<S: BosStr = DefaultStr> {
    #[serde(rename = "app.bsky.embed.record")]
    Record(Box<Record<S>>),
    #[serde(rename = "chat.bsky.embed.joinLink")]
    JoinLink(Box<JoinLink<S>>),
}


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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct MessageView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed: Option<MessageViewEmbed<S>>,
    ///Annotations of text (mentions, URLs, hashtags, etc)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub facets: Option<Vec<Facet<S>>>,
    pub id: S,
    ///Reactions to this message, in ascending order of creation time.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reactions: Option<Vec<convo::ReactionView<S>>>,
    ///If set, the message this message is replying to. The full view of the referenced message is embedded so the client can render it inline. Only a single level is embedded: the embedded message will not itself have a populated 'replyTo' field even if it was also a reply.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reply_to: Option<MessageViewReplyTo<S>>,
    pub rev: S,
    pub sender: convo::MessageViewSender<S>,
    pub sent_at: Datetime,
    pub text: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum MessageViewEmbed<S: BosStr = DefaultStr> {
    #[serde(rename = "app.bsky.embed.record#view")]
    RecordView(Box<record::View<S>>),
    #[serde(rename = "chat.bsky.embed.joinLink#view")]
    JoinLinkView(Box<join_link::View<S>>),
}


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


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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReactionView<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    pub sender: convo::ReactionViewSender<S>,
    pub value: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// A reference to another message within the same convo, used to indicate that a message is a reply to it.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user was added to the group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataAddMember<S: BosStr = DefaultStr> {
    pub added_by: convo::SystemMessageReferredUser<S>,
    ///Current view of the member who was added.
    pub member: convo::SystemMessageReferredUser<S>,
    ///Role the user was added to the group with. The role from 'member' will reflect the current data, not historical.
    pub role: MemberRole<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was created.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was disabled.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group info was edited.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataEditGroup<S: BosStr = DefaultStr> {
    ///Group name that replaced the old.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub new_name: Option<S>,
    ///Group name that was replaced.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub old_name: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was edited.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was enabled.

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

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was locked.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataLockConvo<S: BosStr = DefaultStr> {
    ///Current view of the member who locked the group.
    pub locked_by: convo::SystemMessageReferredUser<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was locked permanently.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataLockConvoPermanently<S: BosStr = DefaultStr> {
    ///Current view of the member who locked the group.
    pub locked_by: convo::SystemMessageReferredUser<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user joined the group convo via join link.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataMemberJoin<S: BosStr = DefaultStr> {
    ///If join link was configured to require approval, this will be set to who approved the request. Undefined if approval was not required.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub approved_by: Option<convo::SystemMessageReferredUser<S>>,
    ///Current view of the member who joined.
    pub member: convo::SystemMessageReferredUser<S>,
    ///Role the user was added to the group with. The role from 'member' will reflect the current data, not historical.
    pub role: MemberRole<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user voluntarily left the group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataMemberLeave<S: BosStr = DefaultStr> {
    ///Current view of the member who left the group.
    pub member: convo::SystemMessageReferredUser<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user was removed from the group convo.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataRemoveMember<S: BosStr = DefaultStr> {
    ///Current view of the member who was removed.
    pub member: convo::SystemMessageReferredUser<S>,
    pub removed_by: convo::SystemMessageReferredUser<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// [NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was unlocked.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageDataUnlockConvo<S: BosStr = DefaultStr> {
    ///Current view of the member who unlocked the group.
    pub unlocked_by: convo::SystemMessageReferredUser<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

/// [NOTE: This is under active development and should be considered unstable while this note is here].

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SystemMessageView<S: BosStr = DefaultStr> {
    pub data: SystemMessageViewData<S>,
    pub id: S,
    pub rev: S,
    pub sent_at: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum SystemMessageViewData<S: BosStr = DefaultStr> {
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataAddMember")]
    SystemMessageDataAddMember(Box<convo::SystemMessageDataAddMember<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataRemoveMember")]
    SystemMessageDataRemoveMember(Box<convo::SystemMessageDataRemoveMember<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataMemberJoin")]
    SystemMessageDataMemberJoin(Box<convo::SystemMessageDataMemberJoin<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataMemberLeave")]
    SystemMessageDataMemberLeave(Box<convo::SystemMessageDataMemberLeave<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataLockConvo")]
    SystemMessageDataLockConvo(Box<convo::SystemMessageDataLockConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataUnlockConvo")]
    SystemMessageDataUnlockConvo(Box<convo::SystemMessageDataUnlockConvo<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataLockConvoPermanently")]
    SystemMessageDataLockConvoPermanently(
        Box<convo::SystemMessageDataLockConvoPermanently<S>>,
    ),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataEditGroup")]
    SystemMessageDataEditGroup(Box<convo::SystemMessageDataEditGroup<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataCreateJoinLink")]
    SystemMessageDataCreateJoinLink(Box<convo::SystemMessageDataCreateJoinLink<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataEditJoinLink")]
    SystemMessageDataEditJoinLink(Box<convo::SystemMessageDataEditJoinLink<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataEnableJoinLink")]
    SystemMessageDataEnableJoinLink(Box<convo::SystemMessageDataEnableJoinLink<S>>),
    #[serde(rename = "chat.bsky.convo.defs#systemMessageDataDisableJoinLink")]
    SystemMessageDataDisableJoinLink(Box<convo::SystemMessageDataDisableJoinLink<S>>),
}

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

impl<S: BosStr> LexiconSchema for ConvoView<S> {
    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<S: BosStr> LexiconSchema for DeletedMessageView<S> {
    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<S: BosStr> LexiconSchema for DirectConvo<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "directConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

impl<S: BosStr> LexiconSchema for LogAcceptConvo<S> {
    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<S: BosStr> LexiconSchema for LogAddMember<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logAddMember"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for LogAddReaction<S> {
    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<S: BosStr> LexiconSchema for LogApproveJoinRequest<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logApproveJoinRequest"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for LogBeginConvo<S> {
    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<S: BosStr> LexiconSchema for LogCreateJoinLink<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logCreateJoinLink"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for LogCreateMessage<S> {
    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<S: BosStr> LexiconSchema for LogDeleteMessage<S> {
    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<S: BosStr> LexiconSchema for LogDisableJoinLink<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logDisableJoinLink"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

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

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

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

impl<S: BosStr> LexiconSchema for LogLeaveConvo<S> {
    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<S: BosStr> LexiconSchema for LogLockConvo<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logLockConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

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

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

impl<S: BosStr> LexiconSchema for LogMuteConvo<S> {
    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<S: BosStr> LexiconSchema for LogOutgoingJoinRequest<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logOutgoingJoinRequest"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

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

impl<S: BosStr> LexiconSchema for LogReadMessage<S> {
    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<S: BosStr> LexiconSchema for LogRejectJoinRequest<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logRejectJoinRequest"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

impl<S: BosStr> LexiconSchema for LogRemoveReaction<S> {
    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<S: BosStr> LexiconSchema for LogUnlockConvo<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logUnlockConvo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for LogUnmuteConvo<S> {
    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<S: BosStr> LexiconSchema for LogWithdrawIncomingJoinRequest<S> {
    fn nsid() -> &'static str {
        "chat.bsky.convo.defs"
    }
    fn def_name() -> &'static str {
        "logWithdrawIncomingJoinRequest"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_chat_bsky_convo_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

impl<S: BosStr> LexiconSchema for MessageAndReactionView<S> {
    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<S: BosStr> LexiconSchema for MessageInput<S> {
    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<S: BosStr> LexiconSchema for MessageRef<S> {
    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<S: BosStr> LexiconSchema for MessageView<S> {
    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<S: BosStr> LexiconSchema for MessageViewSender<S> {
    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<S: BosStr> LexiconSchema for ReactionView<S> {
    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<S: BosStr> LexiconSchema for ReactionViewSender<S> {
    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(())
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pub mod convo_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 ConvoId;
        type Did;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ConvoId = Unset;
        type Did = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Did = St::Did;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type ConvoId = St::ConvoId;
        type Did = Set<members::did>;
    }
    /// 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 `did` field
        pub struct did(());
    }
}

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

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

impl<S: BosStr> ConvoRef<S> {
    /// Create a new builder for this type
    pub fn builder() -> ConvoRefBuilder<convo_ref_state::Empty, S> {
        ConvoRefBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ConvoRefBuilder<St, S>
where
    St: convo_ref_state::State,
    St::ConvoId: convo_ref_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> ConvoRefBuilder<convo_ref_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ConvoRefBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ConvoRefBuilder<St, S>
where
    St: convo_ref_state::State,
    St::ConvoId: convo_ref_state::IsSet,
    St::Did: convo_ref_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ConvoRef<S> {
        ConvoRef {
            convo_id: self._fields.0.unwrap(),
            did: 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<SmolStr, Data<S>>) -> ConvoRef<S> {
        ConvoRef {
            convo_id: self._fields.0.unwrap(),
            did: self._fields.1.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("convoKind"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("convoLockStatus"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("convoRef"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("did"), 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
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("convoStatus"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            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("kind"),
                            LexObjectProperty::Union(LexRefUnion {
                                description: Some(
                                    CowStr::new_static(
                                        "Union field that has data specific to different kinds of convos.",
                                    ),
                                ),
                                refs: vec![
                                    CowStr::new_static("#directConvo"),
                                    CowStr::new_static("#groupConvo")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastMessage"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView"),
                                    CowStr::new_static("#systemMessageView")
                                ],
                                ..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 {
                                description: Some(
                                    CowStr::new_static(
                                        "Members of this conversation. For direct convos, it will be an immutable list of the 2 members. For group convos, it will a list of important members (the first few members, the viewer, the member who added the viewer, the member who sent the last message, the member who sent the last reaction), but will not contain the full list of members. Use chat.bsky.convo.getConvoMembers to list all members.",
                                    ),
                                ),
                                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::Ref(LexRef {
                                r#ref: CowStr::new_static("#convoStatus"),
                                ..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("directConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here].",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("groupConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here].",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("createdAt"),
                            SmolStr::new_static("lockStatus"),
                            SmolStr::new_static("lockStatusModerationOverride"),
                            SmolStr::new_static("memberCount"),
                            SmolStr::new_static("memberLimit"),
                            SmolStr::new_static("name")
                        ],
                    ),
                    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("joinLink"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.group.defs#joinLinkView",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("joinRequestCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lockStatus"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#convoLockStatus"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lockStatusModerationOverride"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("memberCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("memberLimit"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The display name of the group conversation.",
                                    ),
                                ),
                                max_length: Some(1280usize),
                                max_graphemes: Some(128usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("unreadJoinRequestCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logAcceptConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating the viewer accepted a convo, and it can be moved out of the request inbox. Can be direct or group.",
                        ),
                    ),
                    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("logAddMember"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was added to a group convo. The member who was added gets a logBeginConvo (to create the convo) but also a logAddMember (to show the system message as the first message the user sees).",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating a reaction was added to a message.",
                        ),
                    ),
                    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("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logApproveJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was approved by the viewer. Only the owner gets this. The approved member gets a logBeginConvo.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("member")
                        ],
                    ),
                    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("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#profileViewBasic",
                                ),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating a convo containing the viewer was started. Can be direct or group. When a member is added to a group convo, they also get this event.",
                        ),
                    ),
                    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("logCreateJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was created for a group convo.",
                        ),
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating a user-originated message was created. Is not emitted for system messages.",
                        ),
                    ),
                    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("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred to in the message view. This isn't required for compatibility, because it was added later, but should generally be present.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating a user-originated message was deleted. Is not emitted for system messages.",
                        ),
                    ),
                    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("logDisableJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was disabled for a group convo.",
                        ),
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logEditGroup"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating info about group convo was edited.",
                        ),
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logEditJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a settings about a join link for a group convo were edited.",
                        ),
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logEnableJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join link was enabled for a group convo.",
                        ),
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logIncomingJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made to a group the viewer owns. Only the owner gets this.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("member")
                        ],
                    ),
                    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("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#profileViewBasic",
                                ),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating the viewer left a convo. Can be direct or group.",
                        ),
                    ),
                    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("logLockConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logLockConvoPermanently"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was locked permanently.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logMemberJoin"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member joined a group convo via join link. The member who was added gets a logBeginConvo (to create the convo) but also a logMemberJoin (to show the system message as the first message the user sees).",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logMemberLeave"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member voluntarily left a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logMemberLeave (because they already left, so can't see the system message).",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating the viewer muted a convo. Can be direct or group.",
                        ),
                    ),
                    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("logOutgoingJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made by the requester. Only requester actor gets this.",
                        ),
                    ),
                    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("logReadConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a convo was read up to a certain message.",
                        ),
                    ),
                    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"),
                                    CowStr::new_static("#systemMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logReadJoinRequests"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the group owner marked join requests as read. Only the owner gets this.",
                        ),
                    ),
                    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 {
                    description: Some(
                        CowStr::new_static(
                            "DEPRECATED: use logReadConvo instead. Event indicating a convo was read up to a certain message.",
                        ),
                    ),
                    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"),
                                    CowStr::new_static("#systemMessageView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logRejectJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was rejected by the viewer. Only the owner gets this.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("member")
                        ],
                    ),
                    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("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logRemoveMember"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a member was removed from a group convo. The member who was removed gets a logLeaveConvo (to leave the convo) but not a logRemoveMember (because they already left, so can't see the system message).",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating a reaction was removed from a message.",
                        ),
                    ),
                    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("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the message and reaction views. This isn't required for compatibility, because it was added later, but should generally be present.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logUnlockConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a group convo was unlocked.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("message"),
                            SmolStr::new_static("relatedProfiles")
                        ],
                    ),
                    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::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedProfiles"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Profiles referred in the system message.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "chat.bsky.actor.defs#profileViewBasic",
                                    ),
                                    ..Default::default()
                                }),
                                ..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 {
                    description: Some(
                        CowStr::new_static(
                            "Event indicating the viewer unmuted a convo. Can be direct or group.",
                        ),
                    ),
                    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("logWithdrawIncomingJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a prospective member withdrew their join request. Only the owner gets this.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("rev"), SmolStr::new_static("convoId"),
                            SmolStr::new_static("member")
                        ],
                    ),
                    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("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#profileViewBasic",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rev"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("logWithdrawOutgoingJoinRequest"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the viewer withdrew their own join request. Only requester actor gets this.",
                        ),
                    ),
                    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"),
                                    CowStr::new_static("chat.bsky.embed.joinLink")
                                ],
                                ..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("replyTo"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#replyRef"),
                                ..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"),
                                    CowStr::new_static("chat.bsky.embed.joinLink#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("replyTo"),
                            LexObjectProperty::Union(LexRefUnion {
                                description: Some(
                                    CowStr::new_static(
                                        "If set, the message this message is replying to. The full view of the referenced message is embedded so the client can render it inline. Only a single level is embedded: the embedded message will not itself have a populated 'replyTo' field even if it was also a reply.",
                                    ),
                                ),
                                refs: vec![
                                    CowStr::new_static("#messageView"),
                                    CowStr::new_static("#deletedMessageView")
                                ],
                                ..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.insert(
                SmolStr::new_static("replyRef"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A reference to another message within the same convo, used to indicate that a message is a reply to it.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("messageId")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("messageId"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataAddMember"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user was added to the group convo.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("member"), SmolStr::new_static("role"),
                            SmolStr::new_static("addedBy")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("addedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("role"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#memberRole",
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataCreateJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was created.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataDisableJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was disabled.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataEditGroup"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group info was edited.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("newName"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Group name that replaced the old."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("oldName"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Group name that was replaced."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataEditJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was edited.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataEnableJoinLink"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group join link was enabled.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataLockConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was locked.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("lockedBy")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("lockedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataLockConvoPermanently"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was locked permanently.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("lockedBy")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("lockedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataMemberJoin"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user joined the group convo via join link.",
                        ),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("member"), SmolStr::new_static("role")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("approvedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("role"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "chat.bsky.actor.defs#memberRole",
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataMemberLeave"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user voluntarily left the group convo.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("member")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataRemoveMember"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating a user was removed from the group convo.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("member"),
                            SmolStr::new_static("removedBy")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("member"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("removedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageDataUnlockConvo"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here]. System message indicating the group convo was unlocked.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("unlockedBy")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("unlockedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#systemMessageReferredUser"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("systemMessageReferredUser"),
                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("systemMessageView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "[NOTE: This is under active development and should be considered unstable while this note is here].",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("rev"),
                            SmolStr::new_static("sentAt"), SmolStr::new_static("data")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("data"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#systemMessageDataAddMember"),
                                    CowStr::new_static("#systemMessageDataRemoveMember"),
                                    CowStr::new_static("#systemMessageDataMemberJoin"),
                                    CowStr::new_static("#systemMessageDataMemberLeave"),
                                    CowStr::new_static("#systemMessageDataLockConvo"),
                                    CowStr::new_static("#systemMessageDataUnlockConvo"),
                                    CowStr::new_static("#systemMessageDataLockConvoPermanently"),
                                    CowStr::new_static("#systemMessageDataEditGroup"),
                                    CowStr::new_static("#systemMessageDataCreateJoinLink"),
                                    CowStr::new_static("#systemMessageDataEditJoinLink"),
                                    CowStr::new_static("#systemMessageDataEnableJoinLink"),
                                    CowStr::new_static("#systemMessageDataDisableJoinLink")
                                ],
                                ..Default::default()
                            }),
                        );
                        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("sentAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

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

/// Builder for constructing an instance of this type.
pub struct ConvoViewBuilder<St: convo_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<ConvoViewKind<S>>,
        Option<ConvoViewLastMessage<S>>,
        Option<convo::MessageAndReactionView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<bool>,
        Option<S>,
        Option<convo::ConvoStatus<S>>,
        Option<i64>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<St, S: BosStr> DeletedMessageViewBuilder<St, S>
where
    St: deleted_message_view_state::State,
    St::Id: deleted_message_view_state::IsSet,
    St::Rev: deleted_message_view_state::IsSet,
    St::Sender: deleted_message_view_state::IsSet,
    St::SentAt: deleted_message_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> DeletedMessageView<S> {
        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<SmolStr, Data<S>>,
    ) -> DeletedMessageView<S> {
        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 group_convo_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type CreatedAt;
        type LockStatus;
        type LockStatusModerationOverride;
        type MemberCount;
        type MemberLimit;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type LockStatus = Unset;
        type LockStatusModerationOverride = Unset;
        type MemberCount = Unset;
        type MemberLimit = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type LockStatus = St::LockStatus;
        type LockStatusModerationOverride = St::LockStatusModerationOverride;
        type MemberCount = St::MemberCount;
        type MemberLimit = St::MemberLimit;
        type Name = St::Name;
    }
    ///State transition - sets the `lock_status` field to Set
    pub struct SetLockStatus<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLockStatus<St> {}
    impl<St: State> State for SetLockStatus<St> {
        type CreatedAt = St::CreatedAt;
        type LockStatus = Set<members::lock_status>;
        type LockStatusModerationOverride = St::LockStatusModerationOverride;
        type MemberCount = St::MemberCount;
        type MemberLimit = St::MemberLimit;
        type Name = St::Name;
    }
    ///State transition - sets the `lock_status_moderation_override` field to Set
    pub struct SetLockStatusModerationOverride<St: State = Empty>(
        PhantomData<fn() -> St>,
    );
    impl<St: State> sealed::Sealed for SetLockStatusModerationOverride<St> {}
    impl<St: State> State for SetLockStatusModerationOverride<St> {
        type CreatedAt = St::CreatedAt;
        type LockStatus = St::LockStatus;
        type LockStatusModerationOverride = Set<
            members::lock_status_moderation_override,
        >;
        type MemberCount = St::MemberCount;
        type MemberLimit = St::MemberLimit;
        type Name = St::Name;
    }
    ///State transition - sets the `member_count` field to Set
    pub struct SetMemberCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMemberCount<St> {}
    impl<St: State> State for SetMemberCount<St> {
        type CreatedAt = St::CreatedAt;
        type LockStatus = St::LockStatus;
        type LockStatusModerationOverride = St::LockStatusModerationOverride;
        type MemberCount = Set<members::member_count>;
        type MemberLimit = St::MemberLimit;
        type Name = St::Name;
    }
    ///State transition - sets the `member_limit` field to Set
    pub struct SetMemberLimit<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMemberLimit<St> {}
    impl<St: State> State for SetMemberLimit<St> {
        type CreatedAt = St::CreatedAt;
        type LockStatus = St::LockStatus;
        type LockStatusModerationOverride = St::LockStatusModerationOverride;
        type MemberCount = St::MemberCount;
        type MemberLimit = Set<members::member_limit>;
        type Name = St::Name;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type CreatedAt = St::CreatedAt;
        type LockStatus = St::LockStatus;
        type LockStatusModerationOverride = St::LockStatusModerationOverride;
        type MemberCount = St::MemberCount;
        type MemberLimit = St::MemberLimit;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `lock_status` field
        pub struct lock_status(());
        ///Marker type for the `lock_status_moderation_override` field
        pub struct lock_status_moderation_override(());
        ///Marker type for the `member_count` field
        pub struct member_count(());
        ///Marker type for the `member_limit` field
        pub struct member_limit(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

/// Builder for constructing an instance of this type.
pub struct GroupConvoBuilder<St: group_convo_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<JoinLinkView<S>>,
        Option<i64>,
        Option<convo::ConvoLockStatus<S>>,
        Option<bool>,
        Option<i64>,
        Option<i64>,
        Option<S>,
        Option<i64>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> GroupConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> GroupConvoBuilder<group_convo_state::Empty, S> {
        GroupConvoBuilder::builder()
    }
}

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

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

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

impl<St: group_convo_state::State, S: BosStr> GroupConvoBuilder<St, S> {
    /// Set the `joinLink` field (optional)
    pub fn join_link(mut self, value: impl Into<Option<JoinLinkView<S>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `joinLink` field to an Option value (optional)
    pub fn maybe_join_link(mut self, value: Option<JoinLinkView<S>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: group_convo_state::State, S: BosStr> GroupConvoBuilder<St, S> {
    /// Set the `joinRequestCount` field (optional)
    pub fn join_request_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `joinRequestCount` field to an Option value (optional)
    pub fn maybe_join_request_count(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::LockStatus: group_convo_state::IsUnset,
{
    /// Set the `lockStatus` field (required)
    pub fn lock_status(
        mut self,
        value: impl Into<convo::ConvoLockStatus<S>>,
    ) -> GroupConvoBuilder<group_convo_state::SetLockStatus<St>, S> {
        self._fields.3 = Option::Some(value.into());
        GroupConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::LockStatusModerationOverride: group_convo_state::IsUnset,
{
    /// Set the `lockStatusModerationOverride` field (required)
    pub fn lock_status_moderation_override(
        mut self,
        value: impl Into<bool>,
    ) -> GroupConvoBuilder<group_convo_state::SetLockStatusModerationOverride<St>, S> {
        self._fields.4 = Option::Some(value.into());
        GroupConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::MemberCount: group_convo_state::IsUnset,
{
    /// Set the `memberCount` field (required)
    pub fn member_count(
        mut self,
        value: impl Into<i64>,
    ) -> GroupConvoBuilder<group_convo_state::SetMemberCount<St>, S> {
        self._fields.5 = Option::Some(value.into());
        GroupConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::MemberLimit: group_convo_state::IsUnset,
{
    /// Set the `memberLimit` field (required)
    pub fn member_limit(
        mut self,
        value: impl Into<i64>,
    ) -> GroupConvoBuilder<group_convo_state::SetMemberLimit<St>, S> {
        self._fields.6 = Option::Some(value.into());
        GroupConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::Name: group_convo_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> GroupConvoBuilder<group_convo_state::SetName<St>, S> {
        self._fields.7 = Option::Some(value.into());
        GroupConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: group_convo_state::State, S: BosStr> GroupConvoBuilder<St, S> {
    /// Set the `unreadJoinRequestCount` field (optional)
    pub fn unread_join_request_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `unreadJoinRequestCount` field to an Option value (optional)
    pub fn maybe_unread_join_request_count(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St, S: BosStr> GroupConvoBuilder<St, S>
where
    St: group_convo_state::State,
    St::CreatedAt: group_convo_state::IsSet,
    St::LockStatus: group_convo_state::IsSet,
    St::LockStatusModerationOverride: group_convo_state::IsSet,
    St::MemberCount: group_convo_state::IsSet,
    St::MemberLimit: group_convo_state::IsSet,
    St::Name: group_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> GroupConvo<S> {
        GroupConvo {
            created_at: self._fields.0.unwrap(),
            join_link: self._fields.1,
            join_request_count: self._fields.2,
            lock_status: self._fields.3.unwrap(),
            lock_status_moderation_override: self._fields.4.unwrap(),
            member_count: self._fields.5.unwrap(),
            member_limit: self._fields.6.unwrap(),
            name: self._fields.7.unwrap(),
            unread_join_request_count: self._fields.8,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> GroupConvo<S> {
        GroupConvo {
            created_at: self._fields.0.unwrap(),
            join_link: self._fields.1,
            join_request_count: self._fields.2,
            lock_status: self._fields.3.unwrap(),
            lock_status_moderation_override: self._fields.4.unwrap(),
            member_count: self._fields.5.unwrap(),
            member_limit: self._fields.6.unwrap(),
            name: self._fields.7.unwrap(),
            unread_join_request_count: self._fields.8,
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_add_member_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogAddMemberBuilder<St: log_add_member_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogAddMember<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogAddMemberBuilder<log_add_member_state::Empty, S> {
        LogAddMemberBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogAddMemberBuilder<St, S>
where
    St: log_add_member_state::State,
    St::ConvoId: log_add_member_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogAddMemberBuilder<log_add_member_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogAddMemberBuilder<St, S>
where
    St: log_add_member_state::State,
    St::Message: log_add_member_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogAddMemberBuilder<log_add_member_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogAddMemberBuilder<St, S>
where
    St: log_add_member_state::State,
    St::RelatedProfiles: log_add_member_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogAddMemberBuilder<log_add_member_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogAddMemberBuilder<St, S>
where
    St: log_add_member_state::State,
    St::Rev: log_add_member_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogAddMemberBuilder<log_add_member_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogAddMemberBuilder<St, S>
where
    St: log_add_member_state::State,
    St::ConvoId: log_add_member_state::IsSet,
    St::Message: log_add_member_state::IsSet,
    St::RelatedProfiles: log_add_member_state::IsSet,
    St::Rev: log_add_member_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogAddMember<S> {
        LogAddMember {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogAddMember<S> {
        LogAddMember {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: 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 Message;
        type Reaction;
        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 Reaction = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Reaction = St::Reaction;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Reaction = St::Reaction;
        type Rev = St::Rev;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReaction<St> {}
    impl<St: State> State for SetReaction<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type Reaction = Set<members::reaction>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type Reaction = St::Reaction;
        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 `reaction` field
        pub struct reaction(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogAddReactionBuilder<
    St: log_add_reaction_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<LogAddReactionMessage<S>>,
        Option<convo::ReactionView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

impl<St: log_add_reaction_state::State, S: BosStr> LogAddReactionBuilder<St, S> {
    /// Set the `relatedProfiles` field (optional)
    pub fn related_profiles(
        mut self,
        value: impl Into<Option<Vec<ProfileViewBasic<S>>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `relatedProfiles` field to an Option value (optional)
    pub fn maybe_related_profiles(
        mut self,
        value: Option<Vec<ProfileViewBasic<S>>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St, S: BosStr> LogAddReactionBuilder<St, S>
where
    St: log_add_reaction_state::State,
    St::ConvoId: log_add_reaction_state::IsSet,
    St::Message: log_add_reaction_state::IsSet,
    St::Reaction: log_add_reaction_state::IsSet,
    St::Rev: log_add_reaction_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogAddReaction<S> {
        LogAddReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            related_profiles: self._fields.3,
            rev: self._fields.4.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> LogAddReaction<S> {
        LogAddReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            related_profiles: self._fields.3,
            rev: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_approve_join_request_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 Member;
        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 Member = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Member = St::Member;
        type Rev = St::Rev;
    }
    ///State transition - sets the `member` field to Set
    pub struct SetMember<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMember<St> {}
    impl<St: State> State for SetMember<St> {
        type ConvoId = St::ConvoId;
        type Member = Set<members::member>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Member = St::Member;
        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 `member` field
        pub struct member(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

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

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

impl<S: BosStr> LogApproveJoinRequest<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogApproveJoinRequestBuilder<
        log_approve_join_request_state::Empty,
        S,
    > {
        LogApproveJoinRequestBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogApproveJoinRequestBuilder<St, S>
where
    St: log_approve_join_request_state::State,
    St::ConvoId: log_approve_join_request_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogApproveJoinRequestBuilder<
        log_approve_join_request_state::SetConvoId<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        LogApproveJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogApproveJoinRequestBuilder<St, S>
where
    St: log_approve_join_request_state::State,
    St::Member: log_approve_join_request_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> LogApproveJoinRequestBuilder<log_approve_join_request_state::SetMember<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogApproveJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogApproveJoinRequestBuilder<St, S>
where
    St: log_approve_join_request_state::State,
    St::Rev: log_approve_join_request_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogApproveJoinRequestBuilder<log_approve_join_request_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogApproveJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogApproveJoinRequestBuilder<St, S>
where
    St: log_approve_join_request_state::State,
    St::ConvoId: log_approve_join_request_state::IsSet,
    St::Member: log_approve_join_request_state::IsSet,
    St::Rev: log_approve_join_request_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogApproveJoinRequest<S> {
        LogApproveJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: 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<SmolStr, Data<S>>,
    ) -> LogApproveJoinRequest<S> {
        LogApproveJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_create_join_link_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogCreateJoinLinkBuilder<
    St: log_create_join_link_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<convo::SystemMessageView<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogCreateJoinLink<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogCreateJoinLinkBuilder<log_create_join_link_state::Empty, S> {
        LogCreateJoinLinkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogCreateJoinLinkBuilder<St, S>
where
    St: log_create_join_link_state::State,
    St::ConvoId: log_create_join_link_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogCreateJoinLinkBuilder<log_create_join_link_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogCreateJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogCreateJoinLinkBuilder<St, S>
where
    St: log_create_join_link_state::State,
    St::Message: log_create_join_link_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogCreateJoinLinkBuilder<log_create_join_link_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogCreateJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogCreateJoinLinkBuilder<St, S>
where
    St: log_create_join_link_state::State,
    St::Rev: log_create_join_link_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogCreateJoinLinkBuilder<log_create_join_link_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogCreateJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogCreateJoinLinkBuilder<St, S>
where
    St: log_create_join_link_state::State,
    St::ConvoId: log_create_join_link_state::IsSet,
    St::Message: log_create_join_link_state::IsSet,
    St::Rev: log_create_join_link_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogCreateJoinLink<S> {
        LogCreateJoinLink {
            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<SmolStr, Data<S>>,
    ) -> LogCreateJoinLink<S> {
        LogCreateJoinLink {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.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 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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogCreateMessageBuilder<
    St: log_create_message_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<LogCreateMessageMessage<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

impl<St: log_create_message_state::State, S: BosStr> LogCreateMessageBuilder<St, S> {
    /// Set the `relatedProfiles` field (optional)
    pub fn related_profiles(
        mut self,
        value: impl Into<Option<Vec<ProfileViewBasic<S>>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `relatedProfiles` field to an Option value (optional)
    pub fn maybe_related_profiles(
        mut self,
        value: Option<Vec<ProfileViewBasic<S>>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

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

impl<St, S: BosStr> LogCreateMessageBuilder<St, S>
where
    St: log_create_message_state::State,
    St::ConvoId: log_create_message_state::IsSet,
    St::Message: log_create_message_state::IsSet,
    St::Rev: log_create_message_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogCreateMessage<S> {
        LogCreateMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2,
            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<SmolStr, Data<S>>,
    ) -> LogCreateMessage<S> {
        LogCreateMessage {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2,
            rev: self._fields.3.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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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<
    St: log_delete_message_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<LogDeleteMessageMessage<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

impl<St, S: BosStr> LogDeleteMessageBuilder<St, S>
where
    St: log_delete_message_state::State,
    St::ConvoId: log_delete_message_state::IsSet,
    St::Message: log_delete_message_state::IsSet,
    St::Rev: log_delete_message_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogDeleteMessage<S> {
        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<SmolStr, Data<S>>,
    ) -> LogDeleteMessage<S> {
        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_disable_join_link_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogDisableJoinLinkBuilder<
    St: log_disable_join_link_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<convo::SystemMessageView<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogDisableJoinLink<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogDisableJoinLinkBuilder<
        log_disable_join_link_state::Empty,
        S,
    > {
        LogDisableJoinLinkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogDisableJoinLinkBuilder<St, S>
where
    St: log_disable_join_link_state::State,
    St::ConvoId: log_disable_join_link_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogDisableJoinLinkBuilder<log_disable_join_link_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogDisableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogDisableJoinLinkBuilder<St, S>
where
    St: log_disable_join_link_state::State,
    St::Message: log_disable_join_link_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogDisableJoinLinkBuilder<log_disable_join_link_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogDisableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogDisableJoinLinkBuilder<St, S>
where
    St: log_disable_join_link_state::State,
    St::Rev: log_disable_join_link_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogDisableJoinLinkBuilder<log_disable_join_link_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogDisableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogDisableJoinLinkBuilder<St, S>
where
    St: log_disable_join_link_state::State,
    St::ConvoId: log_disable_join_link_state::IsSet,
    St::Message: log_disable_join_link_state::IsSet,
    St::Rev: log_disable_join_link_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogDisableJoinLink<S> {
        LogDisableJoinLink {
            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<SmolStr, Data<S>>,
    ) -> LogDisableJoinLink<S> {
        LogDisableJoinLink {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_edit_group_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogEditGroupBuilder<St: log_edit_group_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<convo::SystemMessageView<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogEditGroup<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogEditGroupBuilder<log_edit_group_state::Empty, S> {
        LogEditGroupBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogEditGroupBuilder<St, S>
where
    St: log_edit_group_state::State,
    St::ConvoId: log_edit_group_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogEditGroupBuilder<log_edit_group_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogEditGroupBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditGroupBuilder<St, S>
where
    St: log_edit_group_state::State,
    St::Message: log_edit_group_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogEditGroupBuilder<log_edit_group_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogEditGroupBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditGroupBuilder<St, S>
where
    St: log_edit_group_state::State,
    St::Rev: log_edit_group_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogEditGroupBuilder<log_edit_group_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogEditGroupBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditGroupBuilder<St, S>
where
    St: log_edit_group_state::State,
    St::ConvoId: log_edit_group_state::IsSet,
    St::Message: log_edit_group_state::IsSet,
    St::Rev: log_edit_group_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogEditGroup<S> {
        LogEditGroup {
            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<SmolStr, Data<S>>,
    ) -> LogEditGroup<S> {
        LogEditGroup {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_edit_join_link_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogEditJoinLinkBuilder<
    St: log_edit_join_link_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<convo::SystemMessageView<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogEditJoinLink<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogEditJoinLinkBuilder<log_edit_join_link_state::Empty, S> {
        LogEditJoinLinkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogEditJoinLinkBuilder<St, S>
where
    St: log_edit_join_link_state::State,
    St::ConvoId: log_edit_join_link_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogEditJoinLinkBuilder<log_edit_join_link_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogEditJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditJoinLinkBuilder<St, S>
where
    St: log_edit_join_link_state::State,
    St::Message: log_edit_join_link_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogEditJoinLinkBuilder<log_edit_join_link_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogEditJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditJoinLinkBuilder<St, S>
where
    St: log_edit_join_link_state::State,
    St::Rev: log_edit_join_link_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogEditJoinLinkBuilder<log_edit_join_link_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogEditJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEditJoinLinkBuilder<St, S>
where
    St: log_edit_join_link_state::State,
    St::ConvoId: log_edit_join_link_state::IsSet,
    St::Message: log_edit_join_link_state::IsSet,
    St::Rev: log_edit_join_link_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogEditJoinLink<S> {
        LogEditJoinLink {
            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<SmolStr, Data<S>>,
    ) -> LogEditJoinLink<S> {
        LogEditJoinLink {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_enable_join_link_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogEnableJoinLinkBuilder<
    St: log_enable_join_link_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<convo::SystemMessageView<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogEnableJoinLink<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogEnableJoinLinkBuilder<log_enable_join_link_state::Empty, S> {
        LogEnableJoinLinkBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogEnableJoinLinkBuilder<St, S>
where
    St: log_enable_join_link_state::State,
    St::ConvoId: log_enable_join_link_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogEnableJoinLinkBuilder<log_enable_join_link_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogEnableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEnableJoinLinkBuilder<St, S>
where
    St: log_enable_join_link_state::State,
    St::Message: log_enable_join_link_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogEnableJoinLinkBuilder<log_enable_join_link_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogEnableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEnableJoinLinkBuilder<St, S>
where
    St: log_enable_join_link_state::State,
    St::Rev: log_enable_join_link_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogEnableJoinLinkBuilder<log_enable_join_link_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogEnableJoinLinkBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogEnableJoinLinkBuilder<St, S>
where
    St: log_enable_join_link_state::State,
    St::ConvoId: log_enable_join_link_state::IsSet,
    St::Message: log_enable_join_link_state::IsSet,
    St::Rev: log_enable_join_link_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogEnableJoinLink<S> {
        LogEnableJoinLink {
            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<SmolStr, Data<S>>,
    ) -> LogEnableJoinLink<S> {
        LogEnableJoinLink {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_incoming_join_request_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 Member;
        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 Member = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Member = St::Member;
        type Rev = St::Rev;
    }
    ///State transition - sets the `member` field to Set
    pub struct SetMember<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMember<St> {}
    impl<St: State> State for SetMember<St> {
        type ConvoId = St::ConvoId;
        type Member = Set<members::member>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Member = St::Member;
        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 `member` field
        pub struct member(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

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

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

impl<S: BosStr> LogIncomingJoinRequest<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogIncomingJoinRequestBuilder<
        log_incoming_join_request_state::Empty,
        S,
    > {
        LogIncomingJoinRequestBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogIncomingJoinRequestBuilder<St, S>
where
    St: log_incoming_join_request_state::State,
    St::ConvoId: log_incoming_join_request_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogIncomingJoinRequestBuilder<
        log_incoming_join_request_state::SetConvoId<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        LogIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogIncomingJoinRequestBuilder<St, S>
where
    St: log_incoming_join_request_state::State,
    St::Member: log_incoming_join_request_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> LogIncomingJoinRequestBuilder<
        log_incoming_join_request_state::SetMember<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        LogIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogIncomingJoinRequestBuilder<St, S>
where
    St: log_incoming_join_request_state::State,
    St::Rev: log_incoming_join_request_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogIncomingJoinRequestBuilder<log_incoming_join_request_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogIncomingJoinRequestBuilder<St, S>
where
    St: log_incoming_join_request_state::State,
    St::ConvoId: log_incoming_join_request_state::IsSet,
    St::Member: log_incoming_join_request_state::IsSet,
    St::Rev: log_incoming_join_request_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogIncomingJoinRequest<S> {
        LogIncomingJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: 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<SmolStr, Data<S>>,
    ) -> LogIncomingJoinRequest<S> {
        LogIncomingJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_lock_convo_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogLockConvoBuilder<St: log_lock_convo_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogLockConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogLockConvoBuilder<log_lock_convo_state::Empty, S> {
        LogLockConvoBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogLockConvoBuilder<St, S>
where
    St: log_lock_convo_state::State,
    St::ConvoId: log_lock_convo_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogLockConvoBuilder<log_lock_convo_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogLockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoBuilder<St, S>
where
    St: log_lock_convo_state::State,
    St::Message: log_lock_convo_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogLockConvoBuilder<log_lock_convo_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogLockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoBuilder<St, S>
where
    St: log_lock_convo_state::State,
    St::RelatedProfiles: log_lock_convo_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogLockConvoBuilder<log_lock_convo_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogLockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoBuilder<St, S>
where
    St: log_lock_convo_state::State,
    St::Rev: log_lock_convo_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogLockConvoBuilder<log_lock_convo_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogLockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoBuilder<St, S>
where
    St: log_lock_convo_state::State,
    St::ConvoId: log_lock_convo_state::IsSet,
    St::Message: log_lock_convo_state::IsSet,
    St::RelatedProfiles: log_lock_convo_state::IsSet,
    St::Rev: log_lock_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogLockConvo<S> {
        LogLockConvo {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogLockConvo<S> {
        LogLockConvo {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_lock_convo_permanently_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogLockConvoPermanentlyBuilder<
    St: log_lock_convo_permanently_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogLockConvoPermanently<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogLockConvoPermanentlyBuilder<
        log_lock_convo_permanently_state::Empty,
        S,
    > {
        LogLockConvoPermanentlyBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogLockConvoPermanentlyBuilder<St, S>
where
    St: log_lock_convo_permanently_state::State,
    St::ConvoId: log_lock_convo_permanently_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogLockConvoPermanentlyBuilder<
        log_lock_convo_permanently_state::SetConvoId<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        LogLockConvoPermanentlyBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoPermanentlyBuilder<St, S>
where
    St: log_lock_convo_permanently_state::State,
    St::Message: log_lock_convo_permanently_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogLockConvoPermanentlyBuilder<
        log_lock_convo_permanently_state::SetMessage<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        LogLockConvoPermanentlyBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoPermanentlyBuilder<St, S>
where
    St: log_lock_convo_permanently_state::State,
    St::RelatedProfiles: log_lock_convo_permanently_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogLockConvoPermanentlyBuilder<
        log_lock_convo_permanently_state::SetRelatedProfiles<St>,
        S,
    > {
        self._fields.2 = Option::Some(value.into());
        LogLockConvoPermanentlyBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoPermanentlyBuilder<St, S>
where
    St: log_lock_convo_permanently_state::State,
    St::Rev: log_lock_convo_permanently_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogLockConvoPermanentlyBuilder<
        log_lock_convo_permanently_state::SetRev<St>,
        S,
    > {
        self._fields.3 = Option::Some(value.into());
        LogLockConvoPermanentlyBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogLockConvoPermanentlyBuilder<St, S>
where
    St: log_lock_convo_permanently_state::State,
    St::ConvoId: log_lock_convo_permanently_state::IsSet,
    St::Message: log_lock_convo_permanently_state::IsSet,
    St::RelatedProfiles: log_lock_convo_permanently_state::IsSet,
    St::Rev: log_lock_convo_permanently_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogLockConvoPermanently<S> {
        LogLockConvoPermanently {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogLockConvoPermanently<S> {
        LogLockConvoPermanently {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_member_join_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogMemberJoinBuilder<
    St: log_member_join_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogMemberJoin<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogMemberJoinBuilder<log_member_join_state::Empty, S> {
        LogMemberJoinBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogMemberJoinBuilder<St, S>
where
    St: log_member_join_state::State,
    St::ConvoId: log_member_join_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogMemberJoinBuilder<log_member_join_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberJoinBuilder<St, S>
where
    St: log_member_join_state::State,
    St::Message: log_member_join_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogMemberJoinBuilder<log_member_join_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberJoinBuilder<St, S>
where
    St: log_member_join_state::State,
    St::RelatedProfiles: log_member_join_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogMemberJoinBuilder<log_member_join_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberJoinBuilder<St, S>
where
    St: log_member_join_state::State,
    St::Rev: log_member_join_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogMemberJoinBuilder<log_member_join_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberJoinBuilder<St, S>
where
    St: log_member_join_state::State,
    St::ConvoId: log_member_join_state::IsSet,
    St::Message: log_member_join_state::IsSet,
    St::RelatedProfiles: log_member_join_state::IsSet,
    St::Rev: log_member_join_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogMemberJoin<S> {
        LogMemberJoin {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogMemberJoin<S> {
        LogMemberJoin {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_member_leave_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogMemberLeaveBuilder<
    St: log_member_leave_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogMemberLeave<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogMemberLeaveBuilder<log_member_leave_state::Empty, S> {
        LogMemberLeaveBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogMemberLeaveBuilder<St, S>
where
    St: log_member_leave_state::State,
    St::ConvoId: log_member_leave_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogMemberLeaveBuilder<log_member_leave_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogMemberLeaveBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberLeaveBuilder<St, S>
where
    St: log_member_leave_state::State,
    St::Message: log_member_leave_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogMemberLeaveBuilder<log_member_leave_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogMemberLeaveBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberLeaveBuilder<St, S>
where
    St: log_member_leave_state::State,
    St::RelatedProfiles: log_member_leave_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogMemberLeaveBuilder<log_member_leave_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogMemberLeaveBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberLeaveBuilder<St, S>
where
    St: log_member_leave_state::State,
    St::Rev: log_member_leave_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogMemberLeaveBuilder<log_member_leave_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogMemberLeaveBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogMemberLeaveBuilder<St, S>
where
    St: log_member_leave_state::State,
    St::ConvoId: log_member_leave_state::IsSet,
    St::Message: log_member_leave_state::IsSet,
    St::RelatedProfiles: log_member_leave_state::IsSet,
    St::Rev: log_member_leave_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogMemberLeave<S> {
        LogMemberLeave {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogMemberLeave<S> {
        LogMemberLeave {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_read_convo_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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogReadConvoBuilder<St: log_read_convo_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<LogReadConvoMessage<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogReadConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogReadConvoBuilder<log_read_convo_state::Empty, S> {
        LogReadConvoBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogReadConvoBuilder<St, S>
where
    St: log_read_convo_state::State,
    St::ConvoId: log_read_convo_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogReadConvoBuilder<log_read_convo_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogReadConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogReadConvoBuilder<St, S>
where
    St: log_read_convo_state::State,
    St::Message: log_read_convo_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<LogReadConvoMessage<S>>,
    ) -> LogReadConvoBuilder<log_read_convo_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogReadConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogReadConvoBuilder<St, S>
where
    St: log_read_convo_state::State,
    St::Rev: log_read_convo_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogReadConvoBuilder<log_read_convo_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogReadConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogReadConvoBuilder<St, S>
where
    St: log_read_convo_state::State,
    St::ConvoId: log_read_convo_state::IsSet,
    St::Message: log_read_convo_state::IsSet,
    St::Rev: log_read_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogReadConvo<S> {
        LogReadConvo {
            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<SmolStr, Data<S>>,
    ) -> LogReadConvo<S> {
        LogReadConvo {
            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 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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::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 LogReadMessageBuilder<
    St: log_read_message_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<LogReadMessageMessage<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

impl<St, S: BosStr> LogReadMessageBuilder<St, S>
where
    St: log_read_message_state::State,
    St::ConvoId: log_read_message_state::IsSet,
    St::Message: log_read_message_state::IsSet,
    St::Rev: log_read_message_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogReadMessage<S> {
        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<SmolStr, Data<S>>,
    ) -> LogReadMessage<S> {
        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_reject_join_request_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 Member;
        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 Member = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Member = St::Member;
        type Rev = St::Rev;
    }
    ///State transition - sets the `member` field to Set
    pub struct SetMember<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMember<St> {}
    impl<St: State> State for SetMember<St> {
        type ConvoId = St::ConvoId;
        type Member = Set<members::member>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Member = St::Member;
        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 `member` field
        pub struct member(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

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

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

impl<S: BosStr> LogRejectJoinRequest<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogRejectJoinRequestBuilder<
        log_reject_join_request_state::Empty,
        S,
    > {
        LogRejectJoinRequestBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogRejectJoinRequestBuilder<St, S>
where
    St: log_reject_join_request_state::State,
    St::ConvoId: log_reject_join_request_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogRejectJoinRequestBuilder<log_reject_join_request_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogRejectJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRejectJoinRequestBuilder<St, S>
where
    St: log_reject_join_request_state::State,
    St::Member: log_reject_join_request_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> LogRejectJoinRequestBuilder<log_reject_join_request_state::SetMember<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogRejectJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRejectJoinRequestBuilder<St, S>
where
    St: log_reject_join_request_state::State,
    St::Rev: log_reject_join_request_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogRejectJoinRequestBuilder<log_reject_join_request_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogRejectJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRejectJoinRequestBuilder<St, S>
where
    St: log_reject_join_request_state::State,
    St::ConvoId: log_reject_join_request_state::IsSet,
    St::Member: log_reject_join_request_state::IsSet,
    St::Rev: log_reject_join_request_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogRejectJoinRequest<S> {
        LogRejectJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: 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<SmolStr, Data<S>>,
    ) -> LogRejectJoinRequest<S> {
        LogRejectJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_remove_member_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogRemoveMemberBuilder<
    St: log_remove_member_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogRemoveMember<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogRemoveMemberBuilder<log_remove_member_state::Empty, S> {
        LogRemoveMemberBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogRemoveMemberBuilder<St, S>
where
    St: log_remove_member_state::State,
    St::ConvoId: log_remove_member_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogRemoveMemberBuilder<log_remove_member_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRemoveMemberBuilder<St, S>
where
    St: log_remove_member_state::State,
    St::Message: log_remove_member_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogRemoveMemberBuilder<log_remove_member_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRemoveMemberBuilder<St, S>
where
    St: log_remove_member_state::State,
    St::RelatedProfiles: log_remove_member_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogRemoveMemberBuilder<log_remove_member_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRemoveMemberBuilder<St, S>
where
    St: log_remove_member_state::State,
    St::Rev: log_remove_member_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogRemoveMemberBuilder<log_remove_member_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogRemoveMemberBuilder<St, S>
where
    St: log_remove_member_state::State,
    St::ConvoId: log_remove_member_state::IsSet,
    St::Message: log_remove_member_state::IsSet,
    St::RelatedProfiles: log_remove_member_state::IsSet,
    St::Rev: log_remove_member_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogRemoveMember<S> {
        LogRemoveMember {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogRemoveMember<S> {
        LogRemoveMember {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.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 ConvoId;
        type Message;
        type Reaction;
        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 Reaction = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type Reaction = St::Reaction;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type Reaction = St::Reaction;
        type Rev = St::Rev;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReaction<St> {}
    impl<St: State> State for SetReaction<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type Reaction = Set<members::reaction>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type Reaction = St::Reaction;
        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 `reaction` field
        pub struct reaction(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogRemoveReactionBuilder<
    St: log_remove_reaction_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<LogRemoveReactionMessage<S>>,
        Option<convo::ReactionView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

impl<St: log_remove_reaction_state::State, S: BosStr> LogRemoveReactionBuilder<St, S> {
    /// Set the `relatedProfiles` field (optional)
    pub fn related_profiles(
        mut self,
        value: impl Into<Option<Vec<ProfileViewBasic<S>>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `relatedProfiles` field to an Option value (optional)
    pub fn maybe_related_profiles(
        mut self,
        value: Option<Vec<ProfileViewBasic<S>>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St, S: BosStr> LogRemoveReactionBuilder<St, S>
where
    St: log_remove_reaction_state::State,
    St::ConvoId: log_remove_reaction_state::IsSet,
    St::Message: log_remove_reaction_state::IsSet,
    St::Reaction: log_remove_reaction_state::IsSet,
    St::Rev: log_remove_reaction_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogRemoveReaction<S> {
        LogRemoveReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            related_profiles: self._fields.3,
            rev: self._fields.4.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> LogRemoveReaction<S> {
        LogRemoveReaction {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            reaction: self._fields.2.unwrap(),
            related_profiles: self._fields.3,
            rev: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_unlock_convo_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 RelatedProfiles;
        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 RelatedProfiles = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type ConvoId = St::ConvoId;
        type Message = Set<members::message>;
        type RelatedProfiles = St::RelatedProfiles;
        type Rev = St::Rev;
    }
    ///State transition - sets the `related_profiles` field to Set
    pub struct SetRelatedProfiles<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRelatedProfiles<St> {}
    impl<St: State> State for SetRelatedProfiles<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = Set<members::related_profiles>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Message = St::Message;
        type RelatedProfiles = St::RelatedProfiles;
        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 `related_profiles` field
        pub struct related_profiles(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

/// Builder for constructing an instance of this type.
pub struct LogUnlockConvoBuilder<
    St: log_unlock_convo_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<convo::SystemMessageView<S>>,
        Option<Vec<ProfileViewBasic<S>>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> LogUnlockConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogUnlockConvoBuilder<log_unlock_convo_state::Empty, S> {
        LogUnlockConvoBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogUnlockConvoBuilder<St, S>
where
    St: log_unlock_convo_state::State,
    St::ConvoId: log_unlock_convo_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogUnlockConvoBuilder<log_unlock_convo_state::SetConvoId<St>, S> {
        self._fields.0 = Option::Some(value.into());
        LogUnlockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogUnlockConvoBuilder<St, S>
where
    St: log_unlock_convo_state::State,
    St::Message: log_unlock_convo_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<convo::SystemMessageView<S>>,
    ) -> LogUnlockConvoBuilder<log_unlock_convo_state::SetMessage<St>, S> {
        self._fields.1 = Option::Some(value.into());
        LogUnlockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogUnlockConvoBuilder<St, S>
where
    St: log_unlock_convo_state::State,
    St::RelatedProfiles: log_unlock_convo_state::IsUnset,
{
    /// Set the `relatedProfiles` field (required)
    pub fn related_profiles(
        mut self,
        value: impl Into<Vec<ProfileViewBasic<S>>>,
    ) -> LogUnlockConvoBuilder<log_unlock_convo_state::SetRelatedProfiles<St>, S> {
        self._fields.2 = Option::Some(value.into());
        LogUnlockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogUnlockConvoBuilder<St, S>
where
    St: log_unlock_convo_state::State,
    St::Rev: log_unlock_convo_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogUnlockConvoBuilder<log_unlock_convo_state::SetRev<St>, S> {
        self._fields.3 = Option::Some(value.into());
        LogUnlockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogUnlockConvoBuilder<St, S>
where
    St: log_unlock_convo_state::State,
    St::ConvoId: log_unlock_convo_state::IsSet,
    St::Message: log_unlock_convo_state::IsSet,
    St::RelatedProfiles: log_unlock_convo_state::IsSet,
    St::Rev: log_unlock_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogUnlockConvo<S> {
        LogUnlockConvo {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: 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<SmolStr, Data<S>>,
    ) -> LogUnlockConvo<S> {
        LogUnlockConvo {
            convo_id: self._fields.0.unwrap(),
            message: self._fields.1.unwrap(),
            related_profiles: self._fields.2.unwrap(),
            rev: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod log_withdraw_incoming_join_request_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 Member;
        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 Member = Unset;
        type Rev = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Member = St::Member;
        type Rev = St::Rev;
    }
    ///State transition - sets the `member` field to Set
    pub struct SetMember<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMember<St> {}
    impl<St: State> State for SetMember<St> {
        type ConvoId = St::ConvoId;
        type Member = Set<members::member>;
        type Rev = St::Rev;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type ConvoId = St::ConvoId;
        type Member = St::Member;
        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 `member` field
        pub struct member(());
        ///Marker type for the `rev` field
        pub struct rev(());
    }
}

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

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

impl<S: BosStr> LogWithdrawIncomingJoinRequest<S> {
    /// Create a new builder for this type
    pub fn builder() -> LogWithdrawIncomingJoinRequestBuilder<
        log_withdraw_incoming_join_request_state::Empty,
        S,
    > {
        LogWithdrawIncomingJoinRequestBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> LogWithdrawIncomingJoinRequestBuilder<St, S>
where
    St: log_withdraw_incoming_join_request_state::State,
    St::ConvoId: log_withdraw_incoming_join_request_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> LogWithdrawIncomingJoinRequestBuilder<
        log_withdraw_incoming_join_request_state::SetConvoId<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        LogWithdrawIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogWithdrawIncomingJoinRequestBuilder<St, S>
where
    St: log_withdraw_incoming_join_request_state::State,
    St::Member: log_withdraw_incoming_join_request_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<ProfileViewBasic<S>>,
    ) -> LogWithdrawIncomingJoinRequestBuilder<
        log_withdraw_incoming_join_request_state::SetMember<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        LogWithdrawIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogWithdrawIncomingJoinRequestBuilder<St, S>
where
    St: log_withdraw_incoming_join_request_state::State,
    St::Rev: log_withdraw_incoming_join_request_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> LogWithdrawIncomingJoinRequestBuilder<
        log_withdraw_incoming_join_request_state::SetRev<St>,
        S,
    > {
        self._fields.2 = Option::Some(value.into());
        LogWithdrawIncomingJoinRequestBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> LogWithdrawIncomingJoinRequestBuilder<St, S>
where
    St: log_withdraw_incoming_join_request_state::State,
    St::ConvoId: log_withdraw_incoming_join_request_state::IsSet,
    St::Member: log_withdraw_incoming_join_request_state::IsSet,
    St::Rev: log_withdraw_incoming_join_request_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> LogWithdrawIncomingJoinRequest<S> {
        LogWithdrawIncomingJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: 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<SmolStr, Data<S>>,
    ) -> LogWithdrawIncomingJoinRequest<S> {
        LogWithdrawIncomingJoinRequest {
            convo_id: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            rev: self._fields.2.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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type Message = Set<members::message>;
        type Reaction = St::Reaction;
    }
    ///State transition - sets the `reaction` field to Set
    pub struct SetReaction<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReaction<St> {}
    impl<St: State> State for SetReaction<St> {
        type Message = St::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<
    St: message_and_reaction_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<convo::MessageView<S>>, Option<convo::ReactionView<S>>),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

impl<St, S: BosStr> MessageAndReactionViewBuilder<St, S>
where
    St: message_and_reaction_view_state::State,
    St::Message: message_and_reaction_view_state::IsSet,
    St::Reaction: message_and_reaction_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> MessageAndReactionView<S> {
        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<SmolStr, Data<S>>,
    ) -> MessageAndReactionView<S> {
        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 ConvoId;
        type Did;
        type MessageId;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ConvoId = Unset;
        type Did = Unset;
        type MessageId = Unset;
    }
    ///State transition - sets the `convo_id` field to Set
    pub struct SetConvoId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetConvoId<St> {}
    impl<St: State> State for SetConvoId<St> {
        type ConvoId = Set<members::convo_id>;
        type Did = St::Did;
        type MessageId = St::MessageId;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type ConvoId = St::ConvoId;
        type Did = Set<members::did>;
        type MessageId = St::MessageId;
    }
    ///State transition - sets the `message_id` field to Set
    pub struct SetMessageId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessageId<St> {}
    impl<St: State> State for SetMessageId<St> {
        type ConvoId = St::ConvoId;
        type Did = St::Did;
        type MessageId = Set<members::message_id>;
    }
    /// 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 `did` field
        pub struct did(());
        ///Marker type for the `message_id` field
        pub struct message_id(());
    }
}

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

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

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

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

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

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

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

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

impl<St, S: BosStr> MessageRefBuilder<St, S>
where
    St: message_ref_state::State,
    St::ConvoId: message_ref_state::IsSet,
    St::Did: message_ref_state::IsSet,
    St::MessageId: message_ref_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> MessageRef<S> {
        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<SmolStr, Data<S>>,
    ) -> MessageRef<S> {
        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 Rev;
        type Sender;
        type SentAt;
        type Text;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type Rev = Unset;
        type Sender = Unset;
        type SentAt = Unset;
        type Text = Unset;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetId<St> {}
    impl<St: State> State for SetId<St> {
        type Id = Set<members::id>;
        type Rev = St::Rev;
        type Sender = St::Sender;
        type SentAt = St::SentAt;
        type Text = St::Text;
    }
    ///State transition - sets the `rev` field to Set
    pub struct SetRev<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRev<St> {}
    impl<St: State> State for SetRev<St> {
        type Id = St::Id;
        type Rev = Set<members::rev>;
        type Sender = St::Sender;
        type SentAt = St::SentAt;
        type Text = St::Text;
    }
    ///State transition - sets the `sender` field to Set
    pub struct SetSender<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSender<St> {}
    impl<St: State> State for SetSender<St> {
        type Id = St::Id;
        type Rev = St::Rev;
        type Sender = Set<members::sender>;
        type SentAt = St::SentAt;
        type Text = St::Text;
    }
    ///State transition - sets the `sent_at` field to Set
    pub struct SetSentAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSentAt<St> {}
    impl<St: State> State for SetSentAt<St> {
        type Id = St::Id;
        type Rev = St::Rev;
        type Sender = St::Sender;
        type SentAt = Set<members::sent_at>;
        type Text = St::Text;
    }
    ///State transition - sets the `text` field to Set
    pub struct SetText<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetText<St> {}
    impl<St: State> State for SetText<St> {
        type Id = St::Id;
        type Rev = St::Rev;
        type Sender = St::Sender;
        type SentAt = St::SentAt;
        type Text = Set<members::text>;
    }
    /// 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 `rev` field
        pub struct rev(());
        ///Marker type for the `sender` field
        pub struct sender(());
        ///Marker type for the `sent_at` field
        pub struct sent_at(());
        ///Marker type for the `text` field
        pub struct text(());
    }
}

/// Builder for constructing an instance of this type.
pub struct MessageViewBuilder<St: message_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<MessageViewEmbed<S>>,
        Option<Vec<Facet<S>>>,
        Option<S>,
        Option<Vec<convo::ReactionView<S>>>,
        Option<MessageViewReplyTo<S>>,
        Option<S>,
        Option<convo::MessageViewSender<S>>,
        Option<Datetime>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

impl<St: message_view_state::State, S: BosStr> MessageViewBuilder<St, S> {
    /// Set the `facets` field (optional)
    pub fn facets(mut self, value: impl Into<Option<Vec<Facet<S>>>>) -> 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<S>>>) -> Self {
        self._fields.1 = value;
        self
    }
}

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

impl<St: message_view_state::State, S: BosStr> MessageViewBuilder<St, S> {
    /// Set the `reactions` field (optional)
    pub fn reactions(
        mut self,
        value: impl Into<Option<Vec<convo::ReactionView<S>>>>,
    ) -> 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<S>>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St: message_view_state::State, S: BosStr> MessageViewBuilder<St, S> {
    /// Set the `replyTo` field (optional)
    pub fn reply_to(mut self, value: impl Into<Option<MessageViewReplyTo<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `replyTo` field to an Option value (optional)
    pub fn maybe_reply_to(mut self, value: Option<MessageViewReplyTo<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

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

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

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

impl<St, S: BosStr> MessageViewBuilder<St, S>
where
    St: message_view_state::State,
    St::Id: message_view_state::IsSet,
    St::Rev: message_view_state::IsSet,
    St::Sender: message_view_state::IsSet,
    St::SentAt: message_view_state::IsSet,
    St::Text: message_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> MessageView<S> {
        MessageView {
            embed: self._fields.0,
            facets: self._fields.1,
            id: self._fields.2.unwrap(),
            reactions: self._fields.3,
            reply_to: self._fields.4,
            rev: self._fields.5.unwrap(),
            sender: self._fields.6.unwrap(),
            sent_at: self._fields.7.unwrap(),
            text: self._fields.8.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> MessageView<S> {
        MessageView {
            embed: self._fields.0,
            facets: self._fields.1,
            id: self._fields.2.unwrap(),
            reactions: self._fields.3,
            reply_to: self._fields.4,
            rev: self._fields.5.unwrap(),
            sender: self._fields.6.unwrap(),
            sent_at: self._fields.7.unwrap(),
            text: self._fields.8.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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Did = Set<members::did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `did` field
        pub struct did(());
    }
}

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

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

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

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

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

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

impl<St, S: BosStr> MessageViewSenderBuilder<St, S>
where
    St: message_view_sender_state::State,
    St::Did: message_view_sender_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> MessageViewSender<S> {
        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<SmolStr, Data<S>>,
    ) -> MessageViewSender<S> {
        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 CreatedAt;
        type Sender;
        type Value;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Sender = Unset;
        type Value = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
    impl<St: State> State for SetCreatedAt<St> {
        type CreatedAt = Set<members::created_at>;
        type Sender = St::Sender;
        type Value = St::Value;
    }
    ///State transition - sets the `sender` field to Set
    pub struct SetSender<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSender<St> {}
    impl<St: State> State for SetSender<St> {
        type CreatedAt = St::CreatedAt;
        type Sender = Set<members::sender>;
        type Value = St::Value;
    }
    ///State transition - sets the `value` field to Set
    pub struct SetValue<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetValue<St> {}
    impl<St: State> State for SetValue<St> {
        type CreatedAt = St::CreatedAt;
        type Sender = St::Sender;
        type Value = Set<members::value>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `sender` field
        pub struct sender(());
        ///Marker type for the `value` field
        pub struct value(());
    }
}

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

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

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

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

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

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

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

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

impl<St, S: BosStr> ReactionViewBuilder<St, S>
where
    St: reaction_view_state::State,
    St::CreatedAt: reaction_view_state::IsSet,
    St::Sender: reaction_view_state::IsSet,
    St::Value: reaction_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReactionView<S> {
        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<SmolStr, Data<S>>,
    ) -> ReactionView<S> {
        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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetDid<St> {}
    impl<St: State> State for SetDid<St> {
        type Did = Set<members::did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `did` field
        pub struct did(());
    }
}

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

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

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

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

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

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

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

pub mod system_message_data_add_member_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 AddedBy;
        type Member;
        type Role;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type AddedBy = Unset;
        type Member = Unset;
        type Role = Unset;
    }
    ///State transition - sets the `added_by` field to Set
    pub struct SetAddedBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAddedBy<St> {}
    impl<St: State> State for SetAddedBy<St> {
        type AddedBy = Set<members::added_by>;
        type Member = St::Member;
        type Role = St::Role;
    }
    ///State transition - sets the `member` field to Set
    pub struct SetMember<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMember<St> {}
    impl<St: State> State for SetMember<St> {
        type AddedBy = St::AddedBy;
        type Member = Set<members::member>;
        type Role = St::Role;
    }
    ///State transition - sets the `role` field to Set
    pub struct SetRole<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRole<St> {}
    impl<St: State> State for SetRole<St> {
        type AddedBy = St::AddedBy;
        type Member = St::Member;
        type Role = Set<members::role>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `added_by` field
        pub struct added_by(());
        ///Marker type for the `member` field
        pub struct member(());
        ///Marker type for the `role` field
        pub struct role(());
    }
}

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

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

impl<S: BosStr> SystemMessageDataAddMember<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataAddMemberBuilder<
        system_message_data_add_member_state::Empty,
        S,
    > {
        SystemMessageDataAddMemberBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataAddMemberBuilder<St, S>
where
    St: system_message_data_add_member_state::State,
    St::AddedBy: system_message_data_add_member_state::IsUnset,
{
    /// Set the `addedBy` field (required)
    pub fn added_by(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataAddMemberBuilder<
        system_message_data_add_member_state::SetAddedBy<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataAddMemberBuilder<St, S>
where
    St: system_message_data_add_member_state::State,
    St::Member: system_message_data_add_member_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataAddMemberBuilder<
        system_message_data_add_member_state::SetMember<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        SystemMessageDataAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataAddMemberBuilder<St, S>
where
    St: system_message_data_add_member_state::State,
    St::Role: system_message_data_add_member_state::IsUnset,
{
    /// Set the `role` field (required)
    pub fn role(
        mut self,
        value: impl Into<MemberRole<S>>,
    ) -> SystemMessageDataAddMemberBuilder<
        system_message_data_add_member_state::SetRole<St>,
        S,
    > {
        self._fields.2 = Option::Some(value.into());
        SystemMessageDataAddMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataAddMemberBuilder<St, S>
where
    St: system_message_data_add_member_state::State,
    St::AddedBy: system_message_data_add_member_state::IsSet,
    St::Member: system_message_data_add_member_state::IsSet,
    St::Role: system_message_data_add_member_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataAddMember<S> {
        SystemMessageDataAddMember {
            added_by: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            role: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> SystemMessageDataAddMember<S> {
        SystemMessageDataAddMember {
            added_by: self._fields.0.unwrap(),
            member: self._fields.1.unwrap(),
            role: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataLockConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataLockConvoBuilder<
        system_message_data_lock_convo_state::Empty,
        S,
    > {
        SystemMessageDataLockConvoBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataLockConvoBuilder<St, S>
where
    St: system_message_data_lock_convo_state::State,
    St::LockedBy: system_message_data_lock_convo_state::IsUnset,
{
    /// Set the `lockedBy` field (required)
    pub fn locked_by(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataLockConvoBuilder<
        system_message_data_lock_convo_state::SetLockedBy<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataLockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataLockConvoBuilder<St, S>
where
    St: system_message_data_lock_convo_state::State,
    St::LockedBy: system_message_data_lock_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataLockConvo<S> {
        SystemMessageDataLockConvo {
            locked_by: 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<SmolStr, Data<S>>,
    ) -> SystemMessageDataLockConvo<S> {
        SystemMessageDataLockConvo {
            locked_by: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataLockConvoPermanently<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataLockConvoPermanentlyBuilder<
        system_message_data_lock_convo_permanently_state::Empty,
        S,
    > {
        SystemMessageDataLockConvoPermanentlyBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataLockConvoPermanentlyBuilder<St, S>
where
    St: system_message_data_lock_convo_permanently_state::State,
    St::LockedBy: system_message_data_lock_convo_permanently_state::IsUnset,
{
    /// Set the `lockedBy` field (required)
    pub fn locked_by(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataLockConvoPermanentlyBuilder<
        system_message_data_lock_convo_permanently_state::SetLockedBy<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataLockConvoPermanentlyBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataLockConvoPermanentlyBuilder<St, S>
where
    St: system_message_data_lock_convo_permanently_state::State,
    St::LockedBy: system_message_data_lock_convo_permanently_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataLockConvoPermanently<S> {
        SystemMessageDataLockConvoPermanently {
            locked_by: 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<SmolStr, Data<S>>,
    ) -> SystemMessageDataLockConvoPermanently<S> {
        SystemMessageDataLockConvoPermanently {
            locked_by: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataMemberJoin<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataMemberJoinBuilder<
        system_message_data_member_join_state::Empty,
        S,
    > {
        SystemMessageDataMemberJoinBuilder::builder()
    }
}

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

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

impl<
    St: system_message_data_member_join_state::State,
    S: BosStr,
> SystemMessageDataMemberJoinBuilder<St, S> {
    /// Set the `approvedBy` field (optional)
    pub fn approved_by(
        mut self,
        value: impl Into<Option<convo::SystemMessageReferredUser<S>>>,
    ) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `approvedBy` field to an Option value (optional)
    pub fn maybe_approved_by(
        mut self,
        value: Option<convo::SystemMessageReferredUser<S>>,
    ) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St, S: BosStr> SystemMessageDataMemberJoinBuilder<St, S>
where
    St: system_message_data_member_join_state::State,
    St::Member: system_message_data_member_join_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataMemberJoinBuilder<
        system_message_data_member_join_state::SetMember<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        SystemMessageDataMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataMemberJoinBuilder<St, S>
where
    St: system_message_data_member_join_state::State,
    St::Role: system_message_data_member_join_state::IsUnset,
{
    /// Set the `role` field (required)
    pub fn role(
        mut self,
        value: impl Into<MemberRole<S>>,
    ) -> SystemMessageDataMemberJoinBuilder<
        system_message_data_member_join_state::SetRole<St>,
        S,
    > {
        self._fields.2 = Option::Some(value.into());
        SystemMessageDataMemberJoinBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataMemberJoinBuilder<St, S>
where
    St: system_message_data_member_join_state::State,
    St::Member: system_message_data_member_join_state::IsSet,
    St::Role: system_message_data_member_join_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataMemberJoin<S> {
        SystemMessageDataMemberJoin {
            approved_by: self._fields.0,
            member: self._fields.1.unwrap(),
            role: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> SystemMessageDataMemberJoin<S> {
        SystemMessageDataMemberJoin {
            approved_by: self._fields.0,
            member: self._fields.1.unwrap(),
            role: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataMemberLeave<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataMemberLeaveBuilder<
        system_message_data_member_leave_state::Empty,
        S,
    > {
        SystemMessageDataMemberLeaveBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataMemberLeaveBuilder<St, S>
where
    St: system_message_data_member_leave_state::State,
    St::Member: system_message_data_member_leave_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataMemberLeaveBuilder<
        system_message_data_member_leave_state::SetMember<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataMemberLeaveBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataMemberLeaveBuilder<St, S>
where
    St: system_message_data_member_leave_state::State,
    St::Member: system_message_data_member_leave_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataMemberLeave<S> {
        SystemMessageDataMemberLeave {
            member: 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<SmolStr, Data<S>>,
    ) -> SystemMessageDataMemberLeave<S> {
        SystemMessageDataMemberLeave {
            member: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataRemoveMember<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataRemoveMemberBuilder<
        system_message_data_remove_member_state::Empty,
        S,
    > {
        SystemMessageDataRemoveMemberBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataRemoveMemberBuilder<St, S>
where
    St: system_message_data_remove_member_state::State,
    St::Member: system_message_data_remove_member_state::IsUnset,
{
    /// Set the `member` field (required)
    pub fn member(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataRemoveMemberBuilder<
        system_message_data_remove_member_state::SetMember<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataRemoveMemberBuilder<St, S>
where
    St: system_message_data_remove_member_state::State,
    St::RemovedBy: system_message_data_remove_member_state::IsUnset,
{
    /// Set the `removedBy` field (required)
    pub fn removed_by(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataRemoveMemberBuilder<
        system_message_data_remove_member_state::SetRemovedBy<St>,
        S,
    > {
        self._fields.1 = Option::Some(value.into());
        SystemMessageDataRemoveMemberBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataRemoveMemberBuilder<St, S>
where
    St: system_message_data_remove_member_state::State,
    St::Member: system_message_data_remove_member_state::IsSet,
    St::RemovedBy: system_message_data_remove_member_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataRemoveMember<S> {
        SystemMessageDataRemoveMember {
            member: self._fields.0.unwrap(),
            removed_by: 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<SmolStr, Data<S>>,
    ) -> SystemMessageDataRemoveMember<S> {
        SystemMessageDataRemoveMember {
            member: self._fields.0.unwrap(),
            removed_by: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageDataUnlockConvo<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageDataUnlockConvoBuilder<
        system_message_data_unlock_convo_state::Empty,
        S,
    > {
        SystemMessageDataUnlockConvoBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageDataUnlockConvoBuilder<St, S>
where
    St: system_message_data_unlock_convo_state::State,
    St::UnlockedBy: system_message_data_unlock_convo_state::IsUnset,
{
    /// Set the `unlockedBy` field (required)
    pub fn unlocked_by(
        mut self,
        value: impl Into<convo::SystemMessageReferredUser<S>>,
    ) -> SystemMessageDataUnlockConvoBuilder<
        system_message_data_unlock_convo_state::SetUnlockedBy<St>,
        S,
    > {
        self._fields.0 = Option::Some(value.into());
        SystemMessageDataUnlockConvoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageDataUnlockConvoBuilder<St, S>
where
    St: system_message_data_unlock_convo_state::State,
    St::UnlockedBy: system_message_data_unlock_convo_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageDataUnlockConvo<S> {
        SystemMessageDataUnlockConvo {
            unlocked_by: 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<SmolStr, Data<S>>,
    ) -> SystemMessageDataUnlockConvo<S> {
        SystemMessageDataUnlockConvo {
            unlocked_by: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod system_message_referred_user_state {

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

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

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

impl<S: BosStr> SystemMessageReferredUser<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageReferredUserBuilder<
        system_message_referred_user_state::Empty,
        S,
    > {
        SystemMessageReferredUserBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> SystemMessageReferredUserBuilder<St, S>
where
    St: system_message_referred_user_state::State,
    St::Did: system_message_referred_user_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageReferredUser<S> {
        SystemMessageReferredUser {
            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<SmolStr, Data<S>>,
    ) -> SystemMessageReferredUser<S> {
        SystemMessageReferredUser {
            did: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> SystemMessageView<S> {
    /// Create a new builder for this type
    pub fn builder() -> SystemMessageViewBuilder<system_message_view_state::Empty, S> {
        SystemMessageViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> SystemMessageViewBuilder<St, S>
where
    St: system_message_view_state::State,
    St::Data: system_message_view_state::IsUnset,
{
    /// Set the `data` field (required)
    pub fn data(
        mut self,
        value: impl Into<SystemMessageViewData<S>>,
    ) -> SystemMessageViewBuilder<system_message_view_state::SetData<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SystemMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageViewBuilder<St, S>
where
    St: system_message_view_state::State,
    St::Id: system_message_view_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<S>,
    ) -> SystemMessageViewBuilder<system_message_view_state::SetId<St>, S> {
        self._fields.1 = Option::Some(value.into());
        SystemMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SystemMessageViewBuilder<St, S>
where
    St: system_message_view_state::State,
    St::Rev: system_message_view_state::IsUnset,
{
    /// Set the `rev` field (required)
    pub fn rev(
        mut self,
        value: impl Into<S>,
    ) -> SystemMessageViewBuilder<system_message_view_state::SetRev<St>, S> {
        self._fields.2 = Option::Some(value.into());
        SystemMessageViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> SystemMessageViewBuilder<St, S>
where
    St: system_message_view_state::State,
    St::Data: system_message_view_state::IsSet,
    St::Id: system_message_view_state::IsSet,
    St::Rev: system_message_view_state::IsSet,
    St::SentAt: system_message_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SystemMessageView<S> {
        SystemMessageView {
            data: self._fields.0.unwrap(),
            id: self._fields.1.unwrap(),
            rev: 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<SmolStr, Data<S>>,
    ) -> SystemMessageView<S> {
        SystemMessageView {
            data: self._fields.0.unwrap(),
            id: self._fields.1.unwrap(),
            rev: self._fields.2.unwrap(),
            sent_at: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}