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

//! Generated bindings for the `tools.ozone.moderation` Lexicon namespace/module.
pub mod cancel_scheduled_actions;
pub mod emit_event;
pub mod get_account_timeline;
pub mod get_event;
pub mod get_record;
pub mod get_records;
pub mod get_repo;
pub mod get_reporter_stats;
pub mod get_repos;
pub mod get_subjects;
pub mod list_scheduled_actions;
pub mod query_events;
pub mod query_statuses;
pub mod schedule_action;
pub mod search_repos;


#[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, Handle, AtUri, Cid, Datetime, UriValue};
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::ageassurance::Access;
use crate::chat_bsky::convo::ConvoRef;
use crate::chat_bsky::convo::MessageRef;
use crate::com_atproto::admin::RepoRef;
use crate::com_atproto::admin::ThreatSignature;
use crate::com_atproto::label::Label;
use crate::com_atproto::moderation::ReasonType;
use crate::com_atproto::moderation::SubjectType;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::com_atproto::server::InviteCode;
use crate::tools_ozone::moderation;
/// Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AccountEvent<S: BosStr = DefaultStr> {
    ///Indicates that the account has a repository which can be fetched from the host that emitted this event.
    pub active: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<AccountEventStatus<S>>,
    pub timestamp: Datetime,
    #[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 AccountEventStatus<S: BosStr = DefaultStr> {
    Unknown,
    Deactivated,
    Deleted,
    Takendown,
    Suspended,
    Tombstoned,
    Other(S),
}

impl<S: BosStr> AccountEventStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Unknown => "unknown",
            Self::Deactivated => "deactivated",
            Self::Deleted => "deleted",
            Self::Takendown => "takendown",
            Self::Suspended => "suspended",
            Self::Tombstoned => "tombstoned",
            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() {
            "unknown" => Self::Unknown,
            "deactivated" => Self::Deactivated,
            "deleted" => Self::Deleted,
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "tombstoned" => Self::Tombstoned,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for AccountEventStatus<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 AccountEventStatus<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 + Default> Default for AccountEventStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for AccountEventStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = AccountEventStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            AccountEventStatus::Unknown => AccountEventStatus::Unknown,
            AccountEventStatus::Deactivated => AccountEventStatus::Deactivated,
            AccountEventStatus::Deleted => AccountEventStatus::Deleted,
            AccountEventStatus::Takendown => AccountEventStatus::Takendown,
            AccountEventStatus::Suspended => AccountEventStatus::Suspended,
            AccountEventStatus::Tombstoned => AccountEventStatus::Tombstoned,
            AccountEventStatus::Other(v) => AccountEventStatus::Other(v.into_static()),
        }
    }
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AccountHosting<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reactivated_at: Option<Datetime>,
    pub status: AccountHostingStatus<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    #[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 AccountHostingStatus<S: BosStr = DefaultStr> {
    Takendown,
    Suspended,
    Deleted,
    Deactivated,
    Unknown,
    Other(S),
}

impl<S: BosStr> AccountHostingStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Takendown => "takendown",
            Self::Suspended => "suspended",
            Self::Deleted => "deleted",
            Self::Deactivated => "deactivated",
            Self::Unknown => "unknown",
            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() {
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "deleted" => Self::Deleted,
            "deactivated" => Self::Deactivated,
            "unknown" => Self::Unknown,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for AccountHostingStatus<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 AccountHostingStatus<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 + Default> Default for AccountHostingStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for AccountHostingStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = AccountHostingStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            AccountHostingStatus::Takendown => AccountHostingStatus::Takendown,
            AccountHostingStatus::Suspended => AccountHostingStatus::Suspended,
            AccountHostingStatus::Deleted => AccountHostingStatus::Deleted,
            AccountHostingStatus::Deactivated => AccountHostingStatus::Deactivated,
            AccountHostingStatus::Unknown => AccountHostingStatus::Unknown,
            AccountHostingStatus::Other(v) => {
                AccountHostingStatus::Other(v.into_static())
            }
        }
    }
}

/// Statistics about a particular account subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AccountStats<S: BosStr = DefaultStr> {
    ///Total number of appeals against a moderation action on the account
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appeal_count: Option<i64>,
    ///Number of times the account was escalated
    #[serde(skip_serializing_if = "Option::is_none")]
    pub escalate_count: Option<i64>,
    ///Total number of reports on the account
    #[serde(skip_serializing_if = "Option::is_none")]
    pub report_count: Option<i64>,
    ///Number of times the account was suspended
    #[serde(skip_serializing_if = "Option::is_none")]
    pub suspend_count: Option<i64>,
    ///Number of times the account was taken down
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takedown_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Strike information for an account

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AccountStrike<S: BosStr = DefaultStr> {
    ///Current number of active strikes (excluding expired strikes)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub active_strike_count: Option<i64>,
    ///Timestamp of the first strike received
    #[serde(skip_serializing_if = "Option::is_none")]
    pub first_strike_at: Option<Datetime>,
    ///Timestamp of the most recent strike received
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_strike_at: Option<Datetime>,
    ///Total number of strikes ever received (including expired strikes)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_strike_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Age assurance info coming directly from users. Only works on DID subjects.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AgeAssuranceEvent<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub access: Option<Access<S>>,
    ///The unique identifier for this instance of the age assurance flow, in UUID format.
    pub attempt_id: S,
    ///The IP address used when completing the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complete_ip: Option<S>,
    ///The user agent used when completing the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complete_ua: Option<S>,
    ///The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub country_code: Option<S>,
    ///The date and time of this write operation.
    pub created_at: Datetime,
    ///The IP address used when initiating the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub init_ip: Option<S>,
    ///The user agent used when initiating the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub init_ua: Option<S>,
    ///The ISO 3166-2 region code provided when beginning the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub region_code: Option<S>,
    ///The status of the Age Assurance process.
    pub status: AgeAssuranceEventStatus<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The status of the Age Assurance process.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AgeAssuranceEventStatus<S: BosStr = DefaultStr> {
    Unknown,
    Pending,
    Assured,
    Other(S),
}

impl<S: BosStr> AgeAssuranceEventStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Unknown => "unknown",
            Self::Pending => "pending",
            Self::Assured => "assured",
            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() {
            "unknown" => Self::Unknown,
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for AgeAssuranceEventStatus<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 AgeAssuranceEventStatus<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 + Default> Default for AgeAssuranceEventStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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

/// Age assurance status override by moderators. Only works on DID subjects.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AgeAssuranceOverrideEvent<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub access: Option<Access<S>>,
    ///Comment describing the reason for the override.
    pub comment: S,
    ///The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state.
    pub status: AgeAssuranceOverrideEventStatus<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AgeAssuranceOverrideEventStatus<S: BosStr = DefaultStr> {
    Assured,
    Reset,
    Blocked,
    Other(S),
}

impl<S: BosStr> AgeAssuranceOverrideEventStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Assured => "assured",
            Self::Reset => "reset",
            Self::Blocked => "blocked",
            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() {
            "assured" => Self::Assured,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for AgeAssuranceOverrideEventStatus<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 AgeAssuranceOverrideEventStatus<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 + Default> Default for AgeAssuranceOverrideEventStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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

/// Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct AgeAssurancePurgeEvent<S: BosStr = DefaultStr> {
    ///Comment describing the reason for the purge.
    pub comment: 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 BlobView<S: BosStr = DefaultStr> {
    pub cid: Cid<S>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub details: Option<BlobViewDetails<S>>,
    pub mime_type: S,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub moderation: Option<moderation::Moderation<S>>,
    pub size: 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 BlobViewDetails<S: BosStr = DefaultStr> {
    #[serde(rename = "tools.ozone.moderation.defs#imageDetails")]
    ImageDetails(Box<moderation::ImageDetails<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#videoDetails")]
    VideoDetails(Box<moderation::VideoDetails<S>>),
}

/// Logs cancellation of a scheduled takedown action for an account.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CancelScheduledTakedownEvent<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<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 ConvoView<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>>>,
}

/// Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct IdentityEvent<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handle: Option<Handle<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pds_host: Option<UriValue<S>>,
    pub timestamp: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tombstone: Option<bool>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ImageDetails<S: BosStr = DefaultStr> {
    pub height: i64,
    pub width: i64,
    #[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 ModEventAcknowledge<S: BosStr = DefaultStr> {
    ///If true, all other reports on content authored by this account will be resolved (acknowledged).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acknowledge_account_subjects: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Add a comment to a subject. An empty comment will clear any previously set sticky comment.

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

/// Divert a record's blobs to a 3rd party service for further scanning/tagging

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

/// Keep a log of outgoing email to a user

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventEmail<S: BosStr = DefaultStr> {
    ///Additional comment about the outgoing comm.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///The content of the email sent to the user.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub content: Option<S>,
    ///Indicates whether the email was successfully delivered to the user's inbox.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub is_delivered: Option<bool>,
    ///Names/Keywords of the policies that necessitated the email.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<S>>,
    ///Severity level of the violation. Normally 'sev-1' that adds strike on repeat offense
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<S>,
    ///Number of strikes to assign to the user for this violation. Normally 0 as an indicator of a warning and only added as a strike on a repeat offense.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
    ///When the strike should expire. If not provided, the strike never expires.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_expires_at: Option<Datetime>,
    ///The subject line of the email sent to the user.
    pub subject_line: 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 ModEventEscalate<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Apply/Negate labels on a subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventLabel<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    pub create_label_vals: Vec<S>,
    ///Indicates how long the label will remain on the subject. Only applies on labels that are being added.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    pub negate_label_vals: Vec<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Mute incoming reports on a subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventMute<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Indicates how long the subject should remain muted.
    pub duration_in_hours: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Mute incoming reports from an account

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventMuteReporter<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Indicates how long the account should remain muted. Falsy value here means a permanent mute.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Set priority score of the subject. Higher score means higher priority.

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

/// Report a subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventReport<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub is_reporter_muted: Option<bool>,
    pub report_type: ReasonType<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Resolve appeal on a subject

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

/// Revert take down action on a subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventReverseTakedown<S: BosStr = DefaultStr> {
    ///Describe reasoning behind the reversal.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Names/Keywords of the policy infraction for which takedown is being reversed.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<S>>,
    ///Severity level of the violation. Usually set from the last policy infraction's severity.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<S>,
    ///Number of strikes to subtract from the user's strike count. Usually set from the last policy infraction's severity.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Add/Remove a tag on a subject

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventTag<S: BosStr = DefaultStr> {
    ///Tags to be added to the subject. If already exists, won't be duplicated.
    pub add: Vec<S>,
    ///Additional comment about added/removed tags.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Indicates how long the tags being added should remain before automatically being removed. Only applies to tags being added.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    ///Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated.
    pub remove: Vec<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Take down a subject permanently or temporarily

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventTakedown<S: BosStr = DefaultStr> {
    ///If true, all other reports on content authored by this account will be resolved (acknowledged).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acknowledge_account_subjects: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Indicates how long the takedown should be in effect before automatically expiring.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    ///Names/Keywords of the policies that drove the decision.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<S>>,
    ///Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<S>,
    ///Number of strikes to assign to the user for this violation.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
    ///When the strike should expire. If not provided, the strike never expires.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_expires_at: Option<Datetime>,
    ///List of services where the takedown should be applied. If empty or not provided, takedown is applied on all configured services.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub target_services: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Unmute action on a subject

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

/// Unmute incoming reports from an account

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventUnmuteReporter<S: BosStr = DefaultStr> {
    ///Describe reasoning behind the reversal.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<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 ModEventView<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    pub created_by: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub creator_handle: Option<S>,
    pub event: ModEventViewEvent<S>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mod_tool: Option<moderation::ModTool<S>>,
    pub subject: ModEventViewSubject<S>,
    pub subject_blob_cids: Vec<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_handle: Option<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 ModEventViewEvent<S: BosStr = DefaultStr> {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    ModEventTakedown(Box<moderation::ModEventTakedown<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    ModEventReverseTakedown(Box<moderation::ModEventReverseTakedown<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    ModEventComment(Box<moderation::ModEventComment<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    ModEventReport(Box<moderation::ModEventReport<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    ModEventLabel(Box<moderation::ModEventLabel<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    ModEventAcknowledge(Box<moderation::ModEventAcknowledge<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    ModEventEscalate(Box<moderation::ModEventEscalate<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    ModEventMute(Box<moderation::ModEventMute<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    ModEventUnmute(Box<moderation::ModEventUnmute<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    ModEventMuteReporter(Box<moderation::ModEventMuteReporter<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    ModEventUnmuteReporter(Box<moderation::ModEventUnmuteReporter<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    ModEventEmail(Box<moderation::ModEventEmail<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    ModEventResolveAppeal(Box<moderation::ModEventResolveAppeal<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    ModEventDivert(Box<moderation::ModEventDivert<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    ModEventTag(Box<moderation::ModEventTag<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    AccountEvent(Box<moderation::AccountEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    IdentityEvent(Box<moderation::IdentityEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    RecordEvent(Box<moderation::RecordEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    ModEventPriorityScore(Box<moderation::ModEventPriorityScore<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    AgeAssuranceEvent(Box<moderation::AgeAssuranceEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    AgeAssuranceOverrideEvent(Box<moderation::AgeAssuranceOverrideEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssurancePurgeEvent")]
    AgeAssurancePurgeEvent(Box<moderation::AgeAssurancePurgeEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    RevokeAccountCredentialsEvent(Box<moderation::RevokeAccountCredentialsEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    ScheduleTakedownEvent(Box<moderation::ScheduleTakedownEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    CancelScheduledTakedownEvent(Box<moderation::CancelScheduledTakedownEvent<S>>),
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ModEventViewSubject<S: BosStr = DefaultStr> {
    #[serde(rename = "com.atproto.admin.defs#repoRef")]
    RepoRef(Box<RepoRef<S>>),
    #[serde(rename = "com.atproto.repo.strongRef")]
    StrongRef(Box<StrongRef<S>>),
    #[serde(rename = "chat.bsky.convo.defs#messageRef")]
    MessageRef(Box<MessageRef<S>>),
    #[serde(rename = "chat.bsky.convo.defs#convoRef")]
    ConvoRef(Box<ConvoRef<S>>),
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModEventViewDetail<S: BosStr = DefaultStr> {
    pub created_at: Datetime,
    pub created_by: Did<S>,
    pub event: ModEventViewDetailEvent<S>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mod_tool: Option<moderation::ModTool<S>>,
    pub subject: ModEventViewDetailSubject<S>,
    pub subject_blobs: Vec<moderation::BlobView<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 ModEventViewDetailEvent<S: BosStr = DefaultStr> {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    ModEventTakedown(Box<moderation::ModEventTakedown<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    ModEventReverseTakedown(Box<moderation::ModEventReverseTakedown<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    ModEventComment(Box<moderation::ModEventComment<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    ModEventReport(Box<moderation::ModEventReport<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    ModEventLabel(Box<moderation::ModEventLabel<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    ModEventAcknowledge(Box<moderation::ModEventAcknowledge<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    ModEventEscalate(Box<moderation::ModEventEscalate<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    ModEventMute(Box<moderation::ModEventMute<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    ModEventUnmute(Box<moderation::ModEventUnmute<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    ModEventMuteReporter(Box<moderation::ModEventMuteReporter<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    ModEventUnmuteReporter(Box<moderation::ModEventUnmuteReporter<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    ModEventEmail(Box<moderation::ModEventEmail<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    ModEventResolveAppeal(Box<moderation::ModEventResolveAppeal<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    ModEventDivert(Box<moderation::ModEventDivert<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    ModEventTag(Box<moderation::ModEventTag<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    AccountEvent(Box<moderation::AccountEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    IdentityEvent(Box<moderation::IdentityEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    RecordEvent(Box<moderation::RecordEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    ModEventPriorityScore(Box<moderation::ModEventPriorityScore<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    AgeAssuranceEvent(Box<moderation::AgeAssuranceEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    AgeAssuranceOverrideEvent(Box<moderation::AgeAssuranceOverrideEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssurancePurgeEvent")]
    AgeAssurancePurgeEvent(Box<moderation::AgeAssurancePurgeEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    RevokeAccountCredentialsEvent(Box<moderation::RevokeAccountCredentialsEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    ScheduleTakedownEvent(Box<moderation::ScheduleTakedownEvent<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    CancelScheduledTakedownEvent(Box<moderation::CancelScheduledTakedownEvent<S>>),
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum ModEventViewDetailSubject<S: BosStr = DefaultStr> {
    #[serde(rename = "tools.ozone.moderation.defs#repoView")]
    RepoView(Box<moderation::RepoView<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#repoViewNotFound")]
    RepoViewNotFound(Box<moderation::RepoViewNotFound<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordView")]
    RecordView(Box<moderation::RecordView<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordViewNotFound")]
    RecordViewNotFound(Box<moderation::RecordViewNotFound<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#convoView")]
    ConvoView(Box<moderation::ConvoView<S>>),
}

/// Moderation tool information for tracing the source of the action

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ModTool<S: BosStr = DefaultStr> {
    ///Additional arbitrary metadata about the source
    #[serde(skip_serializing_if = "Option::is_none")]
    pub meta: Option<Data<S>>,
    ///Name/identifier of the source (e.g., 'automod', 'ozone/workspace')
    pub name: 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 Moderation<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_status: Option<moderation::SubjectStatusView<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 ModerationDetail<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_status: Option<moderation::SubjectStatusView<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordEvent<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<Cid<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    pub op: RecordEventOp<S>,
    pub timestamp: Datetime,
    #[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 RecordEventOp<S: BosStr = DefaultStr> {
    Create,
    Update,
    Delete,
    Other(S),
}

impl<S: BosStr> RecordEventOp<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Create => "create",
            Self::Update => "update",
            Self::Delete => "delete",
            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() {
            "create" => Self::Create,
            "update" => Self::Update,
            "delete" => Self::Delete,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for RecordEventOp<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 RecordEventOp<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 + Default> Default for RecordEventOp<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordHosting<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<Datetime>,
    pub status: RecordHostingStatus<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    #[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 RecordHostingStatus<S: BosStr = DefaultStr> {
    Deleted,
    Unknown,
    Other(S),
}

impl<S: BosStr> RecordHostingStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Deleted => "deleted",
            Self::Unknown => "unknown",
            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() {
            "deleted" => Self::Deleted,
            "unknown" => Self::Unknown,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for RecordHostingStatus<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 RecordHostingStatus<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 + Default> Default for RecordHostingStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordView<S: BosStr = DefaultStr> {
    pub blob_cids: Vec<Cid<S>>,
    pub cid: Cid<S>,
    pub indexed_at: Datetime,
    pub moderation: moderation::Moderation<S>,
    pub repo: moderation::RepoView<S>,
    pub uri: AtUri<S>,
    pub value: Data<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 RecordViewDetail<S: BosStr = DefaultStr> {
    pub blobs: Vec<moderation::BlobView<S>>,
    pub cid: Cid<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<Label<S>>>,
    pub moderation: moderation::ModerationDetail<S>,
    pub repo: moderation::RepoView<S>,
    pub uri: AtUri<S>,
    pub value: Data<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 RecordViewNotFound<S: BosStr = DefaultStr> {
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Statistics about a set of record subject items

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct RecordsStats<S: BosStr = DefaultStr> {
    ///Number of items that were appealed at least once
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appealed_count: Option<i64>,
    ///Number of items that were escalated at least once
    #[serde(skip_serializing_if = "Option::is_none")]
    pub escalated_count: Option<i64>,
    ///Number of item currently in "reviewOpen" or "reviewEscalated" state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pending_count: Option<i64>,
    ///Number of item currently in "reviewNone" or "reviewClosed" state
    #[serde(skip_serializing_if = "Option::is_none")]
    pub processed_count: Option<i64>,
    ///Number of items that were reported at least once
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reported_count: Option<i64>,
    ///Total number of item in the set
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_count: Option<i64>,
    ///Number of item currently taken down
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takendown_count: Option<i64>,
    ///Cumulative sum of the number of reports on the items in the set
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_reports: Option<i64>,
    #[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 RepoView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<Datetime>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<S>,
    pub handle: Handle<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invite_note: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invited_by: Option<InviteCode<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    pub moderation: moderation::Moderation<S>,
    pub related_records: Vec<Data<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub threat_signatures: Option<Vec<ThreatSignature<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 RepoViewDetail<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<Datetime>,
    pub did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email_confirmed_at: Option<Datetime>,
    pub handle: Handle<S>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invite_note: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invited_by: Option<InviteCode<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites: Option<Vec<InviteCode<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<Label<S>>>,
    pub moderation: moderation::ModerationDetail<S>,
    pub related_records: Vec<Data<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub threat_signatures: Option<Vec<ThreatSignature<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 RepoViewNotFound<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 ReporterStats<S: BosStr = DefaultStr> {
    ///The total number of reports made by the user on accounts.
    pub account_report_count: i64,
    pub did: Did<S>,
    ///The total number of accounts labeled as a result of the user's reports.
    pub labeled_account_count: i64,
    ///The total number of records labeled as a result of the user's reports.
    pub labeled_record_count: i64,
    ///The total number of reports made by the user on records.
    pub record_report_count: i64,
    ///The total number of accounts reported by the user.
    pub reported_account_count: i64,
    ///The total number of records reported by the user.
    pub reported_record_count: i64,
    ///The total number of accounts taken down as a result of the user's reports.
    pub takendown_account_count: i64,
    ///The total number of records taken down as a result of the user's reports.
    pub takendown_record_count: i64,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Moderator review status of a subject: Closed. Indicates that the subject was already reviewed and resolved by a moderator

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct ReviewClosed;
impl core::fmt::Display for ReviewClosed {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "reviewClosed")
    }
}

/// Moderator review status of a subject: Escalated. Indicates that the subject was escalated for review by a moderator

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct ReviewEscalated;
impl core::fmt::Display for ReviewEscalated {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "reviewEscalated")
    }
}

/// Moderator review status of a subject: Unnecessary. Indicates that the subject does not need a review at the moment but there is probably some moderation related metadata available for it

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct ReviewNone;
impl core::fmt::Display for ReviewNone {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "reviewNone")
    }
}

/// Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct ReviewOpen;
impl core::fmt::Display for ReviewOpen {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "reviewOpen")
    }
}

/// Account credentials revocation by moderators. Only works on DID subjects.

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

/// Logs a scheduled takedown action for an account.

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

/// View of a scheduled moderation action

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ScheduledActionView<S: BosStr = DefaultStr> {
    ///Type of action to be executed
    pub action: ScheduledActionViewAction<S>,
    ///When the scheduled action was created
    pub created_at: Datetime,
    ///DID of the user who created this scheduled action
    pub created_by: Did<S>,
    ///Subject DID for the action
    pub did: Did<S>,
    ///Serialized event object that will be propagated to the event when performed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub event_data: Option<Data<S>>,
    ///Earliest time to execute the action (for randomized scheduling)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_after: Option<Datetime>,
    ///Exact time to execute the action
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_at: Option<Datetime>,
    ///Latest time to execute the action (for randomized scheduling)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_until: Option<Datetime>,
    ///ID of the moderation event created when action was successfully executed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execution_event_id: Option<i64>,
    ///Auto-incrementing row ID
    pub id: i64,
    ///When the action was last attempted to be executed
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_executed_at: Option<Datetime>,
    ///Reason for the last execution failure
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_failure_reason: Option<S>,
    ///Whether execution time should be randomized within the specified range
    #[serde(skip_serializing_if = "Option::is_none")]
    pub randomize_execution: Option<bool>,
    ///Current status of the scheduled action
    pub status: ScheduledActionViewStatus<S>,
    ///When the scheduled action was last updated
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Type of action to be executed

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

impl<S: BosStr> ScheduledActionViewAction<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Takedown => "takedown",
            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() {
            "takedown" => Self::Takedown,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ScheduledActionViewAction<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 ScheduledActionViewAction<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 + Default> Default for ScheduledActionViewAction<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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

/// Current status of the scheduled action

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ScheduledActionViewStatus<S: BosStr = DefaultStr> {
    Pending,
    Executed,
    Cancelled,
    Failed,
    Other(S),
}

impl<S: BosStr> ScheduledActionViewStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Pending => "pending",
            Self::Executed => "executed",
            Self::Cancelled => "cancelled",
            Self::Failed => "failed",
            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() {
            "pending" => Self::Pending,
            "executed" => Self::Executed,
            "cancelled" => Self::Cancelled,
            "failed" => Self::Failed,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for ScheduledActionViewStatus<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 ScheduledActionViewStatus<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 + Default> Default for ScheduledActionViewStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ScheduledActionViewStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ScheduledActionViewStatus<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            ScheduledActionViewStatus::Pending => ScheduledActionViewStatus::Pending,
            ScheduledActionViewStatus::Executed => ScheduledActionViewStatus::Executed,
            ScheduledActionViewStatus::Cancelled => ScheduledActionViewStatus::Cancelled,
            ScheduledActionViewStatus::Failed => ScheduledActionViewStatus::Failed,
            ScheduledActionViewStatus::Other(v) => {
                ScheduledActionViewStatus::Other(v.into_static())
            }
        }
    }
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SubjectReviewState<S: BosStr = DefaultStr> {
    ToolsOzoneModerationDefsReviewOpen,
    ToolsOzoneModerationDefsReviewEscalated,
    ToolsOzoneModerationDefsReviewClosed,
    ToolsOzoneModerationDefsReviewNone,
    Other(S),
}

impl<S: BosStr> SubjectReviewState<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::ToolsOzoneModerationDefsReviewOpen => {
                "tools.ozone.moderation.defs#reviewOpen"
            }
            Self::ToolsOzoneModerationDefsReviewEscalated => {
                "tools.ozone.moderation.defs#reviewEscalated"
            }
            Self::ToolsOzoneModerationDefsReviewClosed => {
                "tools.ozone.moderation.defs#reviewClosed"
            }
            Self::ToolsOzoneModerationDefsReviewNone => {
                "tools.ozone.moderation.defs#reviewNone"
            }
            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() {
            "tools.ozone.moderation.defs#reviewOpen" => {
                Self::ToolsOzoneModerationDefsReviewOpen
            }
            "tools.ozone.moderation.defs#reviewEscalated" => {
                Self::ToolsOzoneModerationDefsReviewEscalated
            }
            "tools.ozone.moderation.defs#reviewClosed" => {
                Self::ToolsOzoneModerationDefsReviewClosed
            }
            "tools.ozone.moderation.defs#reviewNone" => {
                Self::ToolsOzoneModerationDefsReviewNone
            }
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for SubjectReviewState<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 SubjectReviewState<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 SubjectReviewState<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SubjectReviewState<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SubjectReviewState::ToolsOzoneModerationDefsReviewOpen => {
                SubjectReviewState::ToolsOzoneModerationDefsReviewOpen
            }
            SubjectReviewState::ToolsOzoneModerationDefsReviewEscalated => {
                SubjectReviewState::ToolsOzoneModerationDefsReviewEscalated
            }
            SubjectReviewState::ToolsOzoneModerationDefsReviewClosed => {
                SubjectReviewState::ToolsOzoneModerationDefsReviewClosed
            }
            SubjectReviewState::ToolsOzoneModerationDefsReviewNone => {
                SubjectReviewState::ToolsOzoneModerationDefsReviewNone
            }
            SubjectReviewState::Other(v) => SubjectReviewState::Other(v.into_static()),
        }
    }
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SubjectStatusView<S: BosStr = DefaultStr> {
    ///Statistics related to the account subject
    #[serde(skip_serializing_if = "Option::is_none")]
    pub account_stats: Option<moderation::AccountStats<S>>,
    ///Strike information for the account (account-level only)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub account_strike: Option<moderation::AccountStrike<S>>,
    ///Current age assurance state of the subject.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_assurance_state: Option<SubjectStatusViewAgeAssuranceState<S>>,
    ///Whether or not the last successful update to age assurance was made by the user or admin.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_assurance_updated_by: Option<SubjectStatusViewAgeAssuranceUpdatedBy<S>>,
    ///True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appealed: Option<bool>,
    ///Sticky comment on the subject.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Timestamp referencing the first moderation status impacting event was emitted on the subject
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hosting: Option<SubjectStatusViewHosting<S>>,
    pub id: i64,
    ///Timestamp referencing when the author of the subject appealed a moderation action
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_appealed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reported_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reviewed_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reviewed_by: Option<Did<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mute_reporting_until: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mute_until: Option<Datetime>,
    ///Numeric value representing the level of priority. Higher score means higher priority.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priority_score: Option<i64>,
    ///Statistics related to the record subjects authored by the subject's account
    #[serde(skip_serializing_if = "Option::is_none")]
    pub records_stats: Option<moderation::RecordsStats<S>>,
    pub review_state: moderation::SubjectReviewState<S>,
    pub subject: SubjectStatusViewSubject<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_blob_cids: Option<Vec<Cid<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_repo_handle: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub suspend_until: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takendown: Option<bool>,
    ///Timestamp referencing when the last update was made to the moderation status of the subject
    pub updated_at: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Current age assurance state of the subject.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SubjectStatusViewAgeAssuranceState<S: BosStr = DefaultStr> {
    Pending,
    Assured,
    Unknown,
    Reset,
    Blocked,
    Other(S),
}

impl<S: BosStr> SubjectStatusViewAgeAssuranceState<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Pending => "pending",
            Self::Assured => "assured",
            Self::Unknown => "unknown",
            Self::Reset => "reset",
            Self::Blocked => "blocked",
            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() {
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            "unknown" => Self::Unknown,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for SubjectStatusViewAgeAssuranceState<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 SubjectStatusViewAgeAssuranceState<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 + Default> Default for SubjectStatusViewAgeAssuranceState<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for SubjectStatusViewAgeAssuranceState<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = SubjectStatusViewAgeAssuranceState<S::Output>;
    fn into_static(self) -> Self::Output {
        match self {
            SubjectStatusViewAgeAssuranceState::Pending => {
                SubjectStatusViewAgeAssuranceState::Pending
            }
            SubjectStatusViewAgeAssuranceState::Assured => {
                SubjectStatusViewAgeAssuranceState::Assured
            }
            SubjectStatusViewAgeAssuranceState::Unknown => {
                SubjectStatusViewAgeAssuranceState::Unknown
            }
            SubjectStatusViewAgeAssuranceState::Reset => {
                SubjectStatusViewAgeAssuranceState::Reset
            }
            SubjectStatusViewAgeAssuranceState::Blocked => {
                SubjectStatusViewAgeAssuranceState::Blocked
            }
            SubjectStatusViewAgeAssuranceState::Other(v) => {
                SubjectStatusViewAgeAssuranceState::Other(v.into_static())
            }
        }
    }
}

/// Whether or not the last successful update to age assurance was made by the user or admin.

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

impl<S: BosStr> SubjectStatusViewAgeAssuranceUpdatedBy<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Admin => "admin",
            Self::User => "user",
            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() {
            "admin" => Self::Admin,
            "user" => Self::User,
            _ => Self::Other(s),
        }
    }
}

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

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

impl<S: BosStr> Serialize for SubjectStatusViewAgeAssuranceUpdatedBy<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 SubjectStatusViewAgeAssuranceUpdatedBy<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 + Default> Default for SubjectStatusViewAgeAssuranceUpdatedBy<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum SubjectStatusViewHosting<S: BosStr = DefaultStr> {
    #[serde(rename = "tools.ozone.moderation.defs#accountHosting")]
    AccountHosting(Box<moderation::AccountHosting<S>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordHosting")]
    RecordHosting(Box<moderation::RecordHosting<S>>),
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub enum SubjectStatusViewSubject<S: BosStr = DefaultStr> {
    #[serde(rename = "com.atproto.admin.defs#repoRef")]
    RepoRef(Box<RepoRef<S>>),
    #[serde(rename = "com.atproto.repo.strongRef")]
    StrongRef(Box<StrongRef<S>>),
    #[serde(rename = "chat.bsky.convo.defs#messageRef")]
    MessageRef(Box<MessageRef<S>>),
    #[serde(rename = "chat.bsky.convo.defs#convoRef")]
    ConvoRef(Box<ConvoRef<S>>),
}

/// Detailed view of a subject. For record subjects, the author's repo and profile will be returned.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct SubjectView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile: Option<Data<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub record: Option<moderation::RecordViewDetail<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub repo: Option<moderation::RepoViewDetail<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<moderation::SubjectStatusView<S>>,
    pub subject: S,
    pub r#type: SubjectType<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// Moderation event timeline event for a PLC create operation

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct TimelineEventPlcCreate;
impl core::fmt::Display for TimelineEventPlcCreate {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "timelineEventPlcCreate")
    }
}

/// Moderation event timeline event for generic PLC operation

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct TimelineEventPlcOperation;
impl core::fmt::Display for TimelineEventPlcOperation {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "timelineEventPlcOperation")
    }
}

/// Moderation event timeline event for a PLC tombstone operation

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct TimelineEventPlcTombstone;
impl core::fmt::Display for TimelineEventPlcTombstone {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "timelineEventPlcTombstone")
    }
}


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

impl<S: BosStr> LexiconSchema for AccountEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "accountEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AccountHosting<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "accountHosting"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AccountStats<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "accountStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AccountStrike<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "accountStrike"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AgeAssuranceEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "ageAssuranceEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AgeAssuranceOverrideEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "ageAssuranceOverrideEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.comment;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("comment"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for AgeAssurancePurgeEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "ageAssurancePurgeEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.comment;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("comment"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for BlobView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "blobView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for CancelScheduledTakedownEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "cancelScheduledTakedownEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ConvoView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "convoView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for IdentityEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "identityEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ImageDetails<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "imageDetails"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventAcknowledge<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventAcknowledge"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventComment<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventComment"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventDivert<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventDivert"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventEmail<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventEmail"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.policies {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("policies"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventEscalate<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventEscalate"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventLabel<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventLabel"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventMute<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventMute"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventMuteReporter<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventMuteReporter"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventPriorityScore<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventPriorityScore"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.score;
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("score"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        {
            let value = &self.score;
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("score"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventReport<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventReport"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventResolveAppeal<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventResolveAppeal"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventReverseTakedown<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventReverseTakedown"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.policies {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("policies"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventTag<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventTag"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventTakedown<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventTakedown"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.policies {
            #[allow(unused_comparisons)]
            if value.len() > 5usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("policies"),
                    max: 5usize,
                    actual: value.len(),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventUnmute<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventUnmute"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventUnmuteReporter<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventUnmuteReporter"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModEventViewDetail<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modEventViewDetail"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModTool<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "modTool"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Moderation<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "moderation"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ModerationDetail<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "moderationDetail"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordHosting<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordHosting"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordViewDetail<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordViewDetail"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordViewNotFound<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordViewNotFound"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RecordsStats<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "recordsStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RepoView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "repoView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RepoViewDetail<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "repoViewDetail"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RepoViewNotFound<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "repoViewNotFound"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ReporterStats<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "reporterStats"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for RevokeAccountCredentialsEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "revokeAccountCredentialsEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.comment;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("comment"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ScheduleTakedownEvent<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "scheduleTakedownEvent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ScheduledActionView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "scheduledActionView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SubjectStatusView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "subjectStatusView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.priority_score {
            if *value > 100i64 {
                return Err(ConstraintError::Maximum {
                    path: ValidationPath::from_field("priority_score"),
                    max: 100i64,
                    actual: *value,
                });
            }
        }
        if let Some(ref value) = self.priority_score {
            if *value < 0i64 {
                return Err(ConstraintError::Minimum {
                    path: ValidationPath::from_field("priority_score"),
                    min: 0i64,
                    actual: *value,
                });
            }
        }
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for SubjectView<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "subjectView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for VideoDetails<S> {
    fn nsid() -> &'static str {
        "tools.ozone.moderation.defs"
    }
    fn def_name() -> &'static str {
        "videoDetails"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_tools_ozone_moderation_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

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

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

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

impl<S: BosStr> AccountEvent<S> {
    /// Create a new builder for this type
    pub fn builder() -> AccountEventBuilder<account_event_state::Empty, S> {
        AccountEventBuilder::builder()
    }
}

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

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

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

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

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

impl<St, S: BosStr> AccountEventBuilder<St, S>
where
    St: account_event_state::State,
    St::Timestamp: account_event_state::IsUnset,
{
    /// Set the `timestamp` field (required)
    pub fn timestamp(
        mut self,
        value: impl Into<Datetime>,
    ) -> AccountEventBuilder<account_event_state::SetTimestamp<St>, S> {
        self._fields.3 = Option::Some(value.into());
        AccountEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> AccountEventBuilder<St, S>
where
    St: account_event_state::State,
    St::Active: account_event_state::IsSet,
    St::Timestamp: account_event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> AccountEvent<S> {
        AccountEvent {
            active: self._fields.0.unwrap(),
            comment: self._fields.1,
            status: self._fields.2,
            timestamp: 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>>,
    ) -> AccountEvent<S> {
        AccountEvent {
            active: self._fields.0.unwrap(),
            comment: self._fields.1,
            status: self._fields.2,
            timestamp: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_tools_ozone_moderation_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("tools.ozone.moderation.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("accountEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("timestamp"),
                            SmolStr::new_static("active")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("active"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("timestamp"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("accountHosting"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("status")]),
                    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("deactivatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("deletedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reactivatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("accountStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Statistics about a particular account subject",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("appealCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("escalateCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reportCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("suspendCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("takedownCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("accountStrike"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Strike information for an account"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("activeStrikeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("firstStrikeAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp of the first strike received"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastStrikeAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp of the most recent strike received",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("totalStrikeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("ageAssuranceEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Age assurance info coming directly from users. Only works on DID subjects.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("createdAt"),
                            SmolStr::new_static("status"),
                            SmolStr::new_static("attemptId")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("access"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.ageassurance.defs#access",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("attemptId"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The unique identifier for this instance of the age assurance flow, in UUID format.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("completeIp"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The IP address used when completing the AA flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("completeUa"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The user agent used when completing the AA flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("countryCode"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The date and time of this write operation.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("initIp"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The IP address used when initiating the AA flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("initUa"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The user agent used when initiating the AA flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("regionCode"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The ISO 3166-2 region code provided when beginning the Age Assurance flow.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The status of the Age Assurance process.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("ageAssuranceOverrideEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Age assurance status override by moderators. Only works on DID subjects.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("comment"), SmolStr::new_static("status")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("access"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "app.bsky.ageassurance.defs#access",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Comment describing the reason for the override.",
                                    ),
                                ),
                                min_length: Some(1usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("ageAssurancePurgeEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Purges all age assurance events for the subject. Only works on DID subjects. Moderator-only.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("comment")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Comment describing the reason for the purge.",
                                    ),
                                ),
                                min_length: Some(1usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("blobView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("cid"), SmolStr::new_static("mimeType"),
                            SmolStr::new_static("size"), SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("details"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#imageDetails"),
                                    CowStr::new_static("#videoDetails")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("mimeType"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("moderation"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#moderation"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("size"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("cancelScheduledTakedownEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Logs cancellation of a scheduled takedown action for an account.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("convoView"),
                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("identityEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("timestamp")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pdsHost"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("timestamp"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tombstone"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("imageDetails"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("width"), SmolStr::new_static("height")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("height"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("width"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventAcknowledge"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("acknowledgeAccountSubjects"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventComment"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Add a comment to a subject. An empty comment will clear any previously set sticky comment.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("sticky"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventDivert"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Divert a record's blobs to a 3rd party service for further scanning/tagging",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventEmail"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Keep a log of outgoing email to a user"),
                    ),
                    required: Some(vec![SmolStr::new_static("subjectLine")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Additional comment about the outgoing comm.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("content"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The content of the email sent to the user.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("isDelivered"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("policies"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Names/Keywords of the policies that necessitated the email.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("severityLevel"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Severity level of the violation. Normally 'sev-1' that adds strike on repeat offense",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strikeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strikeExpiresAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the strike should expire. If not provided, the strike never expires.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectLine"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The subject line of the email sent to the user.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventEscalate"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventLabel"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Apply/Negate labels on a subject"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("createLabelVals"),
                            SmolStr::new_static("negateLabelVals")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("createLabelVals"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("durationInHours"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("negateLabelVals"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventMute"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Mute incoming reports on a subject"),
                    ),
                    required: Some(vec![SmolStr::new_static("durationInHours")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("durationInHours"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventMuteReporter"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Mute incoming reports from an account"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("durationInHours"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventPriorityScore"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Set priority score of the subject. Higher score means higher priority.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("score")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("score"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventReport"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Report a subject")),
                    required: Some(vec![SmolStr::new_static("reportType")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("isReporterMuted"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reportType"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "com.atproto.moderation.defs#reasonType",
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventResolveAppeal"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Resolve appeal on a subject")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Describe resolution."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventReverseTakedown"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Revert take down action on a subject"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Describe reasoning behind the reversal.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("policies"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Names/Keywords of the policy infraction for which takedown is being reversed.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("severityLevel"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Severity level of the violation. Usually set from the last policy infraction's severity.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strikeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventTag"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Add/Remove a tag on a subject"),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("add"), SmolStr::new_static("remove")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("add"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Tags to be added to the subject. If already exists, won't be duplicated.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Additional comment about added/removed tags.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("durationInHours"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("remove"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventTakedown"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Take down a subject permanently or temporarily",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("acknowledgeAccountSubjects"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("durationInHours"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("policies"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Names/Keywords of the policies that drove the decision.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                max_length: Some(5usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("severityLevel"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.).",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strikeCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("strikeExpiresAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the strike should expire. If not provided, the strike never expires.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("targetServices"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "List of services where the takedown should be applied. If empty or not provided, takedown is applied on all configured services.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventUnmute"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Unmute action on a subject")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Describe reasoning behind the reversal.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventUnmuteReporter"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("Unmute incoming reports from an account"),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Describe reasoning behind the reversal.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("event"),
                            SmolStr::new_static("subject"),
                            SmolStr::new_static("subjectBlobCids"),
                            SmolStr::new_static("createdBy"),
                            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("createdBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("creatorHandle"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("event"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#modEventTakedown"),
                                    CowStr::new_static("#modEventReverseTakedown"),
                                    CowStr::new_static("#modEventComment"),
                                    CowStr::new_static("#modEventReport"),
                                    CowStr::new_static("#modEventLabel"),
                                    CowStr::new_static("#modEventAcknowledge"),
                                    CowStr::new_static("#modEventEscalate"),
                                    CowStr::new_static("#modEventMute"),
                                    CowStr::new_static("#modEventUnmute"),
                                    CowStr::new_static("#modEventMuteReporter"),
                                    CowStr::new_static("#modEventUnmuteReporter"),
                                    CowStr::new_static("#modEventEmail"),
                                    CowStr::new_static("#modEventResolveAppeal"),
                                    CowStr::new_static("#modEventDivert"),
                                    CowStr::new_static("#modEventTag"),
                                    CowStr::new_static("#accountEvent"),
                                    CowStr::new_static("#identityEvent"),
                                    CowStr::new_static("#recordEvent"),
                                    CowStr::new_static("#modEventPriorityScore"),
                                    CowStr::new_static("#ageAssuranceEvent"),
                                    CowStr::new_static("#ageAssuranceOverrideEvent"),
                                    CowStr::new_static("#ageAssurancePurgeEvent"),
                                    CowStr::new_static("#revokeAccountCredentialsEvent"),
                                    CowStr::new_static("#scheduleTakedownEvent"),
                                    CowStr::new_static("#cancelScheduledTakedownEvent")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("modTool"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#modTool"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("com.atproto.admin.defs#repoRef"),
                                    CowStr::new_static("com.atproto.repo.strongRef"),
                                    CowStr::new_static("chat.bsky.convo.defs#messageRef"),
                                    CowStr::new_static("chat.bsky.convo.defs#convoRef")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectBlobCids"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectHandle"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modEventViewDetail"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("event"),
                            SmolStr::new_static("subject"),
                            SmolStr::new_static("subjectBlobs"),
                            SmolStr::new_static("createdBy"),
                            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("createdBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("event"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#modEventTakedown"),
                                    CowStr::new_static("#modEventReverseTakedown"),
                                    CowStr::new_static("#modEventComment"),
                                    CowStr::new_static("#modEventReport"),
                                    CowStr::new_static("#modEventLabel"),
                                    CowStr::new_static("#modEventAcknowledge"),
                                    CowStr::new_static("#modEventEscalate"),
                                    CowStr::new_static("#modEventMute"),
                                    CowStr::new_static("#modEventUnmute"),
                                    CowStr::new_static("#modEventMuteReporter"),
                                    CowStr::new_static("#modEventUnmuteReporter"),
                                    CowStr::new_static("#modEventEmail"),
                                    CowStr::new_static("#modEventResolveAppeal"),
                                    CowStr::new_static("#modEventDivert"),
                                    CowStr::new_static("#modEventTag"),
                                    CowStr::new_static("#accountEvent"),
                                    CowStr::new_static("#identityEvent"),
                                    CowStr::new_static("#recordEvent"),
                                    CowStr::new_static("#modEventPriorityScore"),
                                    CowStr::new_static("#ageAssuranceEvent"),
                                    CowStr::new_static("#ageAssuranceOverrideEvent"),
                                    CowStr::new_static("#ageAssurancePurgeEvent"),
                                    CowStr::new_static("#revokeAccountCredentialsEvent"),
                                    CowStr::new_static("#scheduleTakedownEvent"),
                                    CowStr::new_static("#cancelScheduledTakedownEvent")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("modTool"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#modTool"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#repoView"),
                                    CowStr::new_static("#repoViewNotFound"),
                                    CowStr::new_static("#recordView"),
                                    CowStr::new_static("#recordViewNotFound"),
                                    CowStr::new_static("#convoView")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectBlobs"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#blobView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("modTool"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Moderation tool information for tracing the source of the action",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("name")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("meta"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Name/identifier of the source (e.g., 'automod', 'ozone/workspace')",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("moderation"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("subjectStatus"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#subjectStatusView"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("moderationDetail"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("subjectStatus"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#subjectStatusView"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
                        ),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("timestamp"), SmolStr::new_static("op")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("op"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("timestamp"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordHosting"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("status")]),
                    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("deletedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("value"),
                            SmolStr::new_static("blobCids"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("moderation"),
                            SmolStr::new_static("repo")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blobCids"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Cid),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("moderation"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#moderation"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repo"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#repoView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordViewDetail"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("value"), SmolStr::new_static("blobs"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("moderation"),
                            SmolStr::new_static("repo")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("blobs"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#blobView"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Cid),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("moderation"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#moderationDetail"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repo"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#repoView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordViewNotFound"),
                LexUserType::Object(LexObject {
                    required: Some(vec![SmolStr::new_static("uri")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("recordsStats"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Statistics about a set of record subject items",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("appealedCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("escalatedCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pendingCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("processedCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reportedCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("takendownCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("totalReports"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("repoView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("did"), SmolStr::new_static("handle"),
                            SmolStr::new_static("relatedRecords"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("moderation")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("deactivatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("email"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("inviteNote"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("invitedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "com.atproto.server.defs#inviteCode",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("invitesDisabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("moderation"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#moderation"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedRecords"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Unknown(LexUnknown {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threatSignatures"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "com.atproto.admin.defs#threatSignature",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("repoViewDetail"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("did"), SmolStr::new_static("handle"),
                            SmolStr::new_static("relatedRecords"),
                            SmolStr::new_static("indexedAt"),
                            SmolStr::new_static("moderation")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("deactivatedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("email"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("emailConfirmedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Handle),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("indexedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("inviteNote"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("invitedBy"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "com.atproto.server.defs#inviteCode",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("invites"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "com.atproto.server.defs#inviteCode",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("invitesDisabled"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labels"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("com.atproto.label.defs#label"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("moderation"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#moderationDetail"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("relatedRecords"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Unknown(LexUnknown {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("threatSignatures"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "com.atproto.admin.defs#threatSignature",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("repoViewNotFound"),
                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("reporterStats"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("did"),
                            SmolStr::new_static("accountReportCount"),
                            SmolStr::new_static("recordReportCount"),
                            SmolStr::new_static("reportedAccountCount"),
                            SmolStr::new_static("reportedRecordCount"),
                            SmolStr::new_static("takendownAccountCount"),
                            SmolStr::new_static("takendownRecordCount"),
                            SmolStr::new_static("labeledAccountCount"),
                            SmolStr::new_static("labeledRecordCount")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("accountReportCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labeledAccountCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("labeledRecordCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("recordReportCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reportedAccountCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reportedRecordCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("takendownAccountCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("takendownRecordCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reviewClosed"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("reviewEscalated"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("reviewNone"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("reviewOpen"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("revokeAccountCredentialsEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Account credentials revocation by moderators. Only works on DID subjects.",
                        ),
                    ),
                    required: Some(vec![SmolStr::new_static("comment")]),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Comment describing the reason for the revocation.",
                                    ),
                                ),
                                min_length: Some(1usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("scheduleTakedownEvent"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Logs a scheduled takedown action for an account.",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("executeAfter"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executeAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executeUntil"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("scheduledActionView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("View of a scheduled moderation action"),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("action"),
                            SmolStr::new_static("did"), SmolStr::new_static("createdBy"),
                            SmolStr::new_static("createdAt"),
                            SmolStr::new_static("status")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("action"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Type of action to be executed"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("When the scheduled action was created"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdBy"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "DID of the user who created this scheduled action",
                                    ),
                                ),
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Subject DID for the action"),
                                ),
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("eventData"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executeAfter"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Earliest time to execute the action (for randomized scheduling)",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executeAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Exact time to execute the action"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executeUntil"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Latest time to execute the action (for randomized scheduling)",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("executionEventId"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastExecutedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the action was last attempted to be executed",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastFailureReason"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Reason for the last execution failure"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("randomizeExecution"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Current status of the scheduled action"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "When the scheduled action was last updated",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("subjectReviewState"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("subjectStatusView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("subject"),
                            SmolStr::new_static("createdAt"),
                            SmolStr::new_static("updatedAt"),
                            SmolStr::new_static("reviewState")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("accountStats"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#accountStats"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("accountStrike"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#accountStrike"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ageAssuranceState"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Current age assurance state of the subject.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ageAssuranceUpdatedBy"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Whether or not the last successful update to age assurance was made by the user or admin.",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("appealed"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("comment"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Sticky comment on the subject."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp referencing the first moderation status impacting event was emitted on the subject",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hosting"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("#accountHosting"),
                                    CowStr::new_static("#recordHosting")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastAppealedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp referencing when the author of the subject appealed a moderation action",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastReportedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastReviewedAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastReviewedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muteReportingUntil"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muteUntil"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("priorityScore"),
                            LexObjectProperty::Integer(LexInteger {
                                minimum: Some(0i64),
                                maximum: Some(100i64),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("recordsStats"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#recordsStats"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reviewState"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#subjectReviewState"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![
                                    CowStr::new_static("com.atproto.admin.defs#repoRef"),
                                    CowStr::new_static("com.atproto.repo.strongRef"),
                                    CowStr::new_static("chat.bsky.convo.defs#messageRef"),
                                    CowStr::new_static("chat.bsky.convo.defs#convoRef")
                                ],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectBlobCids"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Cid),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subjectRepoHandle"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("suspendUntil"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tags"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("takendown"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Timestamp referencing when the last update was made to the moderation status of the subject",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("subjectView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Detailed view of a subject. For record subjects, the author's repo and profile will be returned.",
                        ),
                    ),
                    required: Some(
                        vec![SmolStr::new_static("type"), SmolStr::new_static("subject")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("profile"),
                            LexObjectProperty::Union(LexRefUnion {
                                refs: vec![],
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("record"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#recordViewDetail"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repo"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#repoViewDetail"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#subjectStatusView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("subject"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "com.atproto.moderation.defs#subjectType",
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("timelineEventPlcCreate"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("timelineEventPlcOperation"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("timelineEventPlcTombstone"),
                LexUserType::Token(LexToken { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("videoDetails"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("width"), SmolStr::new_static("height"),
                            SmolStr::new_static("length")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("height"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("length"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("width"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

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

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

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

impl<S: BosStr> AgeAssuranceEvent<S> {
    /// Create a new builder for this type
    pub fn builder() -> AgeAssuranceEventBuilder<age_assurance_event_state::Empty, S> {
        AgeAssuranceEventBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> AgeAssuranceEventBuilder<St, S>
where
    St: age_assurance_event_state::State,
    St::AttemptId: age_assurance_event_state::IsUnset,
{
    /// Set the `attemptId` field (required)
    pub fn attempt_id(
        mut self,
        value: impl Into<S>,
    ) -> AgeAssuranceEventBuilder<age_assurance_event_state::SetAttemptId<St>, S> {
        self._fields.1 = Option::Some(value.into());
        AgeAssuranceEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: age_assurance_event_state::State, S: BosStr> AgeAssuranceEventBuilder<St, S> {
    /// Set the `completeIp` field (optional)
    pub fn complete_ip(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `completeIp` field to an Option value (optional)
    pub fn maybe_complete_ip(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: age_assurance_event_state::State, S: BosStr> AgeAssuranceEventBuilder<St, S> {
    /// Set the `completeUa` field (optional)
    pub fn complete_ua(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `completeUa` field to an Option value (optional)
    pub fn maybe_complete_ua(mut self, value: Option<S>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

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

impl<St: age_assurance_event_state::State, S: BosStr> AgeAssuranceEventBuilder<St, S> {
    /// Set the `initIp` field (optional)
    pub fn init_ip(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `initIp` field to an Option value (optional)
    pub fn maybe_init_ip(mut self, value: Option<S>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: age_assurance_event_state::State, S: BosStr> AgeAssuranceEventBuilder<St, S> {
    /// Set the `initUa` field (optional)
    pub fn init_ua(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `initUa` field to an Option value (optional)
    pub fn maybe_init_ua(mut self, value: Option<S>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St: age_assurance_event_state::State, S: BosStr> AgeAssuranceEventBuilder<St, S> {
    /// Set the `regionCode` field (optional)
    pub fn region_code(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `regionCode` field to an Option value (optional)
    pub fn maybe_region_code(mut self, value: Option<S>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St, S: BosStr> AgeAssuranceEventBuilder<St, S>
where
    St: age_assurance_event_state::State,
    St::Status: age_assurance_event_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<AgeAssuranceEventStatus<S>>,
    ) -> AgeAssuranceEventBuilder<age_assurance_event_state::SetStatus<St>, S> {
        self._fields.9 = Option::Some(value.into());
        AgeAssuranceEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> AgeAssuranceEventBuilder<St, S>
where
    St: age_assurance_event_state::State,
    St::AttemptId: age_assurance_event_state::IsSet,
    St::CreatedAt: age_assurance_event_state::IsSet,
    St::Status: age_assurance_event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> AgeAssuranceEvent<S> {
        AgeAssuranceEvent {
            access: self._fields.0,
            attempt_id: self._fields.1.unwrap(),
            complete_ip: self._fields.2,
            complete_ua: self._fields.3,
            country_code: self._fields.4,
            created_at: self._fields.5.unwrap(),
            init_ip: self._fields.6,
            init_ua: self._fields.7,
            region_code: self._fields.8,
            status: self._fields.9.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>>,
    ) -> AgeAssuranceEvent<S> {
        AgeAssuranceEvent {
            access: self._fields.0,
            attempt_id: self._fields.1.unwrap(),
            complete_ip: self._fields.2,
            complete_ua: self._fields.3,
            country_code: self._fields.4,
            created_at: self._fields.5.unwrap(),
            init_ip: self._fields.6,
            init_ua: self._fields.7,
            region_code: self._fields.8,
            status: self._fields.9.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod blob_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 Cid;
        type CreatedAt;
        type MimeType;
        type Size;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Cid = Unset;
        type CreatedAt = Unset;
        type MimeType = Unset;
        type Size = Unset;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Cid = Set<members::cid>;
        type CreatedAt = St::CreatedAt;
        type MimeType = St::MimeType;
        type Size = St::Size;
    }
    ///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 Cid = St::Cid;
        type CreatedAt = Set<members::created_at>;
        type MimeType = St::MimeType;
        type Size = St::Size;
    }
    ///State transition - sets the `mime_type` field to Set
    pub struct SetMimeType<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMimeType<St> {}
    impl<St: State> State for SetMimeType<St> {
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type MimeType = Set<members::mime_type>;
        type Size = St::Size;
    }
    ///State transition - sets the `size` field to Set
    pub struct SetSize<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSize<St> {}
    impl<St: State> State for SetSize<St> {
        type Cid = St::Cid;
        type CreatedAt = St::CreatedAt;
        type MimeType = St::MimeType;
        type Size = Set<members::size>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `mime_type` field
        pub struct mime_type(());
        ///Marker type for the `size` field
        pub struct size(());
    }
}

/// Builder for constructing an instance of this type.
pub struct BlobViewBuilder<St: blob_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Cid<S>>,
        Option<Datetime>,
        Option<BlobViewDetails<S>>,
        Option<S>,
        Option<moderation::Moderation<S>>,
        Option<i64>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> BlobView<S> {
    /// Create a new builder for this type
    pub fn builder() -> BlobViewBuilder<blob_view_state::Empty, S> {
        BlobViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> BlobViewBuilder<St, S>
where
    St: blob_view_state::State,
    St::Cid: blob_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> BlobViewBuilder<blob_view_state::SetCid<St>, S> {
        self._fields.0 = Option::Some(value.into());
        BlobViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: blob_view_state::State, S: BosStr> BlobViewBuilder<St, S> {
    /// Set the `details` field (optional)
    pub fn details(mut self, value: impl Into<Option<BlobViewDetails<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `details` field to an Option value (optional)
    pub fn maybe_details(mut self, value: Option<BlobViewDetails<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> BlobViewBuilder<St, S>
where
    St: blob_view_state::State,
    St::MimeType: blob_view_state::IsUnset,
{
    /// Set the `mimeType` field (required)
    pub fn mime_type(
        mut self,
        value: impl Into<S>,
    ) -> BlobViewBuilder<blob_view_state::SetMimeType<St>, S> {
        self._fields.3 = Option::Some(value.into());
        BlobViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> BlobViewBuilder<St, S>
where
    St: blob_view_state::State,
    St::Size: blob_view_state::IsUnset,
{
    /// Set the `size` field (required)
    pub fn size(
        mut self,
        value: impl Into<i64>,
    ) -> BlobViewBuilder<blob_view_state::SetSize<St>, S> {
        self._fields.5 = Option::Some(value.into());
        BlobViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BlobViewBuilder<St, S>
where
    St: blob_view_state::State,
    St::Cid: blob_view_state::IsSet,
    St::CreatedAt: blob_view_state::IsSet,
    St::MimeType: blob_view_state::IsSet,
    St::Size: blob_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> BlobView<S> {
        BlobView {
            cid: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            details: self._fields.2,
            mime_type: self._fields.3.unwrap(),
            moderation: self._fields.4,
            size: self._fields.5.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> BlobView<S> {
        BlobView {
            cid: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            details: self._fields.2,
            mime_type: self._fields.3.unwrap(),
            moderation: self._fields.4,
            size: self._fields.5.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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 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 ConvoViewBuilder<St: convo_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<Did<S>>),
    _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),
            _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),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ConvoViewBuilder<St, S>
where
    St: convo_view_state::State,
    St::ConvoId: convo_view_state::IsUnset,
{
    /// Set the `convoId` field (required)
    pub fn convo_id(
        mut self,
        value: impl Into<S>,
    ) -> ConvoViewBuilder<convo_view_state::SetConvoId<St>, S> {
        self._fields.0 = 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::Did: convo_view_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<S>>,
    ) -> ConvoViewBuilder<convo_view_state::SetDid<St>, S> {
        self._fields.1 = 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::ConvoId: convo_view_state::IsSet,
    St::Did: convo_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ConvoView<S> {
        ConvoView {
            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>>,
    ) -> ConvoView<S> {
        ConvoView {
            convo_id: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> IdentityEvent<S> {
    /// Create a new builder for this type
    pub fn builder() -> IdentityEventBuilder<identity_event_state::Empty, S> {
        IdentityEventBuilder::builder()
    }
}

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

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

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

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

impl<St: identity_event_state::State, S: BosStr> IdentityEventBuilder<St, S> {
    /// Set the `pdsHost` field (optional)
    pub fn pds_host(mut self, value: impl Into<Option<UriValue<S>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `pdsHost` field to an Option value (optional)
    pub fn maybe_pds_host(mut self, value: Option<UriValue<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> IdentityEventBuilder<St, S>
where
    St: identity_event_state::State,
    St::Timestamp: identity_event_state::IsUnset,
{
    /// Set the `timestamp` field (required)
    pub fn timestamp(
        mut self,
        value: impl Into<Datetime>,
    ) -> IdentityEventBuilder<identity_event_state::SetTimestamp<St>, S> {
        self._fields.3 = Option::Some(value.into());
        IdentityEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> IdentityEventBuilder<St, S>
where
    St: identity_event_state::State,
    St::Timestamp: identity_event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> IdentityEvent<S> {
        IdentityEvent {
            comment: self._fields.0,
            handle: self._fields.1,
            pds_host: self._fields.2,
            timestamp: self._fields.3.unwrap(),
            tombstone: self._fields.4,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> IdentityEvent<S> {
        IdentityEvent {
            comment: self._fields.0,
            handle: self._fields.1,
            pds_host: self._fields.2,
            timestamp: self._fields.3.unwrap(),
            tombstone: self._fields.4,
            extra_data: Some(extra_data),
        }
    }
}

pub mod image_details_state {

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

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

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

impl<S: BosStr> ImageDetails<S> {
    /// Create a new builder for this type
    pub fn builder() -> ImageDetailsBuilder<image_details_state::Empty, S> {
        ImageDetailsBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> ImageDetailsBuilder<St, S>
where
    St: image_details_state::State,
    St::Height: image_details_state::IsSet,
    St::Width: image_details_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ImageDetails<S> {
        ImageDetails {
            height: self._fields.0.unwrap(),
            width: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ImageDetails<S> {
        ImageDetails {
            height: self._fields.0.unwrap(),
            width: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ModEventLabel<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventLabelBuilder<mod_event_label_state::Empty, S> {
        ModEventLabelBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> ModEventLabelBuilder<St, S>
where
    St: mod_event_label_state::State,
    St::CreateLabelVals: mod_event_label_state::IsUnset,
{
    /// Set the `createLabelVals` field (required)
    pub fn create_label_vals(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ModEventLabelBuilder<mod_event_label_state::SetCreateLabelVals<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ModEventLabelBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: mod_event_label_state::State, S: BosStr> ModEventLabelBuilder<St, S> {
    /// Set the `durationInHours` field (optional)
    pub fn duration_in_hours(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `durationInHours` field to an Option value (optional)
    pub fn maybe_duration_in_hours(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> ModEventLabelBuilder<St, S>
where
    St: mod_event_label_state::State,
    St::NegateLabelVals: mod_event_label_state::IsUnset,
{
    /// Set the `negateLabelVals` field (required)
    pub fn negate_label_vals(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ModEventLabelBuilder<mod_event_label_state::SetNegateLabelVals<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ModEventLabelBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventLabelBuilder<St, S>
where
    St: mod_event_label_state::State,
    St::CreateLabelVals: mod_event_label_state::IsSet,
    St::NegateLabelVals: mod_event_label_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventLabel<S> {
        ModEventLabel {
            comment: self._fields.0,
            create_label_vals: self._fields.1.unwrap(),
            duration_in_hours: self._fields.2,
            negate_label_vals: 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>>,
    ) -> ModEventLabel<S> {
        ModEventLabel {
            comment: self._fields.0,
            create_label_vals: self._fields.1.unwrap(),
            duration_in_hours: self._fields.2,
            negate_label_vals: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ModEventMute<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventMuteBuilder<mod_event_mute_state::Empty, S> {
        ModEventMuteBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> ModEventMuteBuilder<St, S>
where
    St: mod_event_mute_state::State,
    St::DurationInHours: mod_event_mute_state::IsUnset,
{
    /// Set the `durationInHours` field (required)
    pub fn duration_in_hours(
        mut self,
        value: impl Into<i64>,
    ) -> ModEventMuteBuilder<mod_event_mute_state::SetDurationInHours<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ModEventMuteBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventMuteBuilder<St, S>
where
    St: mod_event_mute_state::State,
    St::DurationInHours: mod_event_mute_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventMute<S> {
        ModEventMute {
            comment: self._fields.0,
            duration_in_hours: 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>>,
    ) -> ModEventMute<S> {
        ModEventMute {
            comment: self._fields.0,
            duration_in_hours: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ModEventPriorityScore<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventPriorityScoreBuilder<
        mod_event_priority_score_state::Empty,
        S,
    > {
        ModEventPriorityScoreBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> ModEventPriorityScoreBuilder<St, S>
where
    St: mod_event_priority_score_state::State,
    St::Score: mod_event_priority_score_state::IsUnset,
{
    /// Set the `score` field (required)
    pub fn score(
        mut self,
        value: impl Into<i64>,
    ) -> ModEventPriorityScoreBuilder<mod_event_priority_score_state::SetScore<St>, S> {
        self._fields.1 = Option::Some(value.into());
        ModEventPriorityScoreBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventPriorityScoreBuilder<St, S>
where
    St: mod_event_priority_score_state::State,
    St::Score: mod_event_priority_score_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventPriorityScore<S> {
        ModEventPriorityScore {
            comment: self._fields.0,
            score: 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>>,
    ) -> ModEventPriorityScore<S> {
        ModEventPriorityScore {
            comment: self._fields.0,
            score: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ModEventReport<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventReportBuilder<mod_event_report_state::Empty, S> {
        ModEventReportBuilder::builder()
    }
}

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

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

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

impl<St: mod_event_report_state::State, S: BosStr> ModEventReportBuilder<St, S> {
    /// Set the `isReporterMuted` field (optional)
    pub fn is_reporter_muted(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `isReporterMuted` field to an Option value (optional)
    pub fn maybe_is_reporter_muted(mut self, value: Option<bool>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St, S: BosStr> ModEventReportBuilder<St, S>
where
    St: mod_event_report_state::State,
    St::ReportType: mod_event_report_state::IsUnset,
{
    /// Set the `reportType` field (required)
    pub fn report_type(
        mut self,
        value: impl Into<ReasonType<S>>,
    ) -> ModEventReportBuilder<mod_event_report_state::SetReportType<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ModEventReportBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventReportBuilder<St, S>
where
    St: mod_event_report_state::State,
    St::ReportType: mod_event_report_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventReport<S> {
        ModEventReport {
            comment: self._fields.0,
            is_reporter_muted: self._fields.1,
            report_type: 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>>,
    ) -> ModEventReport<S> {
        ModEventReport {
            comment: self._fields.0,
            is_reporter_muted: self._fields.1,
            report_type: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> ModEventTag<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventTagBuilder<mod_event_tag_state::Empty, S> {
        ModEventTagBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ModEventTagBuilder<St, S>
where
    St: mod_event_tag_state::State,
    St::Add: mod_event_tag_state::IsUnset,
{
    /// Set the `add` field (required)
    pub fn add(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ModEventTagBuilder<mod_event_tag_state::SetAdd<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ModEventTagBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: mod_event_tag_state::State, S: BosStr> ModEventTagBuilder<St, S> {
    /// Set the `durationInHours` field (optional)
    pub fn duration_in_hours(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `durationInHours` field to an Option value (optional)
    pub fn maybe_duration_in_hours(mut self, value: Option<i64>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> ModEventTagBuilder<St, S>
where
    St: mod_event_tag_state::State,
    St::Remove: mod_event_tag_state::IsUnset,
{
    /// Set the `remove` field (required)
    pub fn remove(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ModEventTagBuilder<mod_event_tag_state::SetRemove<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ModEventTagBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventTagBuilder<St, S>
where
    St: mod_event_tag_state::State,
    St::Add: mod_event_tag_state::IsSet,
    St::Remove: mod_event_tag_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventTag<S> {
        ModEventTag {
            add: self._fields.0.unwrap(),
            comment: self._fields.1,
            duration_in_hours: self._fields.2,
            remove: 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>>,
    ) -> ModEventTag<S> {
        ModEventTag {
            add: self._fields.0.unwrap(),
            comment: self._fields.1,
            duration_in_hours: self._fields.2,
            remove: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod mod_event_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 CreatedBy;
        type Event;
        type Id;
        type Subject;
        type SubjectBlobCids;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type CreatedBy = Unset;
        type Event = Unset;
        type Id = Unset;
        type Subject = Unset;
        type SubjectBlobCids = 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 CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobCids = St::SubjectBlobCids;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedBy<St> {}
    impl<St: State> State for SetCreatedBy<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = Set<members::created_by>;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobCids = St::SubjectBlobCids;
    }
    ///State transition - sets the `event` field to Set
    pub struct SetEvent<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetEvent<St> {}
    impl<St: State> State for SetEvent<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = Set<members::event>;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobCids = St::SubjectBlobCids;
    }
    ///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 CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = Set<members::id>;
        type Subject = St::Subject;
        type SubjectBlobCids = St::SubjectBlobCids;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubject<St> {}
    impl<St: State> State for SetSubject<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = Set<members::subject>;
        type SubjectBlobCids = St::SubjectBlobCids;
    }
    ///State transition - sets the `subject_blob_cids` field to Set
    pub struct SetSubjectBlobCids<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubjectBlobCids<St> {}
    impl<St: State> State for SetSubjectBlobCids<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobCids = Set<members::subject_blob_cids>;
    }
    /// 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 `created_by` field
        pub struct created_by(());
        ///Marker type for the `event` field
        pub struct event(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `subject_blob_cids` field
        pub struct subject_blob_cids(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ModEventViewBuilder<St: mod_event_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<Did<S>>,
        Option<S>,
        Option<ModEventViewEvent<S>>,
        Option<i64>,
        Option<moderation::ModTool<S>>,
        Option<ModEventViewSubject<S>>,
        Option<Vec<S>>,
        Option<S>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ModEventView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventViewBuilder<mod_event_view_state::Empty, S> {
        ModEventViewBuilder::builder()
    }
}

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

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

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

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

impl<St: mod_event_view_state::State, S: BosStr> ModEventViewBuilder<St, S> {
    /// Set the `creatorHandle` field (optional)
    pub fn creator_handle(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `creatorHandle` field to an Option value (optional)
    pub fn maybe_creator_handle(mut self, value: Option<S>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St, S: BosStr> ModEventViewBuilder<St, S>
where
    St: mod_event_view_state::State,
    St::Event: mod_event_view_state::IsUnset,
{
    /// Set the `event` field (required)
    pub fn event(
        mut self,
        value: impl Into<ModEventViewEvent<S>>,
    ) -> ModEventViewBuilder<mod_event_view_state::SetEvent<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ModEventViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: mod_event_view_state::State, S: BosStr> ModEventViewBuilder<St, S> {
    /// Set the `modTool` field (optional)
    pub fn mod_tool(mut self, value: impl Into<Option<moderation::ModTool<S>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `modTool` field to an Option value (optional)
    pub fn maybe_mod_tool(mut self, value: Option<moderation::ModTool<S>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<St, S: BosStr> ModEventViewBuilder<St, S>
where
    St: mod_event_view_state::State,
    St::Subject: mod_event_view_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<ModEventViewSubject<S>>,
    ) -> ModEventViewBuilder<mod_event_view_state::SetSubject<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ModEventViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventViewBuilder<St, S>
where
    St: mod_event_view_state::State,
    St::SubjectBlobCids: mod_event_view_state::IsUnset,
{
    /// Set the `subjectBlobCids` field (required)
    pub fn subject_blob_cids(
        mut self,
        value: impl Into<Vec<S>>,
    ) -> ModEventViewBuilder<mod_event_view_state::SetSubjectBlobCids<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ModEventViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: mod_event_view_state::State, S: BosStr> ModEventViewBuilder<St, S> {
    /// Set the `subjectHandle` field (optional)
    pub fn subject_handle(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `subjectHandle` field to an Option value (optional)
    pub fn maybe_subject_handle(mut self, value: Option<S>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St, S: BosStr> ModEventViewBuilder<St, S>
where
    St: mod_event_view_state::State,
    St::CreatedAt: mod_event_view_state::IsSet,
    St::CreatedBy: mod_event_view_state::IsSet,
    St::Event: mod_event_view_state::IsSet,
    St::Id: mod_event_view_state::IsSet,
    St::Subject: mod_event_view_state::IsSet,
    St::SubjectBlobCids: mod_event_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventView<S> {
        ModEventView {
            created_at: self._fields.0.unwrap(),
            created_by: self._fields.1.unwrap(),
            creator_handle: self._fields.2,
            event: self._fields.3.unwrap(),
            id: self._fields.4.unwrap(),
            mod_tool: self._fields.5,
            subject: self._fields.6.unwrap(),
            subject_blob_cids: self._fields.7.unwrap(),
            subject_handle: 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>>,
    ) -> ModEventView<S> {
        ModEventView {
            created_at: self._fields.0.unwrap(),
            created_by: self._fields.1.unwrap(),
            creator_handle: self._fields.2,
            event: self._fields.3.unwrap(),
            id: self._fields.4.unwrap(),
            mod_tool: self._fields.5,
            subject: self._fields.6.unwrap(),
            subject_blob_cids: self._fields.7.unwrap(),
            subject_handle: self._fields.8,
            extra_data: Some(extra_data),
        }
    }
}

pub mod mod_event_view_detail_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 CreatedBy;
        type Event;
        type Id;
        type Subject;
        type SubjectBlobs;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type CreatedBy = Unset;
        type Event = Unset;
        type Id = Unset;
        type Subject = Unset;
        type SubjectBlobs = 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 CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobs = St::SubjectBlobs;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedBy<St> {}
    impl<St: State> State for SetCreatedBy<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = Set<members::created_by>;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobs = St::SubjectBlobs;
    }
    ///State transition - sets the `event` field to Set
    pub struct SetEvent<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetEvent<St> {}
    impl<St: State> State for SetEvent<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = Set<members::event>;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobs = St::SubjectBlobs;
    }
    ///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 CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = Set<members::id>;
        type Subject = St::Subject;
        type SubjectBlobs = St::SubjectBlobs;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubject<St> {}
    impl<St: State> State for SetSubject<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = Set<members::subject>;
        type SubjectBlobs = St::SubjectBlobs;
    }
    ///State transition - sets the `subject_blobs` field to Set
    pub struct SetSubjectBlobs<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubjectBlobs<St> {}
    impl<St: State> State for SetSubjectBlobs<St> {
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Event = St::Event;
        type Id = St::Id;
        type Subject = St::Subject;
        type SubjectBlobs = Set<members::subject_blobs>;
    }
    /// 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 `created_by` field
        pub struct created_by(());
        ///Marker type for the `event` field
        pub struct event(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `subject_blobs` field
        pub struct subject_blobs(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ModEventViewDetailBuilder<
    St: mod_event_view_detail_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<Did<S>>,
        Option<ModEventViewDetailEvent<S>>,
        Option<i64>,
        Option<moderation::ModTool<S>>,
        Option<ModEventViewDetailSubject<S>>,
        Option<Vec<moderation::BlobView<S>>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ModEventViewDetail<S> {
    /// Create a new builder for this type
    pub fn builder() -> ModEventViewDetailBuilder<
        mod_event_view_detail_state::Empty,
        S,
    > {
        ModEventViewDetailBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> ModEventViewDetailBuilder<St, S>
where
    St: mod_event_view_detail_state::State,
    St::Event: mod_event_view_detail_state::IsUnset,
{
    /// Set the `event` field (required)
    pub fn event(
        mut self,
        value: impl Into<ModEventViewDetailEvent<S>>,
    ) -> ModEventViewDetailBuilder<mod_event_view_detail_state::SetEvent<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ModEventViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<
    St: mod_event_view_detail_state::State,
    S: BosStr,
> ModEventViewDetailBuilder<St, S> {
    /// Set the `modTool` field (optional)
    pub fn mod_tool(mut self, value: impl Into<Option<moderation::ModTool<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `modTool` field to an Option value (optional)
    pub fn maybe_mod_tool(mut self, value: Option<moderation::ModTool<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<St, S: BosStr> ModEventViewDetailBuilder<St, S>
where
    St: mod_event_view_detail_state::State,
    St::Subject: mod_event_view_detail_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<ModEventViewDetailSubject<S>>,
    ) -> ModEventViewDetailBuilder<mod_event_view_detail_state::SetSubject<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ModEventViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventViewDetailBuilder<St, S>
where
    St: mod_event_view_detail_state::State,
    St::SubjectBlobs: mod_event_view_detail_state::IsUnset,
{
    /// Set the `subjectBlobs` field (required)
    pub fn subject_blobs(
        mut self,
        value: impl Into<Vec<moderation::BlobView<S>>>,
    ) -> ModEventViewDetailBuilder<mod_event_view_detail_state::SetSubjectBlobs<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ModEventViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ModEventViewDetailBuilder<St, S>
where
    St: mod_event_view_detail_state::State,
    St::CreatedAt: mod_event_view_detail_state::IsSet,
    St::CreatedBy: mod_event_view_detail_state::IsSet,
    St::Event: mod_event_view_detail_state::IsSet,
    St::Id: mod_event_view_detail_state::IsSet,
    St::Subject: mod_event_view_detail_state::IsSet,
    St::SubjectBlobs: mod_event_view_detail_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ModEventViewDetail<S> {
        ModEventViewDetail {
            created_at: self._fields.0.unwrap(),
            created_by: self._fields.1.unwrap(),
            event: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            mod_tool: self._fields.4,
            subject: self._fields.5.unwrap(),
            subject_blobs: self._fields.6.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>>,
    ) -> ModEventViewDetail<S> {
        ModEventViewDetail {
            created_at: self._fields.0.unwrap(),
            created_by: self._fields.1.unwrap(),
            event: self._fields.2.unwrap(),
            id: self._fields.3.unwrap(),
            mod_tool: self._fields.4,
            subject: self._fields.5.unwrap(),
            subject_blobs: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> RecordEvent<S> {
    /// Create a new builder for this type
    pub fn builder() -> RecordEventBuilder<record_event_state::Empty, S> {
        RecordEventBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> RecordEventBuilder<St, S>
where
    St: record_event_state::State,
    St::Op: record_event_state::IsUnset,
{
    /// Set the `op` field (required)
    pub fn op(
        mut self,
        value: impl Into<RecordEventOp<S>>,
    ) -> RecordEventBuilder<record_event_state::SetOp<St>, S> {
        self._fields.2 = Option::Some(value.into());
        RecordEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordEventBuilder<St, S>
where
    St: record_event_state::State,
    St::Timestamp: record_event_state::IsUnset,
{
    /// Set the `timestamp` field (required)
    pub fn timestamp(
        mut self,
        value: impl Into<Datetime>,
    ) -> RecordEventBuilder<record_event_state::SetTimestamp<St>, S> {
        self._fields.3 = Option::Some(value.into());
        RecordEventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordEventBuilder<St, S>
where
    St: record_event_state::State,
    St::Op: record_event_state::IsSet,
    St::Timestamp: record_event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RecordEvent<S> {
        RecordEvent {
            cid: self._fields.0,
            comment: self._fields.1,
            op: self._fields.2.unwrap(),
            timestamp: 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>>,
    ) -> RecordEvent<S> {
        RecordEvent {
            cid: self._fields.0,
            comment: self._fields.1,
            op: self._fields.2.unwrap(),
            timestamp: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod record_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 BlobCids;
        type Cid;
        type IndexedAt;
        type Moderation;
        type Repo;
        type Uri;
        type Value;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type BlobCids = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Moderation = Unset;
        type Repo = Unset;
        type Uri = Unset;
        type Value = Unset;
    }
    ///State transition - sets the `blob_cids` field to Set
    pub struct SetBlobCids<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBlobCids<St> {}
    impl<St: State> State for SetBlobCids<St> {
        type BlobCids = Set<members::blob_cids>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type BlobCids = St::BlobCids;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type BlobCids = St::BlobCids;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `moderation` field to Set
    pub struct SetModeration<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetModeration<St> {}
    impl<St: State> State for SetModeration<St> {
        type BlobCids = St::BlobCids;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = Set<members::moderation>;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRepo<St> {}
    impl<St: State> State for SetRepo<St> {
        type BlobCids = St::BlobCids;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = Set<members::repo>;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type BlobCids = St::BlobCids;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = Set<members::uri>;
        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 BlobCids = St::BlobCids;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = Set<members::value>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `blob_cids` field
        pub struct blob_cids(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `moderation` field
        pub struct moderation(());
        ///Marker type for the `repo` field
        pub struct repo(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `value` field
        pub struct value(());
    }
}

/// Builder for constructing an instance of this type.
pub struct RecordViewBuilder<St: record_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<Cid<S>>>,
        Option<Cid<S>>,
        Option<Datetime>,
        Option<moderation::Moderation<S>>,
        Option<moderation::RepoView<S>>,
        Option<AtUri<S>>,
        Option<Data<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> RecordView<S> {
    /// Create a new builder for this type
    pub fn builder() -> RecordViewBuilder<record_view_state::Empty, S> {
        RecordViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::BlobCids: record_view_state::IsUnset,
{
    /// Set the `blobCids` field (required)
    pub fn blob_cids(
        mut self,
        value: impl Into<Vec<Cid<S>>>,
    ) -> RecordViewBuilder<record_view_state::SetBlobCids<St>, S> {
        self._fields.0 = Option::Some(value.into());
        RecordViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::Cid: record_view_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> RecordViewBuilder<record_view_state::SetCid<St>, S> {
        self._fields.1 = Option::Some(value.into());
        RecordViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::IndexedAt: record_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> RecordViewBuilder<record_view_state::SetIndexedAt<St>, S> {
        self._fields.2 = Option::Some(value.into());
        RecordViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::Moderation: record_view_state::IsUnset,
{
    /// Set the `moderation` field (required)
    pub fn moderation(
        mut self,
        value: impl Into<moderation::Moderation<S>>,
    ) -> RecordViewBuilder<record_view_state::SetModeration<St>, S> {
        self._fields.3 = Option::Some(value.into());
        RecordViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::Repo: record_view_state::IsUnset,
{
    /// Set the `repo` field (required)
    pub fn repo(
        mut self,
        value: impl Into<moderation::RepoView<S>>,
    ) -> RecordViewBuilder<record_view_state::SetRepo<St>, S> {
        self._fields.4 = Option::Some(value.into());
        RecordViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

impl<St, S: BosStr> RecordViewBuilder<St, S>
where
    St: record_view_state::State,
    St::BlobCids: record_view_state::IsSet,
    St::Cid: record_view_state::IsSet,
    St::IndexedAt: record_view_state::IsSet,
    St::Moderation: record_view_state::IsSet,
    St::Repo: record_view_state::IsSet,
    St::Uri: record_view_state::IsSet,
    St::Value: record_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RecordView<S> {
        RecordView {
            blob_cids: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            moderation: self._fields.3.unwrap(),
            repo: self._fields.4.unwrap(),
            uri: self._fields.5.unwrap(),
            value: self._fields.6.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>>,
    ) -> RecordView<S> {
        RecordView {
            blob_cids: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            moderation: self._fields.3.unwrap(),
            repo: self._fields.4.unwrap(),
            uri: self._fields.5.unwrap(),
            value: self._fields.6.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod record_view_detail_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 Blobs;
        type Cid;
        type IndexedAt;
        type Moderation;
        type Repo;
        type Uri;
        type Value;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Blobs = Unset;
        type Cid = Unset;
        type IndexedAt = Unset;
        type Moderation = Unset;
        type Repo = Unset;
        type Uri = Unset;
        type Value = Unset;
    }
    ///State transition - sets the `blobs` field to Set
    pub struct SetBlobs<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetBlobs<St> {}
    impl<St: State> State for SetBlobs<St> {
        type Blobs = Set<members::blobs>;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCid<St> {}
    impl<St: State> State for SetCid<St> {
        type Blobs = St::Blobs;
        type Cid = Set<members::cid>;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetIndexedAt<St> {}
    impl<St: State> State for SetIndexedAt<St> {
        type Blobs = St::Blobs;
        type Cid = St::Cid;
        type IndexedAt = Set<members::indexed_at>;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `moderation` field to Set
    pub struct SetModeration<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetModeration<St> {}
    impl<St: State> State for SetModeration<St> {
        type Blobs = St::Blobs;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = Set<members::moderation>;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRepo<St> {}
    impl<St: State> State for SetRepo<St> {
        type Blobs = St::Blobs;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = Set<members::repo>;
        type Uri = St::Uri;
        type Value = St::Value;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        type Blobs = St::Blobs;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = Set<members::uri>;
        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 Blobs = St::Blobs;
        type Cid = St::Cid;
        type IndexedAt = St::IndexedAt;
        type Moderation = St::Moderation;
        type Repo = St::Repo;
        type Uri = St::Uri;
        type Value = Set<members::value>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `blobs` field
        pub struct blobs(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `moderation` field
        pub struct moderation(());
        ///Marker type for the `repo` field
        pub struct repo(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `value` field
        pub struct value(());
    }
}

/// Builder for constructing an instance of this type.
pub struct RecordViewDetailBuilder<
    St: record_view_detail_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Vec<moderation::BlobView<S>>>,
        Option<Cid<S>>,
        Option<Datetime>,
        Option<Vec<Label<S>>>,
        Option<moderation::ModerationDetail<S>>,
        Option<moderation::RepoView<S>>,
        Option<AtUri<S>>,
        Option<Data<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> RecordViewDetail<S> {
    /// Create a new builder for this type
    pub fn builder() -> RecordViewDetailBuilder<record_view_detail_state::Empty, S> {
        RecordViewDetailBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::Blobs: record_view_detail_state::IsUnset,
{
    /// Set the `blobs` field (required)
    pub fn blobs(
        mut self,
        value: impl Into<Vec<moderation::BlobView<S>>>,
    ) -> RecordViewDetailBuilder<record_view_detail_state::SetBlobs<St>, S> {
        self._fields.0 = Option::Some(value.into());
        RecordViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::Cid: record_view_detail_state::IsUnset,
{
    /// Set the `cid` field (required)
    pub fn cid(
        mut self,
        value: impl Into<Cid<S>>,
    ) -> RecordViewDetailBuilder<record_view_detail_state::SetCid<St>, S> {
        self._fields.1 = Option::Some(value.into());
        RecordViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::IndexedAt: record_view_detail_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> RecordViewDetailBuilder<record_view_detail_state::SetIndexedAt<St>, S> {
        self._fields.2 = Option::Some(value.into());
        RecordViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::Moderation: record_view_detail_state::IsUnset,
{
    /// Set the `moderation` field (required)
    pub fn moderation(
        mut self,
        value: impl Into<moderation::ModerationDetail<S>>,
    ) -> RecordViewDetailBuilder<record_view_detail_state::SetModeration<St>, S> {
        self._fields.4 = Option::Some(value.into());
        RecordViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::Repo: record_view_detail_state::IsUnset,
{
    /// Set the `repo` field (required)
    pub fn repo(
        mut self,
        value: impl Into<moderation::RepoView<S>>,
    ) -> RecordViewDetailBuilder<record_view_detail_state::SetRepo<St>, S> {
        self._fields.5 = Option::Some(value.into());
        RecordViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

impl<St, S: BosStr> RecordViewDetailBuilder<St, S>
where
    St: record_view_detail_state::State,
    St::Blobs: record_view_detail_state::IsSet,
    St::Cid: record_view_detail_state::IsSet,
    St::IndexedAt: record_view_detail_state::IsSet,
    St::Moderation: record_view_detail_state::IsSet,
    St::Repo: record_view_detail_state::IsSet,
    St::Uri: record_view_detail_state::IsSet,
    St::Value: record_view_detail_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RecordViewDetail<S> {
        RecordViewDetail {
            blobs: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            labels: self._fields.3,
            moderation: self._fields.4.unwrap(),
            repo: self._fields.5.unwrap(),
            uri: self._fields.6.unwrap(),
            value: self._fields.7.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> RecordViewDetail<S> {
        RecordViewDetail {
            blobs: self._fields.0.unwrap(),
            cid: self._fields.1.unwrap(),
            indexed_at: self._fields.2.unwrap(),
            labels: self._fields.3,
            moderation: self._fields.4.unwrap(),
            repo: self._fields.5.unwrap(),
            uri: self._fields.6.unwrap(),
            value: self._fields.7.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod record_view_not_found_state {

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

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

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

impl<S: BosStr> RecordViewNotFound<S> {
    /// Create a new builder for this type
    pub fn builder() -> RecordViewNotFoundBuilder<
        record_view_not_found_state::Empty,
        S,
    > {
        RecordViewNotFoundBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> RecordViewNotFoundBuilder<St, S>
where
    St: record_view_not_found_state::State,
    St::Uri: record_view_not_found_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RecordViewNotFound<S> {
        RecordViewNotFound {
            uri: 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>>,
    ) -> RecordViewNotFound<S> {
        RecordViewNotFound {
            uri: self._fields.0.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod repo_view_state {

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

/// Builder for constructing an instance of this type.
pub struct RepoViewBuilder<St: repo_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<Did<S>>,
        Option<S>,
        Option<Handle<S>>,
        Option<Datetime>,
        Option<S>,
        Option<InviteCode<S>>,
        Option<bool>,
        Option<moderation::Moderation<S>>,
        Option<Vec<Data<S>>>,
        Option<Vec<ThreatSignature<S>>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> RepoView<S> {
    /// Create a new builder for this type
    pub fn builder() -> RepoViewBuilder<repo_view_state::Empty, S> {
        RepoViewBuilder::builder()
    }
}

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

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

impl<St: repo_view_state::State, S: BosStr> RepoViewBuilder<St, S> {
    /// Set the `deactivatedAt` field (optional)
    pub fn deactivated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `deactivatedAt` field to an Option value (optional)
    pub fn maybe_deactivated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.0 = value;
        self
    }
}

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

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

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

impl<St, S: BosStr> RepoViewBuilder<St, S>
where
    St: repo_view_state::State,
    St::IndexedAt: repo_view_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> RepoViewBuilder<repo_view_state::SetIndexedAt<St>, S> {
        self._fields.4 = Option::Some(value.into());
        RepoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St: repo_view_state::State, S: BosStr> RepoViewBuilder<St, S> {
    /// Set the `invitedBy` field (optional)
    pub fn invited_by(mut self, value: impl Into<Option<InviteCode<S>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `invitedBy` field to an Option value (optional)
    pub fn maybe_invited_by(mut self, value: Option<InviteCode<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: repo_view_state::State, S: BosStr> RepoViewBuilder<St, S> {
    /// Set the `invitesDisabled` field (optional)
    pub fn invites_disabled(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `invitesDisabled` field to an Option value (optional)
    pub fn maybe_invites_disabled(mut self, value: Option<bool>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St, S: BosStr> RepoViewBuilder<St, S>
where
    St: repo_view_state::State,
    St::Moderation: repo_view_state::IsUnset,
{
    /// Set the `moderation` field (required)
    pub fn moderation(
        mut self,
        value: impl Into<moderation::Moderation<S>>,
    ) -> RepoViewBuilder<repo_view_state::SetModeration<St>, S> {
        self._fields.8 = Option::Some(value.into());
        RepoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RepoViewBuilder<St, S>
where
    St: repo_view_state::State,
    St::RelatedRecords: repo_view_state::IsUnset,
{
    /// Set the `relatedRecords` field (required)
    pub fn related_records(
        mut self,
        value: impl Into<Vec<Data<S>>>,
    ) -> RepoViewBuilder<repo_view_state::SetRelatedRecords<St>, S> {
        self._fields.9 = Option::Some(value.into());
        RepoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: repo_view_state::State, S: BosStr> RepoViewBuilder<St, S> {
    /// Set the `threatSignatures` field (optional)
    pub fn threat_signatures(
        mut self,
        value: impl Into<Option<Vec<ThreatSignature<S>>>>,
    ) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `threatSignatures` field to an Option value (optional)
    pub fn maybe_threat_signatures(
        mut self,
        value: Option<Vec<ThreatSignature<S>>>,
    ) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St, S: BosStr> RepoViewBuilder<St, S>
where
    St: repo_view_state::State,
    St::Did: repo_view_state::IsSet,
    St::Handle: repo_view_state::IsSet,
    St::IndexedAt: repo_view_state::IsSet,
    St::Moderation: repo_view_state::IsSet,
    St::RelatedRecords: repo_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RepoView<S> {
        RepoView {
            deactivated_at: self._fields.0,
            did: self._fields.1.unwrap(),
            email: self._fields.2,
            handle: self._fields.3.unwrap(),
            indexed_at: self._fields.4.unwrap(),
            invite_note: self._fields.5,
            invited_by: self._fields.6,
            invites_disabled: self._fields.7,
            moderation: self._fields.8.unwrap(),
            related_records: self._fields.9.unwrap(),
            threat_signatures: self._fields.10,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> RepoView<S> {
        RepoView {
            deactivated_at: self._fields.0,
            did: self._fields.1.unwrap(),
            email: self._fields.2,
            handle: self._fields.3.unwrap(),
            indexed_at: self._fields.4.unwrap(),
            invite_note: self._fields.5,
            invited_by: self._fields.6,
            invites_disabled: self._fields.7,
            moderation: self._fields.8.unwrap(),
            related_records: self._fields.9.unwrap(),
            threat_signatures: self._fields.10,
            extra_data: Some(extra_data),
        }
    }
}

pub mod repo_view_detail_state {

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

/// Builder for constructing an instance of this type.
pub struct RepoViewDetailBuilder<
    St: repo_view_detail_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Datetime>,
        Option<Did<S>>,
        Option<S>,
        Option<Datetime>,
        Option<Handle<S>>,
        Option<Datetime>,
        Option<S>,
        Option<InviteCode<S>>,
        Option<Vec<InviteCode<S>>>,
        Option<bool>,
        Option<Vec<Label<S>>>,
        Option<moderation::ModerationDetail<S>>,
        Option<Vec<Data<S>>>,
        Option<Vec<ThreatSignature<S>>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> RepoViewDetail<S> {
    /// Create a new builder for this type
    pub fn builder() -> RepoViewDetailBuilder<repo_view_detail_state::Empty, S> {
        RepoViewDetailBuilder::builder()
    }
}

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

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

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `deactivatedAt` field (optional)
    pub fn deactivated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `deactivatedAt` field to an Option value (optional)
    pub fn maybe_deactivated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.0 = value;
        self
    }
}

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

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

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `emailConfirmedAt` field (optional)
    pub fn email_confirmed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `emailConfirmedAt` field to an Option value (optional)
    pub fn maybe_email_confirmed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.3 = value;
        self
    }
}

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

impl<St, S: BosStr> RepoViewDetailBuilder<St, S>
where
    St: repo_view_detail_state::State,
    St::IndexedAt: repo_view_detail_state::IsUnset,
{
    /// Set the `indexedAt` field (required)
    pub fn indexed_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> RepoViewDetailBuilder<repo_view_detail_state::SetIndexedAt<St>, S> {
        self._fields.5 = Option::Some(value.into());
        RepoViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `inviteNote` field (optional)
    pub fn invite_note(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `inviteNote` field to an Option value (optional)
    pub fn maybe_invite_note(mut self, value: Option<S>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `invitedBy` field (optional)
    pub fn invited_by(mut self, value: impl Into<Option<InviteCode<S>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `invitedBy` field to an Option value (optional)
    pub fn maybe_invited_by(mut self, value: Option<InviteCode<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `invites` field (optional)
    pub fn invites(mut self, value: impl Into<Option<Vec<InviteCode<S>>>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `invites` field to an Option value (optional)
    pub fn maybe_invites(mut self, value: Option<Vec<InviteCode<S>>>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `invitesDisabled` field (optional)
    pub fn invites_disabled(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `invitesDisabled` field to an Option value (optional)
    pub fn maybe_invites_disabled(mut self, value: Option<bool>) -> Self {
        self._fields.9 = value;
        self
    }
}

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

impl<St, S: BosStr> RepoViewDetailBuilder<St, S>
where
    St: repo_view_detail_state::State,
    St::Moderation: repo_view_detail_state::IsUnset,
{
    /// Set the `moderation` field (required)
    pub fn moderation(
        mut self,
        value: impl Into<moderation::ModerationDetail<S>>,
    ) -> RepoViewDetailBuilder<repo_view_detail_state::SetModeration<St>, S> {
        self._fields.11 = Option::Some(value.into());
        RepoViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> RepoViewDetailBuilder<St, S>
where
    St: repo_view_detail_state::State,
    St::RelatedRecords: repo_view_detail_state::IsUnset,
{
    /// Set the `relatedRecords` field (required)
    pub fn related_records(
        mut self,
        value: impl Into<Vec<Data<S>>>,
    ) -> RepoViewDetailBuilder<repo_view_detail_state::SetRelatedRecords<St>, S> {
        self._fields.12 = Option::Some(value.into());
        RepoViewDetailBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: repo_view_detail_state::State, S: BosStr> RepoViewDetailBuilder<St, S> {
    /// Set the `threatSignatures` field (optional)
    pub fn threat_signatures(
        mut self,
        value: impl Into<Option<Vec<ThreatSignature<S>>>>,
    ) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `threatSignatures` field to an Option value (optional)
    pub fn maybe_threat_signatures(
        mut self,
        value: Option<Vec<ThreatSignature<S>>>,
    ) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St, S: BosStr> RepoViewDetailBuilder<St, S>
where
    St: repo_view_detail_state::State,
    St::Did: repo_view_detail_state::IsSet,
    St::Handle: repo_view_detail_state::IsSet,
    St::IndexedAt: repo_view_detail_state::IsSet,
    St::Moderation: repo_view_detail_state::IsSet,
    St::RelatedRecords: repo_view_detail_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> RepoViewDetail<S> {
        RepoViewDetail {
            deactivated_at: self._fields.0,
            did: self._fields.1.unwrap(),
            email: self._fields.2,
            email_confirmed_at: self._fields.3,
            handle: self._fields.4.unwrap(),
            indexed_at: self._fields.5.unwrap(),
            invite_note: self._fields.6,
            invited_by: self._fields.7,
            invites: self._fields.8,
            invites_disabled: self._fields.9,
            labels: self._fields.10,
            moderation: self._fields.11.unwrap(),
            related_records: self._fields.12.unwrap(),
            threat_signatures: self._fields.13,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> RepoViewDetail<S> {
        RepoViewDetail {
            deactivated_at: self._fields.0,
            did: self._fields.1.unwrap(),
            email: self._fields.2,
            email_confirmed_at: self._fields.3,
            handle: self._fields.4.unwrap(),
            indexed_at: self._fields.5.unwrap(),
            invite_note: self._fields.6,
            invited_by: self._fields.7,
            invites: self._fields.8,
            invites_disabled: self._fields.9,
            labels: self._fields.10,
            moderation: self._fields.11.unwrap(),
            related_records: self._fields.12.unwrap(),
            threat_signatures: self._fields.13,
            extra_data: Some(extra_data),
        }
    }
}

pub mod repo_view_not_found_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 RepoViewNotFoundBuilder<
    St: repo_view_not_found_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<Did<S>>,),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> RepoViewNotFound<S> {
    /// Create a new builder for this type
    pub fn builder() -> RepoViewNotFoundBuilder<repo_view_not_found_state::Empty, S> {
        RepoViewNotFoundBuilder::builder()
    }
}

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

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

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

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

pub mod reporter_stats_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 AccountReportCount;
        type Did;
        type LabeledAccountCount;
        type LabeledRecordCount;
        type RecordReportCount;
        type ReportedAccountCount;
        type ReportedRecordCount;
        type TakendownAccountCount;
        type TakendownRecordCount;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type AccountReportCount = Unset;
        type Did = Unset;
        type LabeledAccountCount = Unset;
        type LabeledRecordCount = Unset;
        type RecordReportCount = Unset;
        type ReportedAccountCount = Unset;
        type ReportedRecordCount = Unset;
        type TakendownAccountCount = Unset;
        type TakendownRecordCount = Unset;
    }
    ///State transition - sets the `account_report_count` field to Set
    pub struct SetAccountReportCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAccountReportCount<St> {}
    impl<St: State> State for SetAccountReportCount<St> {
        type AccountReportCount = Set<members::account_report_count>;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///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 AccountReportCount = St::AccountReportCount;
        type Did = Set<members::did>;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `labeled_account_count` field to Set
    pub struct SetLabeledAccountCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLabeledAccountCount<St> {}
    impl<St: State> State for SetLabeledAccountCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = Set<members::labeled_account_count>;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `labeled_record_count` field to Set
    pub struct SetLabeledRecordCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetLabeledRecordCount<St> {}
    impl<St: State> State for SetLabeledRecordCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = Set<members::labeled_record_count>;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `record_report_count` field to Set
    pub struct SetRecordReportCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetRecordReportCount<St> {}
    impl<St: State> State for SetRecordReportCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = Set<members::record_report_count>;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `reported_account_count` field to Set
    pub struct SetReportedAccountCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReportedAccountCount<St> {}
    impl<St: State> State for SetReportedAccountCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = Set<members::reported_account_count>;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `reported_record_count` field to Set
    pub struct SetReportedRecordCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReportedRecordCount<St> {}
    impl<St: State> State for SetReportedRecordCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = Set<members::reported_record_count>;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `takendown_account_count` field to Set
    pub struct SetTakendownAccountCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTakendownAccountCount<St> {}
    impl<St: State> State for SetTakendownAccountCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = Set<members::takendown_account_count>;
        type TakendownRecordCount = St::TakendownRecordCount;
    }
    ///State transition - sets the `takendown_record_count` field to Set
    pub struct SetTakendownRecordCount<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTakendownRecordCount<St> {}
    impl<St: State> State for SetTakendownRecordCount<St> {
        type AccountReportCount = St::AccountReportCount;
        type Did = St::Did;
        type LabeledAccountCount = St::LabeledAccountCount;
        type LabeledRecordCount = St::LabeledRecordCount;
        type RecordReportCount = St::RecordReportCount;
        type ReportedAccountCount = St::ReportedAccountCount;
        type ReportedRecordCount = St::ReportedRecordCount;
        type TakendownAccountCount = St::TakendownAccountCount;
        type TakendownRecordCount = Set<members::takendown_record_count>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `account_report_count` field
        pub struct account_report_count(());
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `labeled_account_count` field
        pub struct labeled_account_count(());
        ///Marker type for the `labeled_record_count` field
        pub struct labeled_record_count(());
        ///Marker type for the `record_report_count` field
        pub struct record_report_count(());
        ///Marker type for the `reported_account_count` field
        pub struct reported_account_count(());
        ///Marker type for the `reported_record_count` field
        pub struct reported_record_count(());
        ///Marker type for the `takendown_account_count` field
        pub struct takendown_account_count(());
        ///Marker type for the `takendown_record_count` field
        pub struct takendown_record_count(());
    }
}

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

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

impl<S: BosStr> ReporterStats<S> {
    /// Create a new builder for this type
    pub fn builder() -> ReporterStatsBuilder<reporter_stats_state::Empty, S> {
        ReporterStatsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::AccountReportCount: reporter_stats_state::IsUnset,
{
    /// Set the `accountReportCount` field (required)
    pub fn account_report_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetAccountReportCount<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::LabeledAccountCount: reporter_stats_state::IsUnset,
{
    /// Set the `labeledAccountCount` field (required)
    pub fn labeled_account_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetLabeledAccountCount<St>, S> {
        self._fields.2 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::LabeledRecordCount: reporter_stats_state::IsUnset,
{
    /// Set the `labeledRecordCount` field (required)
    pub fn labeled_record_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetLabeledRecordCount<St>, S> {
        self._fields.3 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::RecordReportCount: reporter_stats_state::IsUnset,
{
    /// Set the `recordReportCount` field (required)
    pub fn record_report_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetRecordReportCount<St>, S> {
        self._fields.4 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::ReportedAccountCount: reporter_stats_state::IsUnset,
{
    /// Set the `reportedAccountCount` field (required)
    pub fn reported_account_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetReportedAccountCount<St>, S> {
        self._fields.5 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::ReportedRecordCount: reporter_stats_state::IsUnset,
{
    /// Set the `reportedRecordCount` field (required)
    pub fn reported_record_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetReportedRecordCount<St>, S> {
        self._fields.6 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::TakendownAccountCount: reporter_stats_state::IsUnset,
{
    /// Set the `takendownAccountCount` field (required)
    pub fn takendown_account_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetTakendownAccountCount<St>, S> {
        self._fields.7 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::TakendownRecordCount: reporter_stats_state::IsUnset,
{
    /// Set the `takendownRecordCount` field (required)
    pub fn takendown_record_count(
        mut self,
        value: impl Into<i64>,
    ) -> ReporterStatsBuilder<reporter_stats_state::SetTakendownRecordCount<St>, S> {
        self._fields.8 = Option::Some(value.into());
        ReporterStatsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> ReporterStatsBuilder<St, S>
where
    St: reporter_stats_state::State,
    St::AccountReportCount: reporter_stats_state::IsSet,
    St::Did: reporter_stats_state::IsSet,
    St::LabeledAccountCount: reporter_stats_state::IsSet,
    St::LabeledRecordCount: reporter_stats_state::IsSet,
    St::RecordReportCount: reporter_stats_state::IsSet,
    St::ReportedAccountCount: reporter_stats_state::IsSet,
    St::ReportedRecordCount: reporter_stats_state::IsSet,
    St::TakendownAccountCount: reporter_stats_state::IsSet,
    St::TakendownRecordCount: reporter_stats_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReporterStats<S> {
        ReporterStats {
            account_report_count: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            labeled_account_count: self._fields.2.unwrap(),
            labeled_record_count: self._fields.3.unwrap(),
            record_report_count: self._fields.4.unwrap(),
            reported_account_count: self._fields.5.unwrap(),
            reported_record_count: self._fields.6.unwrap(),
            takendown_account_count: self._fields.7.unwrap(),
            takendown_record_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>>,
    ) -> ReporterStats<S> {
        ReporterStats {
            account_report_count: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            labeled_account_count: self._fields.2.unwrap(),
            labeled_record_count: self._fields.3.unwrap(),
            record_report_count: self._fields.4.unwrap(),
            reported_account_count: self._fields.5.unwrap(),
            reported_record_count: self._fields.6.unwrap(),
            takendown_account_count: self._fields.7.unwrap(),
            takendown_record_count: self._fields.8.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod scheduled_action_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 Action;
        type CreatedAt;
        type CreatedBy;
        type Did;
        type Id;
        type Status;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Action = Unset;
        type CreatedAt = Unset;
        type CreatedBy = Unset;
        type Did = Unset;
        type Id = Unset;
        type Status = Unset;
    }
    ///State transition - sets the `action` field to Set
    pub struct SetAction<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAction<St> {}
    impl<St: State> State for SetAction<St> {
        type Action = Set<members::action>;
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Did = St::Did;
        type Id = St::Id;
        type Status = St::Status;
    }
    ///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 Action = St::Action;
        type CreatedAt = Set<members::created_at>;
        type CreatedBy = St::CreatedBy;
        type Did = St::Did;
        type Id = St::Id;
        type Status = St::Status;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCreatedBy<St> {}
    impl<St: State> State for SetCreatedBy<St> {
        type Action = St::Action;
        type CreatedAt = St::CreatedAt;
        type CreatedBy = Set<members::created_by>;
        type Did = St::Did;
        type Id = St::Id;
        type Status = St::Status;
    }
    ///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 Action = St::Action;
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Did = Set<members::did>;
        type Id = St::Id;
        type Status = St::Status;
    }
    ///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 Action = St::Action;
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Did = St::Did;
        type Id = Set<members::id>;
        type Status = St::Status;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetStatus<St> {}
    impl<St: State> State for SetStatus<St> {
        type Action = St::Action;
        type CreatedAt = St::CreatedAt;
        type CreatedBy = St::CreatedBy;
        type Did = St::Did;
        type Id = St::Id;
        type Status = Set<members::status>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `action` field
        pub struct action(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `created_by` field
        pub struct created_by(());
        ///Marker type for the `did` field
        pub struct did(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `status` field
        pub struct status(());
    }
}

/// Builder for constructing an instance of this type.
pub struct ScheduledActionViewBuilder<
    St: scheduled_action_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<ScheduledActionViewAction<S>>,
        Option<Datetime>,
        Option<Did<S>>,
        Option<Did<S>>,
        Option<Data<S>>,
        Option<Datetime>,
        Option<Datetime>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<Datetime>,
        Option<S>,
        Option<bool>,
        Option<ScheduledActionViewStatus<S>>,
        Option<Datetime>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> ScheduledActionView<S> {
    /// Create a new builder for this type
    pub fn builder() -> ScheduledActionViewBuilder<
        scheduled_action_view_state::Empty,
        S,
    > {
        ScheduledActionViewBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> ScheduledActionViewBuilder<St, S>
where
    St: scheduled_action_view_state::State,
    St::Action: scheduled_action_view_state::IsUnset,
{
    /// Set the `action` field (required)
    pub fn action(
        mut self,
        value: impl Into<ScheduledActionViewAction<S>>,
    ) -> ScheduledActionViewBuilder<scheduled_action_view_state::SetAction<St>, S> {
        self._fields.0 = Option::Some(value.into());
        ScheduledActionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

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

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

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `eventData` field (optional)
    pub fn event_data(mut self, value: impl Into<Option<Data<S>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `eventData` field to an Option value (optional)
    pub fn maybe_event_data(mut self, value: Option<Data<S>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `executeAfter` field (optional)
    pub fn execute_after(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `executeAfter` field to an Option value (optional)
    pub fn maybe_execute_after(mut self, value: Option<Datetime>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `executeAt` field (optional)
    pub fn execute_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `executeAt` field to an Option value (optional)
    pub fn maybe_execute_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `executeUntil` field (optional)
    pub fn execute_until(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `executeUntil` field to an Option value (optional)
    pub fn maybe_execute_until(mut self, value: Option<Datetime>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `executionEventId` field (optional)
    pub fn execution_event_id(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `executionEventId` field to an Option value (optional)
    pub fn maybe_execution_event_id(mut self, value: Option<i64>) -> Self {
        self._fields.8 = value;
        self
    }
}

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

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `lastExecutedAt` field (optional)
    pub fn last_executed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `lastExecutedAt` field to an Option value (optional)
    pub fn maybe_last_executed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.10 = value;
        self
    }
}

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

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `randomizeExecution` field (optional)
    pub fn randomize_execution(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `randomizeExecution` field to an Option value (optional)
    pub fn maybe_randomize_execution(mut self, value: Option<bool>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St, S: BosStr> ScheduledActionViewBuilder<St, S>
where
    St: scheduled_action_view_state::State,
    St::Status: scheduled_action_view_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<ScheduledActionViewStatus<S>>,
    ) -> ScheduledActionViewBuilder<scheduled_action_view_state::SetStatus<St>, S> {
        self._fields.13 = Option::Some(value.into());
        ScheduledActionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<
    St: scheduled_action_view_state::State,
    S: BosStr,
> ScheduledActionViewBuilder<St, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `updatedAt` field to an Option value (optional)
    pub fn maybe_updated_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St, S: BosStr> ScheduledActionViewBuilder<St, S>
where
    St: scheduled_action_view_state::State,
    St::Action: scheduled_action_view_state::IsSet,
    St::CreatedAt: scheduled_action_view_state::IsSet,
    St::CreatedBy: scheduled_action_view_state::IsSet,
    St::Did: scheduled_action_view_state::IsSet,
    St::Id: scheduled_action_view_state::IsSet,
    St::Status: scheduled_action_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ScheduledActionView<S> {
        ScheduledActionView {
            action: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            created_by: self._fields.2.unwrap(),
            did: self._fields.3.unwrap(),
            event_data: self._fields.4,
            execute_after: self._fields.5,
            execute_at: self._fields.6,
            execute_until: self._fields.7,
            execution_event_id: self._fields.8,
            id: self._fields.9.unwrap(),
            last_executed_at: self._fields.10,
            last_failure_reason: self._fields.11,
            randomize_execution: self._fields.12,
            status: self._fields.13.unwrap(),
            updated_at: self._fields.14,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> ScheduledActionView<S> {
        ScheduledActionView {
            action: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            created_by: self._fields.2.unwrap(),
            did: self._fields.3.unwrap(),
            event_data: self._fields.4,
            execute_after: self._fields.5,
            execute_at: self._fields.6,
            execute_until: self._fields.7,
            execution_event_id: self._fields.8,
            id: self._fields.9.unwrap(),
            last_executed_at: self._fields.10,
            last_failure_reason: self._fields.11,
            randomize_execution: self._fields.12,
            status: self._fields.13.unwrap(),
            updated_at: self._fields.14,
            extra_data: Some(extra_data),
        }
    }
}

pub mod subject_status_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 Id;
        type ReviewState;
        type Subject;
        type UpdatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type Id = Unset;
        type ReviewState = Unset;
        type Subject = Unset;
        type UpdatedAt = 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 Id = St::Id;
        type ReviewState = St::ReviewState;
        type Subject = St::Subject;
        type UpdatedAt = St::UpdatedAt;
    }
    ///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 CreatedAt = St::CreatedAt;
        type Id = Set<members::id>;
        type ReviewState = St::ReviewState;
        type Subject = St::Subject;
        type UpdatedAt = St::UpdatedAt;
    }
    ///State transition - sets the `review_state` field to Set
    pub struct SetReviewState<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetReviewState<St> {}
    impl<St: State> State for SetReviewState<St> {
        type CreatedAt = St::CreatedAt;
        type Id = St::Id;
        type ReviewState = Set<members::review_state>;
        type Subject = St::Subject;
        type UpdatedAt = St::UpdatedAt;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetSubject<St> {}
    impl<St: State> State for SetSubject<St> {
        type CreatedAt = St::CreatedAt;
        type Id = St::Id;
        type ReviewState = St::ReviewState;
        type Subject = Set<members::subject>;
        type UpdatedAt = St::UpdatedAt;
    }
    ///State transition - sets the `updated_at` field to Set
    pub struct SetUpdatedAt<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUpdatedAt<St> {}
    impl<St: State> State for SetUpdatedAt<St> {
        type CreatedAt = St::CreatedAt;
        type Id = St::Id;
        type ReviewState = St::ReviewState;
        type Subject = St::Subject;
        type UpdatedAt = Set<members::updated_at>;
    }
    /// 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 `id` field
        pub struct id(());
        ///Marker type for the `review_state` field
        pub struct review_state(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `updated_at` field
        pub struct updated_at(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SubjectStatusViewBuilder<
    St: subject_status_view_state::State,
    S: BosStr = DefaultStr,
> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<moderation::AccountStats<S>>,
        Option<moderation::AccountStrike<S>>,
        Option<SubjectStatusViewAgeAssuranceState<S>>,
        Option<SubjectStatusViewAgeAssuranceUpdatedBy<S>>,
        Option<bool>,
        Option<S>,
        Option<Datetime>,
        Option<SubjectStatusViewHosting<S>>,
        Option<i64>,
        Option<Datetime>,
        Option<Datetime>,
        Option<Datetime>,
        Option<Did<S>>,
        Option<Datetime>,
        Option<Datetime>,
        Option<i64>,
        Option<moderation::RecordsStats<S>>,
        Option<moderation::SubjectReviewState<S>>,
        Option<SubjectStatusViewSubject<S>>,
        Option<Vec<Cid<S>>>,
        Option<S>,
        Option<Datetime>,
        Option<Vec<S>>,
        Option<bool>,
        Option<Datetime>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> SubjectStatusView<S> {
    /// Create a new builder for this type
    pub fn builder() -> SubjectStatusViewBuilder<subject_status_view_state::Empty, S> {
        SubjectStatusViewBuilder::builder()
    }
}

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

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

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `accountStats` field (optional)
    pub fn account_stats(
        mut self,
        value: impl Into<Option<moderation::AccountStats<S>>>,
    ) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `accountStats` field to an Option value (optional)
    pub fn maybe_account_stats(
        mut self,
        value: Option<moderation::AccountStats<S>>,
    ) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `accountStrike` field (optional)
    pub fn account_strike(
        mut self,
        value: impl Into<Option<moderation::AccountStrike<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `accountStrike` field to an Option value (optional)
    pub fn maybe_account_strike(
        mut self,
        value: Option<moderation::AccountStrike<S>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `ageAssuranceState` field (optional)
    pub fn age_assurance_state(
        mut self,
        value: impl Into<Option<SubjectStatusViewAgeAssuranceState<S>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `ageAssuranceState` field to an Option value (optional)
    pub fn maybe_age_assurance_state(
        mut self,
        value: Option<SubjectStatusViewAgeAssuranceState<S>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `ageAssuranceUpdatedBy` field (optional)
    pub fn age_assurance_updated_by(
        mut self,
        value: impl Into<Option<SubjectStatusViewAgeAssuranceUpdatedBy<S>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `ageAssuranceUpdatedBy` field to an Option value (optional)
    pub fn maybe_age_assurance_updated_by(
        mut self,
        value: Option<SubjectStatusViewAgeAssuranceUpdatedBy<S>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

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

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

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

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `hosting` field (optional)
    pub fn hosting(
        mut self,
        value: impl Into<Option<SubjectStatusViewHosting<S>>>,
    ) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `hosting` field to an Option value (optional)
    pub fn maybe_hosting(mut self, value: Option<SubjectStatusViewHosting<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

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

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `lastAppealedAt` field (optional)
    pub fn last_appealed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `lastAppealedAt` field to an Option value (optional)
    pub fn maybe_last_appealed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `lastReportedAt` field (optional)
    pub fn last_reported_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `lastReportedAt` field to an Option value (optional)
    pub fn maybe_last_reported_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `lastReviewedAt` field (optional)
    pub fn last_reviewed_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `lastReviewedAt` field to an Option value (optional)
    pub fn maybe_last_reviewed_at(mut self, value: Option<Datetime>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `lastReviewedBy` field (optional)
    pub fn last_reviewed_by(mut self, value: impl Into<Option<Did<S>>>) -> Self {
        self._fields.12 = value.into();
        self
    }
    /// Set the `lastReviewedBy` field to an Option value (optional)
    pub fn maybe_last_reviewed_by(mut self, value: Option<Did<S>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `muteReportingUntil` field (optional)
    pub fn mute_reporting_until(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.13 = value.into();
        self
    }
    /// Set the `muteReportingUntil` field to an Option value (optional)
    pub fn maybe_mute_reporting_until(mut self, value: Option<Datetime>) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `muteUntil` field (optional)
    pub fn mute_until(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.14 = value.into();
        self
    }
    /// Set the `muteUntil` field to an Option value (optional)
    pub fn maybe_mute_until(mut self, value: Option<Datetime>) -> Self {
        self._fields.14 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `priorityScore` field (optional)
    pub fn priority_score(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.15 = value.into();
        self
    }
    /// Set the `priorityScore` field to an Option value (optional)
    pub fn maybe_priority_score(mut self, value: Option<i64>) -> Self {
        self._fields.15 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `recordsStats` field (optional)
    pub fn records_stats(
        mut self,
        value: impl Into<Option<moderation::RecordsStats<S>>>,
    ) -> Self {
        self._fields.16 = value.into();
        self
    }
    /// Set the `recordsStats` field to an Option value (optional)
    pub fn maybe_records_stats(
        mut self,
        value: Option<moderation::RecordsStats<S>>,
    ) -> Self {
        self._fields.16 = value;
        self
    }
}

impl<St, S: BosStr> SubjectStatusViewBuilder<St, S>
where
    St: subject_status_view_state::State,
    St::ReviewState: subject_status_view_state::IsUnset,
{
    /// Set the `reviewState` field (required)
    pub fn review_state(
        mut self,
        value: impl Into<moderation::SubjectReviewState<S>>,
    ) -> SubjectStatusViewBuilder<subject_status_view_state::SetReviewState<St>, S> {
        self._fields.17 = Option::Some(value.into());
        SubjectStatusViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SubjectStatusViewBuilder<St, S>
where
    St: subject_status_view_state::State,
    St::Subject: subject_status_view_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<SubjectStatusViewSubject<S>>,
    ) -> SubjectStatusViewBuilder<subject_status_view_state::SetSubject<St>, S> {
        self._fields.18 = Option::Some(value.into());
        SubjectStatusViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `subjectBlobCids` field (optional)
    pub fn subject_blob_cids(mut self, value: impl Into<Option<Vec<Cid<S>>>>) -> Self {
        self._fields.19 = value.into();
        self
    }
    /// Set the `subjectBlobCids` field to an Option value (optional)
    pub fn maybe_subject_blob_cids(mut self, value: Option<Vec<Cid<S>>>) -> Self {
        self._fields.19 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `subjectRepoHandle` field (optional)
    pub fn subject_repo_handle(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.20 = value.into();
        self
    }
    /// Set the `subjectRepoHandle` field to an Option value (optional)
    pub fn maybe_subject_repo_handle(mut self, value: Option<S>) -> Self {
        self._fields.20 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `suspendUntil` field (optional)
    pub fn suspend_until(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.21 = value.into();
        self
    }
    /// Set the `suspendUntil` field to an Option value (optional)
    pub fn maybe_suspend_until(mut self, value: Option<Datetime>) -> Self {
        self._fields.21 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `tags` field (optional)
    pub fn tags(mut self, value: impl Into<Option<Vec<S>>>) -> Self {
        self._fields.22 = value.into();
        self
    }
    /// Set the `tags` field to an Option value (optional)
    pub fn maybe_tags(mut self, value: Option<Vec<S>>) -> Self {
        self._fields.22 = value;
        self
    }
}

impl<St: subject_status_view_state::State, S: BosStr> SubjectStatusViewBuilder<St, S> {
    /// Set the `takendown` field (optional)
    pub fn takendown(mut self, value: impl Into<Option<bool>>) -> Self {
        self._fields.23 = value.into();
        self
    }
    /// Set the `takendown` field to an Option value (optional)
    pub fn maybe_takendown(mut self, value: Option<bool>) -> Self {
        self._fields.23 = value;
        self
    }
}

impl<St, S: BosStr> SubjectStatusViewBuilder<St, S>
where
    St: subject_status_view_state::State,
    St::UpdatedAt: subject_status_view_state::IsUnset,
{
    /// Set the `updatedAt` field (required)
    pub fn updated_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> SubjectStatusViewBuilder<subject_status_view_state::SetUpdatedAt<St>, S> {
        self._fields.24 = Option::Some(value.into());
        SubjectStatusViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SubjectStatusViewBuilder<St, S>
where
    St: subject_status_view_state::State,
    St::CreatedAt: subject_status_view_state::IsSet,
    St::Id: subject_status_view_state::IsSet,
    St::ReviewState: subject_status_view_state::IsSet,
    St::Subject: subject_status_view_state::IsSet,
    St::UpdatedAt: subject_status_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SubjectStatusView<S> {
        SubjectStatusView {
            account_stats: self._fields.0,
            account_strike: self._fields.1,
            age_assurance_state: self._fields.2,
            age_assurance_updated_by: self._fields.3,
            appealed: self._fields.4,
            comment: self._fields.5,
            created_at: self._fields.6.unwrap(),
            hosting: self._fields.7,
            id: self._fields.8.unwrap(),
            last_appealed_at: self._fields.9,
            last_reported_at: self._fields.10,
            last_reviewed_at: self._fields.11,
            last_reviewed_by: self._fields.12,
            mute_reporting_until: self._fields.13,
            mute_until: self._fields.14,
            priority_score: self._fields.15,
            records_stats: self._fields.16,
            review_state: self._fields.17.unwrap(),
            subject: self._fields.18.unwrap(),
            subject_blob_cids: self._fields.19,
            subject_repo_handle: self._fields.20,
            suspend_until: self._fields.21,
            tags: self._fields.22,
            takendown: self._fields.23,
            updated_at: self._fields.24.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>>,
    ) -> SubjectStatusView<S> {
        SubjectStatusView {
            account_stats: self._fields.0,
            account_strike: self._fields.1,
            age_assurance_state: self._fields.2,
            age_assurance_updated_by: self._fields.3,
            appealed: self._fields.4,
            comment: self._fields.5,
            created_at: self._fields.6.unwrap(),
            hosting: self._fields.7,
            id: self._fields.8.unwrap(),
            last_appealed_at: self._fields.9,
            last_reported_at: self._fields.10,
            last_reviewed_at: self._fields.11,
            last_reviewed_by: self._fields.12,
            mute_reporting_until: self._fields.13,
            mute_until: self._fields.14,
            priority_score: self._fields.15,
            records_stats: self._fields.16,
            review_state: self._fields.17.unwrap(),
            subject: self._fields.18.unwrap(),
            subject_blob_cids: self._fields.19,
            subject_repo_handle: self._fields.20,
            suspend_until: self._fields.21,
            tags: self._fields.22,
            takendown: self._fields.23,
            updated_at: self._fields.24.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

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

/// Builder for constructing an instance of this type.
pub struct SubjectViewBuilder<St: subject_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Data<S>>,
        Option<moderation::RecordViewDetail<S>>,
        Option<moderation::RepoViewDetail<S>>,
        Option<moderation::SubjectStatusView<S>>,
        Option<S>,
        Option<SubjectType<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> SubjectView<S> {
    /// Create a new builder for this type
    pub fn builder() -> SubjectViewBuilder<subject_view_state::Empty, S> {
        SubjectViewBuilder::builder()
    }
}

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

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

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

impl<St: subject_view_state::State, S: BosStr> SubjectViewBuilder<St, S> {
    /// Set the `record` field (optional)
    pub fn record(
        mut self,
        value: impl Into<Option<moderation::RecordViewDetail<S>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `record` field to an Option value (optional)
    pub fn maybe_record(
        mut self,
        value: Option<moderation::RecordViewDetail<S>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<St: subject_view_state::State, S: BosStr> SubjectViewBuilder<St, S> {
    /// Set the `repo` field (optional)
    pub fn repo(
        mut self,
        value: impl Into<Option<moderation::RepoViewDetail<S>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `repo` field to an Option value (optional)
    pub fn maybe_repo(mut self, value: Option<moderation::RepoViewDetail<S>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<St: subject_view_state::State, S: BosStr> SubjectViewBuilder<St, S> {
    /// Set the `status` field (optional)
    pub fn status(
        mut self,
        value: impl Into<Option<moderation::SubjectStatusView<S>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `status` field to an Option value (optional)
    pub fn maybe_status(
        mut self,
        value: Option<moderation::SubjectStatusView<S>>,
    ) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<St, S: BosStr> SubjectViewBuilder<St, S>
where
    St: subject_view_state::State,
    St::Subject: subject_view_state::IsUnset,
{
    /// Set the `subject` field (required)
    pub fn subject(
        mut self,
        value: impl Into<S>,
    ) -> SubjectViewBuilder<subject_view_state::SetSubject<St>, S> {
        self._fields.4 = Option::Some(value.into());
        SubjectViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SubjectViewBuilder<St, S>
where
    St: subject_view_state::State,
    St::Type: subject_view_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<SubjectType<S>>,
    ) -> SubjectViewBuilder<subject_view_state::SetType<St>, S> {
        self._fields.5 = Option::Some(value.into());
        SubjectViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SubjectViewBuilder<St, S>
where
    St: subject_view_state::State,
    St::Subject: subject_view_state::IsSet,
    St::Type: subject_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> SubjectView<S> {
        SubjectView {
            profile: self._fields.0,
            record: self._fields.1,
            repo: self._fields.2,
            status: self._fields.3,
            subject: self._fields.4.unwrap(),
            r#type: self._fields.5.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> SubjectView<S> {
        SubjectView {
            profile: self._fields.0,
            record: self._fields.1,
            repo: self._fields.2,
            status: self._fields.3,
            subject: self._fields.4.unwrap(),
            r#type: self._fields.5.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod video_details_state {

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

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

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

impl<S: BosStr> VideoDetails<S> {
    /// Create a new builder for this type
    pub fn builder() -> VideoDetailsBuilder<video_details_state::Empty, S> {
        VideoDetailsBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> VideoDetailsBuilder<St, S>
where
    St: video_details_state::State,
    St::Length: video_details_state::IsUnset,
{
    /// Set the `length` field (required)
    pub fn length(
        mut self,
        value: impl Into<i64>,
    ) -> VideoDetailsBuilder<video_details_state::SetLength<St>, S> {
        self._fields.1 = Option::Some(value.into());
        VideoDetailsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> VideoDetailsBuilder<St, S>
where
    St: video_details_state::State,
    St::Width: video_details_state::IsUnset,
{
    /// Set the `width` field (required)
    pub fn width(
        mut self,
        value: impl Into<i64>,
    ) -> VideoDetailsBuilder<video_details_state::SetWidth<St>, S> {
        self._fields.2 = Option::Some(value.into());
        VideoDetailsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> VideoDetailsBuilder<St, S>
where
    St: video_details_state::State,
    St::Height: video_details_state::IsSet,
    St::Length: video_details_state::IsSet,
    St::Width: video_details_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> VideoDetails<S> {
        VideoDetails {
            height: self._fields.0.unwrap(),
            length: self._fields.1.unwrap(),
            width: 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>>,
    ) -> VideoDetails<S> {
        VideoDetails {
            height: self._fields.0.unwrap(),
            length: self._fields.1.unwrap(),
            width: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}