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

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;

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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct AccountEvent<'a> {
    ///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")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<AccountEventStatus<'a>>,
    pub timestamp: Datetime,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AccountEventStatus<'a> {
    Unknown,
    Deactivated,
    Deleted,
    Takendown,
    Suspended,
    Tombstoned,
    Other(CowStr<'a>),
}

impl<'a> AccountEventStatus<'a> {
    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(),
        }
    }
}

impl<'a> From<&'a str> for AccountEventStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "unknown" => Self::Unknown,
            "deactivated" => Self::Deactivated,
            "deleted" => Self::Deleted,
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "tombstoned" => Self::Tombstoned,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for AccountEventStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "unknown" => Self::Unknown,
            "deactivated" => Self::Deactivated,
            "deleted" => Self::Deleted,
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "tombstoned" => Self::Tombstoned,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for AccountEventStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for AccountEventStatus<'_> {
    type Output = AccountEventStatus<'static>;
    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()),
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct AccountHosting<'a> {
    #[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>,
    #[serde(borrow)]
    pub status: AccountHostingStatus<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AccountHostingStatus<'a> {
    Takendown,
    Suspended,
    Deleted,
    Deactivated,
    Unknown,
    Other(CowStr<'a>),
}

impl<'a> AccountHostingStatus<'a> {
    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(),
        }
    }
}

impl<'a> From<&'a str> for AccountHostingStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "deleted" => Self::Deleted,
            "deactivated" => Self::Deactivated,
            "unknown" => Self::Unknown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for AccountHostingStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "takendown" => Self::Takendown,
            "suspended" => Self::Suspended,
            "deleted" => Self::Deleted,
            "deactivated" => Self::Deactivated,
            "unknown" => Self::Unknown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for AccountHostingStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for AccountHostingStatus<'_> {
    type Output = AccountHostingStatus<'static>;
    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

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

/// Strike information for an account

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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct AgeAssuranceEvent<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub access: Option<Access<'a>>,
    ///The unique identifier for this instance of the age assurance flow, in UUID format.
    #[serde(borrow)]
    pub attempt_id: CowStr<'a>,
    ///The IP address used when completing the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub complete_ip: Option<CowStr<'a>>,
    ///The user agent used when completing the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub complete_ua: Option<CowStr<'a>>,
    ///The ISO 3166-1 alpha-2 country code provided when beginning the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub country_code: Option<CowStr<'a>>,
    ///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")]
    #[serde(borrow)]
    pub init_ip: Option<CowStr<'a>>,
    ///The user agent used when initiating the AA flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub init_ua: Option<CowStr<'a>>,
    ///The ISO 3166-2 region code provided when beginning the Age Assurance flow.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub region_code: Option<CowStr<'a>>,
    ///The status of the Age Assurance process.
    #[serde(borrow)]
    pub status: AgeAssuranceEventStatus<'a>,
}

/// The status of the Age Assurance process.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AgeAssuranceEventStatus<'a> {
    Unknown,
    Pending,
    Assured,
    Other(CowStr<'a>),
}

impl<'a> AgeAssuranceEventStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Unknown => "unknown",
            Self::Pending => "pending",
            Self::Assured => "assured",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for AgeAssuranceEventStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "unknown" => Self::Unknown,
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for AgeAssuranceEventStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "unknown" => Self::Unknown,
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for AgeAssuranceEventStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for AgeAssuranceEventStatus<'_> {
    type Output = AgeAssuranceEventStatus<'static>;
    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.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct AgeAssuranceOverrideEvent<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub access: Option<Access<'a>>,
    ///Comment describing the reason for the override.
    #[serde(borrow)]
    pub comment: CowStr<'a>,
    ///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.
    #[serde(borrow)]
    pub status: AgeAssuranceOverrideEventStatus<'a>,
}

/// 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<'a> {
    Assured,
    Reset,
    Blocked,
    Other(CowStr<'a>),
}

impl<'a> AgeAssuranceOverrideEventStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Assured => "assured",
            Self::Reset => "reset",
            Self::Blocked => "blocked",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for AgeAssuranceOverrideEventStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "assured" => Self::Assured,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for AgeAssuranceOverrideEventStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "assured" => Self::Assured,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for AgeAssuranceOverrideEventStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for AgeAssuranceOverrideEventStatus<'_> {
    type Output = AgeAssuranceOverrideEventStatus<'static>;
    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.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct AgeAssurancePurgeEvent<'a> {
    ///Comment describing the reason for the purge.
    #[serde(borrow)]
    pub comment: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct BlobView<'a> {
    #[serde(borrow)]
    pub cid: Cid<'a>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub details: Option<BlobViewDetails<'a>>,
    #[serde(borrow)]
    pub mime_type: CowStr<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub moderation: Option<moderation::Moderation<'a>>,
    pub size: i64,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum BlobViewDetails<'a> {
    #[serde(rename = "tools.ozone.moderation.defs#imageDetails")]
    ImageDetails(Box<moderation::ImageDetails<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#videoDetails")]
    VideoDetails(Box<moderation::VideoDetails<'a>>),
}

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

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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct IdentityEvent<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub handle: Option<Handle<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub pds_host: Option<UriValue<'a>>,
    pub timestamp: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tombstone: Option<bool>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ImageDetails<'a> {
    pub height: i64,
    pub width: i64,
}


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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventComment<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///Make the comment persistent on the subject
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sticky: Option<bool>,
}

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

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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventEmail<'a> {
    ///Additional comment about the outgoing comm.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///The content of the email sent to the user.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub content: Option<CowStr<'a>>,
    ///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")]
    #[serde(borrow)]
    pub policies: Option<Vec<CowStr<'a>>>,
    ///Severity level of the violation. Normally 'sev-1' that adds strike on repeat offense
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub severity_level: Option<CowStr<'a>>,
    ///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.
    #[serde(borrow)]
    pub subject_line: CowStr<'a>,
}


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

/// Apply/Negate labels on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventLabel<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub create_label_vals: Vec<CowStr<'a>>,
    ///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>,
    #[serde(borrow)]
    pub negate_label_vals: Vec<CowStr<'a>>,
}

/// Mute incoming reports on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventMute<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///Indicates how long the subject should remain muted.
    pub duration_in_hours: i64,
}

/// Mute incoming reports from an account

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventMuteReporter<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///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>,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventPriorityScore<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    pub score: i64,
}

/// Report a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventReport<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///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>,
    #[serde(borrow)]
    pub report_type: ReasonType<'a>,
}

/// Resolve appeal on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventResolveAppeal<'a> {
    ///Describe resolution.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
}

/// Revert take down action on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventReverseTakedown<'a> {
    ///Describe reasoning behind the reversal.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///Names/Keywords of the policy infraction for which takedown is being reversed.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub policies: Option<Vec<CowStr<'a>>>,
    ///Severity level of the violation. Usually set from the last policy infraction's severity.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub severity_level: Option<CowStr<'a>>,
    ///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>,
}

/// Add/Remove a tag on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventTag<'a> {
    ///Tags to be added to the subject. If already exists, won't be duplicated.
    #[serde(borrow)]
    pub add: Vec<CowStr<'a>>,
    ///Additional comment about added/removed tags.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated.
    #[serde(borrow)]
    pub remove: Vec<CowStr<'a>>,
}

/// Take down a subject permanently or temporarily

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventTakedown<'a> {
    ///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")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///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")]
    #[serde(borrow)]
    pub policies: Option<Vec<CowStr<'a>>>,
    ///Severity level of the violation (e.g., 'sev-0', 'sev-1', 'sev-2', etc.).
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub severity_level: Option<CowStr<'a>>,
    ///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")]
    #[serde(borrow)]
    pub target_services: Option<Vec<CowStr<'a>>>,
}

/// Unmute action on a subject

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventUnmute<'a> {
    ///Describe reasoning behind the reversal.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
}

/// Unmute incoming reports from an account

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModEventUnmuteReporter<'a> {
    ///Describe reasoning behind the reversal.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventView<'a> {
    pub created_at: Datetime,
    #[serde(borrow)]
    pub created_by: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub creator_handle: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub event: ModEventViewEvent<'a>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub mod_tool: Option<moderation::ModTool<'a>>,
    #[serde(borrow)]
    pub subject: ModEventViewSubject<'a>,
    #[serde(borrow)]
    pub subject_blob_cids: Vec<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subject_handle: Option<CowStr<'a>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ModEventViewEvent<'a> {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    ModEventTakedown(Box<moderation::ModEventTakedown<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    ModEventReverseTakedown(Box<moderation::ModEventReverseTakedown<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    ModEventComment(Box<moderation::ModEventComment<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    ModEventReport(Box<moderation::ModEventReport<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    ModEventLabel(Box<moderation::ModEventLabel<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    ModEventAcknowledge(Box<moderation::ModEventAcknowledge<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    ModEventEscalate(Box<moderation::ModEventEscalate<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    ModEventMute(Box<moderation::ModEventMute<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    ModEventUnmute(Box<moderation::ModEventUnmute<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    ModEventMuteReporter(Box<moderation::ModEventMuteReporter<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    ModEventUnmuteReporter(Box<moderation::ModEventUnmuteReporter<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    ModEventEmail(Box<moderation::ModEventEmail<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    ModEventResolveAppeal(Box<moderation::ModEventResolveAppeal<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    ModEventDivert(Box<moderation::ModEventDivert<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    ModEventTag(Box<moderation::ModEventTag<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    AccountEvent(Box<moderation::AccountEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    IdentityEvent(Box<moderation::IdentityEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    RecordEvent(Box<moderation::RecordEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    ModEventPriorityScore(Box<moderation::ModEventPriorityScore<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    AgeAssuranceEvent(Box<moderation::AgeAssuranceEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    AgeAssuranceOverrideEvent(Box<moderation::AgeAssuranceOverrideEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssurancePurgeEvent")]
    AgeAssurancePurgeEvent(Box<moderation::AgeAssurancePurgeEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    RevokeAccountCredentialsEvent(Box<moderation::RevokeAccountCredentialsEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    ScheduleTakedownEvent(Box<moderation::ScheduleTakedownEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    CancelScheduledTakedownEvent(Box<moderation::CancelScheduledTakedownEvent<'a>>),
}


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


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ModEventViewDetail<'a> {
    pub created_at: Datetime,
    #[serde(borrow)]
    pub created_by: Did<'a>,
    #[serde(borrow)]
    pub event: ModEventViewDetailEvent<'a>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub mod_tool: Option<moderation::ModTool<'a>>,
    #[serde(borrow)]
    pub subject: ModEventViewDetailSubject<'a>,
    #[serde(borrow)]
    pub subject_blobs: Vec<moderation::BlobView<'a>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum ModEventViewDetailEvent<'a> {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    ModEventTakedown(Box<moderation::ModEventTakedown<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    ModEventReverseTakedown(Box<moderation::ModEventReverseTakedown<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    ModEventComment(Box<moderation::ModEventComment<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    ModEventReport(Box<moderation::ModEventReport<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    ModEventLabel(Box<moderation::ModEventLabel<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    ModEventAcknowledge(Box<moderation::ModEventAcknowledge<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    ModEventEscalate(Box<moderation::ModEventEscalate<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    ModEventMute(Box<moderation::ModEventMute<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    ModEventUnmute(Box<moderation::ModEventUnmute<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    ModEventMuteReporter(Box<moderation::ModEventMuteReporter<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    ModEventUnmuteReporter(Box<moderation::ModEventUnmuteReporter<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    ModEventEmail(Box<moderation::ModEventEmail<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    ModEventResolveAppeal(Box<moderation::ModEventResolveAppeal<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    ModEventDivert(Box<moderation::ModEventDivert<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    ModEventTag(Box<moderation::ModEventTag<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    AccountEvent(Box<moderation::AccountEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    IdentityEvent(Box<moderation::IdentityEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    RecordEvent(Box<moderation::RecordEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    ModEventPriorityScore(Box<moderation::ModEventPriorityScore<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    AgeAssuranceEvent(Box<moderation::AgeAssuranceEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    AgeAssuranceOverrideEvent(Box<moderation::AgeAssuranceOverrideEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssurancePurgeEvent")]
    AgeAssurancePurgeEvent(Box<moderation::AgeAssurancePurgeEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    RevokeAccountCredentialsEvent(Box<moderation::RevokeAccountCredentialsEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    ScheduleTakedownEvent(Box<moderation::ScheduleTakedownEvent<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    CancelScheduledTakedownEvent(Box<moderation::CancelScheduledTakedownEvent<'a>>),
}


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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModTool<'a> {
    ///Additional arbitrary metadata about the source
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub meta: Option<Data<'a>>,
    ///Name/identifier of the source (e.g., 'automod', 'ozone/workspace')
    #[serde(borrow)]
    pub name: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Moderation<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subject_status: Option<moderation::SubjectStatusView<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ModerationDetail<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subject_status: Option<moderation::SubjectStatusView<'a>>,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecordEvent<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub op: RecordEventOp<'a>,
    pub timestamp: Datetime,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RecordEventOp<'a> {
    Create,
    Update,
    Delete,
    Other(CowStr<'a>),
}

impl<'a> RecordEventOp<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Create => "create",
            Self::Update => "update",
            Self::Delete => "delete",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for RecordEventOp<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "create" => Self::Create,
            "update" => Self::Update,
            "delete" => Self::Delete,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for RecordEventOp<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "create" => Self::Create,
            "update" => Self::Update,
            "delete" => Self::Delete,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for RecordEventOp<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for RecordEventOp<'_> {
    type Output = RecordEventOp<'static>;
    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()),
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct RecordHosting<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<Datetime>,
    #[serde(borrow)]
    pub status: RecordHostingStatus<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum RecordHostingStatus<'a> {
    Deleted,
    Unknown,
    Other(CowStr<'a>),
}

impl<'a> RecordHostingStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Deleted => "deleted",
            Self::Unknown => "unknown",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for RecordHostingStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "deleted" => Self::Deleted,
            "unknown" => Self::Unknown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for RecordHostingStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "deleted" => Self::Deleted,
            "unknown" => Self::Unknown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for RecordHostingStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

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


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecordView<'a> {
    #[serde(borrow)]
    pub blob_cids: Vec<Cid<'a>>,
    #[serde(borrow)]
    pub cid: Cid<'a>,
    pub indexed_at: Datetime,
    #[serde(borrow)]
    pub moderation: moderation::Moderation<'a>,
    #[serde(borrow)]
    pub repo: moderation::RepoView<'a>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Data<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RecordViewDetail<'a> {
    #[serde(borrow)]
    pub blobs: Vec<moderation::BlobView<'a>>,
    #[serde(borrow)]
    pub cid: Cid<'a>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub labels: Option<Vec<Label<'a>>>,
    #[serde(borrow)]
    pub moderation: moderation::ModerationDetail<'a>,
    #[serde(borrow)]
    pub repo: moderation::RepoView<'a>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Data<'a>,
}


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

/// Statistics about a set of record subject items

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


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RepoView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<Datetime>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub email: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub handle: Handle<'a>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub invite_note: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub invited_by: Option<InviteCode<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    #[serde(borrow)]
    pub moderation: moderation::Moderation<'a>,
    #[serde(borrow)]
    pub related_records: Vec<Data<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub threat_signatures: Option<Vec<ThreatSignature<'a>>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct RepoViewDetail<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<Datetime>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub email: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email_confirmed_at: Option<Datetime>,
    #[serde(borrow)]
    pub handle: Handle<'a>,
    pub indexed_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub invite_note: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub invited_by: Option<InviteCode<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub invites: Option<Vec<InviteCode<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub labels: Option<Vec<Label<'a>>>,
    #[serde(borrow)]
    pub moderation: moderation::ModerationDetail<'a>,
    #[serde(borrow)]
    pub related_records: Vec<Data<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub threat_signatures: Option<Vec<ThreatSignature<'a>>>,
}


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


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReporterStats<'a> {
    ///The total number of reports made by the user on accounts.
    pub account_report_count: i64,
    #[serde(borrow)]
    pub did: Did<'a>,
    ///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,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct RevokeAccountCredentialsEvent<'a> {
    ///Comment describing the reason for the revocation.
    #[serde(borrow)]
    pub comment: CowStr<'a>,
}

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ScheduleTakedownEvent<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    #[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>,
}

/// View of a scheduled moderation action

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ScheduledActionView<'a> {
    ///Type of action to be executed
    #[serde(borrow)]
    pub action: ScheduledActionViewAction<'a>,
    ///When the scheduled action was created
    pub created_at: Datetime,
    ///DID of the user who created this scheduled action
    #[serde(borrow)]
    pub created_by: Did<'a>,
    ///Subject DID for the action
    #[serde(borrow)]
    pub did: Did<'a>,
    ///Serialized event object that will be propagated to the event when performed
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub event_data: Option<Data<'a>>,
    ///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")]
    #[serde(borrow)]
    pub last_failure_reason: Option<CowStr<'a>>,
    ///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
    #[serde(borrow)]
    pub status: ScheduledActionViewStatus<'a>,
    ///When the scheduled action was last updated
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
}

/// Type of action to be executed

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

impl<'a> ScheduledActionViewAction<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Takedown => "takedown",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ScheduledActionViewAction<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "takedown" => Self::Takedown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ScheduledActionViewAction<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "takedown" => Self::Takedown,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for ScheduledActionViewAction<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ScheduledActionViewAction<'_> {
    type Output = ScheduledActionViewAction<'static>;
    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<'a> {
    Pending,
    Executed,
    Cancelled,
    Failed,
    Other(CowStr<'a>),
}

impl<'a> ScheduledActionViewStatus<'a> {
    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(),
        }
    }
}

impl<'a> From<&'a str> for ScheduledActionViewStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "pending" => Self::Pending,
            "executed" => Self::Executed,
            "cancelled" => Self::Cancelled,
            "failed" => Self::Failed,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ScheduledActionViewStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "pending" => Self::Pending,
            "executed" => Self::Executed,
            "cancelled" => Self::Cancelled,
            "failed" => Self::Failed,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for ScheduledActionViewStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ScheduledActionViewStatus<'_> {
    type Output = ScheduledActionViewStatus<'static>;
    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<'a> {
    ToolsOzoneModerationDefsReviewOpen,
    ToolsOzoneModerationDefsReviewEscalated,
    ToolsOzoneModerationDefsReviewClosed,
    ToolsOzoneModerationDefsReviewNone,
    Other(CowStr<'a>),
}

impl<'a> SubjectReviewState<'a> {
    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(),
        }
    }
}

impl<'a> From<&'a str> for SubjectReviewState<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "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(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for SubjectReviewState<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "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(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl jacquard_common::IntoStatic for SubjectReviewState<'_> {
    type Output = SubjectReviewState<'static>;
    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()),
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SubjectStatusView<'a> {
    ///Statistics related to the account subject
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub account_stats: Option<moderation::AccountStats<'a>>,
    ///Strike information for the account (account-level only)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub account_strike: Option<moderation::AccountStrike<'a>>,
    ///Current age assurance state of the subject.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub age_assurance_state: Option<SubjectStatusViewAgeAssuranceState<'a>>,
    ///Whether or not the last successful update to age assurance was made by the user or admin.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub age_assurance_updated_by: Option<SubjectStatusViewAgeAssuranceUpdatedBy<'a>>,
    ///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")]
    #[serde(borrow)]
    pub comment: Option<CowStr<'a>>,
    ///Timestamp referencing the first moderation status impacting event was emitted on the subject
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub hosting: Option<SubjectStatusViewHosting<'a>>,
    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")]
    #[serde(borrow)]
    pub last_reviewed_by: Option<Did<'a>>,
    #[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")]
    #[serde(borrow)]
    pub records_stats: Option<moderation::RecordsStats<'a>>,
    #[serde(borrow)]
    pub review_state: moderation::SubjectReviewState<'a>,
    #[serde(borrow)]
    pub subject: SubjectStatusViewSubject<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subject_blob_cids: Option<Vec<Cid<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub subject_repo_handle: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub suspend_until: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub tags: Option<Vec<CowStr<'a>>>,
    #[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,
}

/// Current age assurance state of the subject.

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum SubjectStatusViewAgeAssuranceState<'a> {
    Pending,
    Assured,
    Unknown,
    Reset,
    Blocked,
    Other(CowStr<'a>),
}

impl<'a> SubjectStatusViewAgeAssuranceState<'a> {
    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(),
        }
    }
}

impl<'a> From<&'a str> for SubjectStatusViewAgeAssuranceState<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            "unknown" => Self::Unknown,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for SubjectStatusViewAgeAssuranceState<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "pending" => Self::Pending,
            "assured" => Self::Assured,
            "unknown" => Self::Unknown,
            "reset" => Self::Reset,
            "blocked" => Self::Blocked,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for SubjectStatusViewAgeAssuranceState<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for SubjectStatusViewAgeAssuranceState<'_> {
    type Output = SubjectStatusViewAgeAssuranceState<'static>;
    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<'a> {
    Admin,
    User,
    Other(CowStr<'a>),
}

impl<'a> SubjectStatusViewAgeAssuranceUpdatedBy<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Admin => "admin",
            Self::User => "user",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for SubjectStatusViewAgeAssuranceUpdatedBy<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "admin" => Self::Admin,
            "user" => Self::User,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for SubjectStatusViewAgeAssuranceUpdatedBy<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "admin" => Self::Admin,
            "user" => Self::User,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for SubjectStatusViewAgeAssuranceUpdatedBy<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for SubjectStatusViewAgeAssuranceUpdatedBy<'_> {
    type Output = SubjectStatusViewAgeAssuranceUpdatedBy<'static>;
    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")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum SubjectStatusViewHosting<'a> {
    #[serde(rename = "tools.ozone.moderation.defs#accountHosting")]
    AccountHosting(Box<moderation::AccountHosting<'a>>),
    #[serde(rename = "tools.ozone.moderation.defs#recordHosting")]
    RecordHosting(Box<moderation::RecordHosting<'a>>),
}


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

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SubjectView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub profile: Option<Data<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub record: Option<moderation::RecordViewDetail<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub repo: Option<moderation::RepoViewDetail<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<moderation::SubjectStatusView<'a>>,
    #[serde(borrow)]
    pub subject: CowStr<'a>,
    #[serde(borrow)]
    pub r#type: SubjectType<'a>,
}

/// 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")
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct VideoDetails<'a> {
    pub height: i64,
    pub length: i64,
    pub width: i64,
}

impl<'a> LexiconSchema for AccountEvent<'a> {
    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<'a> LexiconSchema for AccountHosting<'a> {
    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<'a> LexiconSchema for AccountStats<'a> {
    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<'a> LexiconSchema for AccountStrike<'a> {
    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<'a> LexiconSchema for AgeAssuranceEvent<'a> {
    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<'a> LexiconSchema for AgeAssuranceOverrideEvent<'a> {
    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<'a> LexiconSchema for AgeAssurancePurgeEvent<'a> {
    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<'a> LexiconSchema for BlobView<'a> {
    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<'a> LexiconSchema for CancelScheduledTakedownEvent<'a> {
    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<'a> LexiconSchema for IdentityEvent<'a> {
    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<'a> LexiconSchema for ImageDetails<'a> {
    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<'a> LexiconSchema for ModEventAcknowledge<'a> {
    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<'a> LexiconSchema for ModEventComment<'a> {
    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<'a> LexiconSchema for ModEventDivert<'a> {
    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<'a> LexiconSchema for ModEventEmail<'a> {
    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<'a> LexiconSchema for ModEventEscalate<'a> {
    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<'a> LexiconSchema for ModEventLabel<'a> {
    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<'a> LexiconSchema for ModEventMute<'a> {
    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<'a> LexiconSchema for ModEventMuteReporter<'a> {
    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<'a> LexiconSchema for ModEventPriorityScore<'a> {
    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<'a> LexiconSchema for ModEventReport<'a> {
    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<'a> LexiconSchema for ModEventResolveAppeal<'a> {
    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<'a> LexiconSchema for ModEventReverseTakedown<'a> {
    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<'a> LexiconSchema for ModEventTag<'a> {
    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<'a> LexiconSchema for ModEventTakedown<'a> {
    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<'a> LexiconSchema for ModEventUnmute<'a> {
    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<'a> LexiconSchema for ModEventUnmuteReporter<'a> {
    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<'a> LexiconSchema for ModEventView<'a> {
    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<'a> LexiconSchema for ModEventViewDetail<'a> {
    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<'a> LexiconSchema for ModTool<'a> {
    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<'a> LexiconSchema for Moderation<'a> {
    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<'a> LexiconSchema for ModerationDetail<'a> {
    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<'a> LexiconSchema for RecordEvent<'a> {
    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<'a> LexiconSchema for RecordHosting<'a> {
    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<'a> LexiconSchema for RecordView<'a> {
    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<'a> LexiconSchema for RecordViewDetail<'a> {
    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<'a> LexiconSchema for RecordViewNotFound<'a> {
    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<'a> LexiconSchema for RecordsStats<'a> {
    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<'a> LexiconSchema for RepoView<'a> {
    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<'a> LexiconSchema for RepoViewDetail<'a> {
    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<'a> LexiconSchema for RepoViewNotFound<'a> {
    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<'a> LexiconSchema for ReporterStats<'a> {
    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<'a> LexiconSchema for RevokeAccountCredentialsEvent<'a> {
    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<'a> LexiconSchema for ScheduleTakedownEvent<'a> {
    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<'a> LexiconSchema for ScheduledActionView<'a> {
    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<'a> LexiconSchema for SubjectStatusView<'a> {
    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<'a> LexiconSchema for SubjectView<'a> {
    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<'a> LexiconSchema for VideoDetails<'a> {
    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 Timestamp;
        type Active;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Timestamp = Unset;
        type Active = Unset;
    }
    ///State transition - sets the `timestamp` field to Set
    pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTimestamp<S> {}
    impl<S: State> State for SetTimestamp<S> {
        type Timestamp = Set<members::timestamp>;
        type Active = S::Active;
    }
    ///State transition - sets the `active` field to Set
    pub struct SetActive<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetActive<S> {}
    impl<S: State> State for SetActive<S> {
        type Timestamp = S::Timestamp;
        type Active = Set<members::active>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `timestamp` field
        pub struct timestamp(());
        ///Marker type for the `active` field
        pub struct active(());
    }
}

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

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

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

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

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

impl<'a, S: account_event_state::State> AccountEventBuilder<'a, S> {
    /// Set the `status` field (optional)
    pub fn status(mut self, value: impl Into<Option<AccountEventStatus<'a>>>) -> 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<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

impl<'a, S> AccountEventBuilder<'a, S>
where
    S: account_event_state::State,
    S::Timestamp: account_event_state::IsSet,
    S::Active: account_event_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> AccountEvent<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> AccountEvent<'a> {
        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("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("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")
                                ],
                                ..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")
                                ],
                                ..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")
                                ],
                                ..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 CreatedAt;
        type AttemptId;
        type Status;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedAt = Unset;
        type AttemptId = Unset;
        type Status = Unset;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type CreatedAt = Set<members::created_at>;
        type AttemptId = S::AttemptId;
        type Status = S::Status;
    }
    ///State transition - sets the `attempt_id` field to Set
    pub struct SetAttemptId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAttemptId<S> {}
    impl<S: State> State for SetAttemptId<S> {
        type CreatedAt = S::CreatedAt;
        type AttemptId = Set<members::attempt_id>;
        type Status = S::Status;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStatus<S> {}
    impl<S: State> State for SetStatus<S> {
        type CreatedAt = S::CreatedAt;
        type AttemptId = S::AttemptId;
        type Status = Set<members::status>;
    }
    /// 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 `attempt_id` field
        pub struct attempt_id(());
        ///Marker type for the `status` field
        pub struct status(());
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<'a, S> AgeAssuranceEventBuilder<'a, S>
where
    S: age_assurance_event_state::State,
    S::CreatedAt: age_assurance_event_state::IsSet,
    S::AttemptId: age_assurance_event_state::IsSet,
    S::Status: age_assurance_event_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> AgeAssuranceEvent<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> AgeAssuranceEvent<'a> {
        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 MimeType;
        type Cid;
        type Size;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type MimeType = Unset;
        type Cid = Unset;
        type Size = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `mime_type` field to Set
    pub struct SetMimeType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetMimeType<S> {}
    impl<S: State> State for SetMimeType<S> {
        type MimeType = Set<members::mime_type>;
        type Cid = S::Cid;
        type Size = S::Size;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type MimeType = S::MimeType;
        type Cid = Set<members::cid>;
        type Size = S::Size;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `size` field to Set
    pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSize<S> {}
    impl<S: State> State for SetSize<S> {
        type MimeType = S::MimeType;
        type Cid = S::Cid;
        type Size = Set<members::size>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type MimeType = S::MimeType;
        type Cid = S::Cid;
        type Size = S::Size;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `mime_type` field
        pub struct mime_type(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `size` field
        pub struct size(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct BlobViewBuilder<'a, S: blob_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<BlobViewDetails<'a>>,
        Option<CowStr<'a>>,
        Option<moderation::Moderation<'a>>,
        Option<i64>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

impl<'a, S: blob_view_state::State> BlobViewBuilder<'a, S> {
    /// Set the `details` field (optional)
    pub fn details(mut self, value: impl Into<Option<BlobViewDetails<'a>>>) -> 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<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

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

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

impl<'a, S> BlobViewBuilder<'a, S>
where
    S: blob_view_state::State,
    S::MimeType: blob_view_state::IsSet,
    S::Cid: blob_view_state::IsSet,
    S::Size: blob_view_state::IsSet,
    S::CreatedAt: blob_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> BlobView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> BlobView<'a> {
        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 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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTimestamp<S> {}
    impl<S: State> State for SetTimestamp<S> {
        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<'a, S: identity_event_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<Handle<'a>>,
        Option<UriValue<'a>>,
        Option<Datetime>,
        Option<bool>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

impl<'a, S: identity_event_state::State> IdentityEventBuilder<'a, 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<'a, S> IdentityEventBuilder<'a, S>
where
    S: identity_event_state::State,
    S::Timestamp: identity_event_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> IdentityEvent<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> IdentityEvent<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHeight<S> {}
    impl<S: State> State for SetHeight<S> {
        type Height = Set<members::height>;
        type Width = S::Width;
    }
    ///State transition - sets the `width` field to Set
    pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetWidth<S> {}
    impl<S: State> State for SetWidth<S> {
        type Height = S::Height;
        type Width = Set<members::width>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `height` field
        pub struct height(());
        ///Marker type for the `width` field
        pub struct width(());
    }
}

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

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

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

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

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

impl<'a, S> ImageDetailsBuilder<'a, S>
where
    S: image_details_state::State,
    S::Height: image_details_state::IsSet,
    S::Width: image_details_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ImageDetails<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ImageDetails<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreateLabelVals<S> {}
    impl<S: State> State for SetCreateLabelVals<S> {
        type CreateLabelVals = Set<members::create_label_vals>;
        type NegateLabelVals = S::NegateLabelVals;
    }
    ///State transition - sets the `negate_label_vals` field to Set
    pub struct SetNegateLabelVals<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetNegateLabelVals<S> {}
    impl<S: State> State for SetNegateLabelVals<S> {
        type CreateLabelVals = S::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<'a, S: mod_event_label_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<Vec<CowStr<'a>>>,
        Option<i64>,
        Option<Vec<CowStr<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

impl<'a, S: mod_event_label_state::State> ModEventLabelBuilder<'a, 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<'a, S> ModEventLabelBuilder<'a, S>
where
    S: mod_event_label_state::State,
    S::NegateLabelVals: mod_event_label_state::IsUnset,
{
    /// Set the `negateLabelVals` field (required)
    pub fn negate_label_vals(
        mut self,
        value: impl Into<Vec<CowStr<'a>>>,
    ) -> ModEventLabelBuilder<'a, mod_event_label_state::SetNegateLabelVals<S>> {
        self._fields.3 = Option::Some(value.into());
        ModEventLabelBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ModEventLabelBuilder<'a, S>
where
    S: mod_event_label_state::State,
    S::CreateLabelVals: mod_event_label_state::IsSet,
    S::NegateLabelVals: mod_event_label_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventLabel<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventLabel<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDurationInHours<S> {}
    impl<S: State> State for SetDurationInHours<S> {
        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<'a, S: mod_event_mute_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

impl<'a, S> ModEventMuteBuilder<'a, S>
where
    S: mod_event_mute_state::State,
    S::DurationInHours: mod_event_mute_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventMute<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventMute<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetScore<S> {}
    impl<S: State> State for SetScore<S> {
        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<'a, S: mod_event_priority_score_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

impl<'a, S> ModEventPriorityScoreBuilder<'a, S>
where
    S: mod_event_priority_score_state::State,
    S::Score: mod_event_priority_score_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventPriorityScore<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventPriorityScore<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReportType<S> {}
    impl<S: State> State for SetReportType<S> {
        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<'a, S: mod_event_report_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>, Option<bool>, Option<ReasonType<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

impl<'a, S: mod_event_report_state::State> ModEventReportBuilder<'a, 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<'a, S> ModEventReportBuilder<'a, S>
where
    S: mod_event_report_state::State,
    S::ReportType: mod_event_report_state::IsUnset,
{
    /// Set the `reportType` field (required)
    pub fn report_type(
        mut self,
        value: impl Into<ReasonType<'a>>,
    ) -> ModEventReportBuilder<'a, mod_event_report_state::SetReportType<S>> {
        self._fields.2 = Option::Some(value.into());
        ModEventReportBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ModEventReportBuilder<'a, S>
where
    S: mod_event_report_state::State,
    S::ReportType: mod_event_report_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventReport<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventReport<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAdd<S> {}
    impl<S: State> State for SetAdd<S> {
        type Add = Set<members::add>;
        type Remove = S::Remove;
    }
    ///State transition - sets the `remove` field to Set
    pub struct SetRemove<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRemove<S> {}
    impl<S: State> State for SetRemove<S> {
        type Add = S::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<'a, S: mod_event_tag_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<Vec<CowStr<'a>>>, Option<CowStr<'a>>, Option<Vec<CowStr<'a>>>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

impl<'a, S> ModEventTagBuilder<'a, S>
where
    S: mod_event_tag_state::State,
    S::Add: mod_event_tag_state::IsSet,
    S::Remove: mod_event_tag_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventTag<'a> {
        ModEventTag {
            add: self._fields.0.unwrap(),
            comment: self._fields.1,
            remove: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventTag<'a> {
        ModEventTag {
            add: self._fields.0.unwrap(),
            comment: self._fields.1,
            remove: self._fields.2.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 Id;
        type Subject;
        type Event;
        type CreatedBy;
        type SubjectBlobCids;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type Subject = Unset;
        type Event = Unset;
        type CreatedBy = Unset;
        type SubjectBlobCids = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Id = Set<members::id>;
        type Subject = S::Subject;
        type Event = S::Event;
        type CreatedBy = S::CreatedBy;
        type SubjectBlobCids = S::SubjectBlobCids;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubject<S> {}
    impl<S: State> State for SetSubject<S> {
        type Id = S::Id;
        type Subject = Set<members::subject>;
        type Event = S::Event;
        type CreatedBy = S::CreatedBy;
        type SubjectBlobCids = S::SubjectBlobCids;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `event` field to Set
    pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetEvent<S> {}
    impl<S: State> State for SetEvent<S> {
        type Id = S::Id;
        type Subject = S::Subject;
        type Event = Set<members::event>;
        type CreatedBy = S::CreatedBy;
        type SubjectBlobCids = S::SubjectBlobCids;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedBy<S> {}
    impl<S: State> State for SetCreatedBy<S> {
        type Id = S::Id;
        type Subject = S::Subject;
        type Event = S::Event;
        type CreatedBy = Set<members::created_by>;
        type SubjectBlobCids = S::SubjectBlobCids;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `subject_blob_cids` field to Set
    pub struct SetSubjectBlobCids<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubjectBlobCids<S> {}
    impl<S: State> State for SetSubjectBlobCids<S> {
        type Id = S::Id;
        type Subject = S::Subject;
        type Event = S::Event;
        type CreatedBy = S::CreatedBy;
        type SubjectBlobCids = Set<members::subject_blob_cids>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Id = S::Id;
        type Subject = S::Subject;
        type Event = S::Event;
        type CreatedBy = S::CreatedBy;
        type SubjectBlobCids = S::SubjectBlobCids;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `event` field
        pub struct event(());
        ///Marker type for the `created_by` field
        pub struct created_by(());
        ///Marker type for the `subject_blob_cids` field
        pub struct subject_blob_cids(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct ModEventViewBuilder<'a, S: mod_event_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<ModEventViewEvent<'a>>,
        Option<i64>,
        Option<moderation::ModTool<'a>>,
        Option<ModEventViewSubject<'a>>,
        Option<Vec<CowStr<'a>>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

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

impl<'a, S: mod_event_view_state::State> ModEventViewBuilder<'a, S> {
    /// Set the `modTool` field (optional)
    pub fn mod_tool(
        mut self,
        value: impl Into<Option<moderation::ModTool<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.5 = value;
        self
    }
}

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

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

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

impl<'a, S> ModEventViewBuilder<'a, S>
where
    S: mod_event_view_state::State,
    S::Id: mod_event_view_state::IsSet,
    S::Subject: mod_event_view_state::IsSet,
    S::Event: mod_event_view_state::IsSet,
    S::CreatedBy: mod_event_view_state::IsSet,
    S::SubjectBlobCids: mod_event_view_state::IsSet,
    S::CreatedAt: mod_event_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventView<'a> {
        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 CreatedBy;
        type SubjectBlobs;
        type Subject;
        type CreatedAt;
        type Id;
        type Event;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type CreatedBy = Unset;
        type SubjectBlobs = Unset;
        type Subject = Unset;
        type CreatedAt = Unset;
        type Id = Unset;
        type Event = Unset;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedBy<S> {}
    impl<S: State> State for SetCreatedBy<S> {
        type CreatedBy = Set<members::created_by>;
        type SubjectBlobs = S::SubjectBlobs;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
        type Id = S::Id;
        type Event = S::Event;
    }
    ///State transition - sets the `subject_blobs` field to Set
    pub struct SetSubjectBlobs<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubjectBlobs<S> {}
    impl<S: State> State for SetSubjectBlobs<S> {
        type CreatedBy = S::CreatedBy;
        type SubjectBlobs = Set<members::subject_blobs>;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
        type Id = S::Id;
        type Event = S::Event;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubject<S> {}
    impl<S: State> State for SetSubject<S> {
        type CreatedBy = S::CreatedBy;
        type SubjectBlobs = S::SubjectBlobs;
        type Subject = Set<members::subject>;
        type CreatedAt = S::CreatedAt;
        type Id = S::Id;
        type Event = S::Event;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type CreatedBy = S::CreatedBy;
        type SubjectBlobs = S::SubjectBlobs;
        type Subject = S::Subject;
        type CreatedAt = Set<members::created_at>;
        type Id = S::Id;
        type Event = S::Event;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type CreatedBy = S::CreatedBy;
        type SubjectBlobs = S::SubjectBlobs;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
        type Id = Set<members::id>;
        type Event = S::Event;
    }
    ///State transition - sets the `event` field to Set
    pub struct SetEvent<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetEvent<S> {}
    impl<S: State> State for SetEvent<S> {
        type CreatedBy = S::CreatedBy;
        type SubjectBlobs = S::SubjectBlobs;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
        type Id = S::Id;
        type Event = Set<members::event>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `created_by` field
        pub struct created_by(());
        ///Marker type for the `subject_blobs` field
        pub struct subject_blobs(());
        ///Marker type for the `subject` field
        pub struct subject(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `event` field
        pub struct event(());
    }
}

/// Builder for constructing an instance of this type
pub struct ModEventViewDetailBuilder<'a, S: mod_event_view_detail_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<Did<'a>>,
        Option<ModEventViewDetailEvent<'a>>,
        Option<i64>,
        Option<moderation::ModTool<'a>>,
        Option<ModEventViewDetailSubject<'a>>,
        Option<Vec<moderation::BlobView<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

impl<'a, S: mod_event_view_detail_state::State> ModEventViewDetailBuilder<'a, S> {
    /// Set the `modTool` field (optional)
    pub fn mod_tool(
        mut self,
        value: impl Into<Option<moderation::ModTool<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

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

impl<'a, S> ModEventViewDetailBuilder<'a, S>
where
    S: mod_event_view_detail_state::State,
    S::CreatedBy: mod_event_view_detail_state::IsSet,
    S::SubjectBlobs: mod_event_view_detail_state::IsSet,
    S::Subject: mod_event_view_detail_state::IsSet,
    S::CreatedAt: mod_event_view_detail_state::IsSet,
    S::Id: mod_event_view_detail_state::IsSet,
    S::Event: mod_event_view_detail_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ModEventViewDetail<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ModEventViewDetail<'a> {
        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 Timestamp;
        type Op;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Timestamp = Unset;
        type Op = Unset;
    }
    ///State transition - sets the `timestamp` field to Set
    pub struct SetTimestamp<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTimestamp<S> {}
    impl<S: State> State for SetTimestamp<S> {
        type Timestamp = Set<members::timestamp>;
        type Op = S::Op;
    }
    ///State transition - sets the `op` field to Set
    pub struct SetOp<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetOp<S> {}
    impl<S: State> State for SetOp<S> {
        type Timestamp = S::Timestamp;
        type Op = Set<members::op>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `timestamp` field
        pub struct timestamp(());
        ///Marker type for the `op` field
        pub struct op(());
    }
}

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

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

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

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

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

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

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

impl<'a, S> RecordEventBuilder<'a, S>
where
    S: record_event_state::State,
    S::Timestamp: record_event_state::IsSet,
    S::Op: record_event_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RecordEvent<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RecordEvent<'a> {
        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 Cid;
        type Value;
        type IndexedAt;
        type Uri;
        type Moderation;
        type Repo;
        type BlobCids;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Cid = Unset;
        type Value = Unset;
        type IndexedAt = Unset;
        type Uri = Unset;
        type Moderation = Unset;
        type Repo = Unset;
        type BlobCids = Unset;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type Cid = Set<members::cid>;
        type Value = S::Value;
        type IndexedAt = S::IndexedAt;
        type Uri = S::Uri;
        type Moderation = S::Moderation;
        type Repo = S::Repo;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `value` field to Set
    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetValue<S> {}
    impl<S: State> State for SetValue<S> {
        type Cid = S::Cid;
        type Value = Set<members::value>;
        type IndexedAt = S::IndexedAt;
        type Uri = S::Uri;
        type Moderation = S::Moderation;
        type Repo = S::Repo;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
    impl<S: State> State for SetIndexedAt<S> {
        type Cid = S::Cid;
        type Value = S::Value;
        type IndexedAt = Set<members::indexed_at>;
        type Uri = S::Uri;
        type Moderation = S::Moderation;
        type Repo = S::Repo;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        type Cid = S::Cid;
        type Value = S::Value;
        type IndexedAt = S::IndexedAt;
        type Uri = Set<members::uri>;
        type Moderation = S::Moderation;
        type Repo = S::Repo;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `moderation` field to Set
    pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetModeration<S> {}
    impl<S: State> State for SetModeration<S> {
        type Cid = S::Cid;
        type Value = S::Value;
        type IndexedAt = S::IndexedAt;
        type Uri = S::Uri;
        type Moderation = Set<members::moderation>;
        type Repo = S::Repo;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepo<S> {}
    impl<S: State> State for SetRepo<S> {
        type Cid = S::Cid;
        type Value = S::Value;
        type IndexedAt = S::IndexedAt;
        type Uri = S::Uri;
        type Moderation = S::Moderation;
        type Repo = Set<members::repo>;
        type BlobCids = S::BlobCids;
    }
    ///State transition - sets the `blob_cids` field to Set
    pub struct SetBlobCids<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetBlobCids<S> {}
    impl<S: State> State for SetBlobCids<S> {
        type Cid = S::Cid;
        type Value = S::Value;
        type IndexedAt = S::IndexedAt;
        type Uri = S::Uri;
        type Moderation = S::Moderation;
        type Repo = S::Repo;
        type BlobCids = Set<members::blob_cids>;
    }
    /// 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 `value` field
        pub struct value(());
        ///Marker type for the `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `moderation` field
        pub struct moderation(());
        ///Marker type for the `repo` field
        pub struct repo(());
        ///Marker type for the `blob_cids` field
        pub struct blob_cids(());
    }
}

/// Builder for constructing an instance of this type
pub struct RecordViewBuilder<'a, S: record_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Vec<Cid<'a>>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<moderation::Moderation<'a>>,
        Option<moderation::RepoView<'a>>,
        Option<AtUri<'a>>,
        Option<Data<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

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

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

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

impl<'a, S> RecordViewBuilder<'a, S>
where
    S: record_view_state::State,
    S::Cid: record_view_state::IsSet,
    S::Value: record_view_state::IsSet,
    S::IndexedAt: record_view_state::IsSet,
    S::Uri: record_view_state::IsSet,
    S::Moderation: record_view_state::IsSet,
    S::Repo: record_view_state::IsSet,
    S::BlobCids: record_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RecordView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RecordView<'a> {
        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 IndexedAt;
        type Repo;
        type Uri;
        type Cid;
        type Moderation;
        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 IndexedAt = Unset;
        type Repo = Unset;
        type Uri = Unset;
        type Cid = Unset;
        type Moderation = Unset;
        type Value = Unset;
    }
    ///State transition - sets the `blobs` field to Set
    pub struct SetBlobs<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetBlobs<S> {}
    impl<S: State> State for SetBlobs<S> {
        type Blobs = Set<members::blobs>;
        type IndexedAt = S::IndexedAt;
        type Repo = S::Repo;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Moderation = S::Moderation;
        type Value = S::Value;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
    impl<S: State> State for SetIndexedAt<S> {
        type Blobs = S::Blobs;
        type IndexedAt = Set<members::indexed_at>;
        type Repo = S::Repo;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Moderation = S::Moderation;
        type Value = S::Value;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepo<S> {}
    impl<S: State> State for SetRepo<S> {
        type Blobs = S::Blobs;
        type IndexedAt = S::IndexedAt;
        type Repo = Set<members::repo>;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Moderation = S::Moderation;
        type Value = S::Value;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        type Blobs = S::Blobs;
        type IndexedAt = S::IndexedAt;
        type Repo = S::Repo;
        type Uri = Set<members::uri>;
        type Cid = S::Cid;
        type Moderation = S::Moderation;
        type Value = S::Value;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type Blobs = S::Blobs;
        type IndexedAt = S::IndexedAt;
        type Repo = S::Repo;
        type Uri = S::Uri;
        type Cid = Set<members::cid>;
        type Moderation = S::Moderation;
        type Value = S::Value;
    }
    ///State transition - sets the `moderation` field to Set
    pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetModeration<S> {}
    impl<S: State> State for SetModeration<S> {
        type Blobs = S::Blobs;
        type IndexedAt = S::IndexedAt;
        type Repo = S::Repo;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Moderation = Set<members::moderation>;
        type Value = S::Value;
    }
    ///State transition - sets the `value` field to Set
    pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetValue<S> {}
    impl<S: State> State for SetValue<S> {
        type Blobs = S::Blobs;
        type IndexedAt = S::IndexedAt;
        type Repo = S::Repo;
        type Uri = S::Uri;
        type Cid = S::Cid;
        type Moderation = S::Moderation;
        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 `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `repo` field
        pub struct repo(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `moderation` field
        pub struct moderation(());
        ///Marker type for the `value` field
        pub struct value(());
    }
}

/// Builder for constructing an instance of this type
pub struct RecordViewDetailBuilder<'a, S: record_view_detail_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Vec<moderation::BlobView<'a>>>,
        Option<Cid<'a>>,
        Option<Datetime>,
        Option<Vec<Label<'a>>>,
        Option<moderation::ModerationDetail<'a>>,
        Option<moderation::RepoView<'a>>,
        Option<AtUri<'a>>,
        Option<Data<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

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

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

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

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

impl<'a, S> RecordViewDetailBuilder<'a, S>
where
    S: record_view_detail_state::State,
    S::Blobs: record_view_detail_state::IsSet,
    S::IndexedAt: record_view_detail_state::IsSet,
    S::Repo: record_view_detail_state::IsSet,
    S::Uri: record_view_detail_state::IsSet,
    S::Cid: record_view_detail_state::IsSet,
    S::Moderation: record_view_detail_state::IsSet,
    S::Value: record_view_detail_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RecordViewDetail<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RecordViewDetail<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        type Uri = Set<members::uri>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `uri` field
        pub struct uri(());
    }
}

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

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

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

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

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

/// Builder for constructing an instance of this type
pub struct RepoViewBuilder<'a, S: repo_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<Handle<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<InviteCode<'a>>,
        Option<bool>,
        Option<moderation::Moderation<'a>>,
        Option<Vec<Data<'a>>>,
        Option<Vec<ThreatSignature<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

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

impl<'a, S: repo_view_state::State> RepoViewBuilder<'a, S> {
    /// Set the `invitedBy` field (optional)
    pub fn invited_by(mut self, value: impl Into<Option<InviteCode<'a>>>) -> 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<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: repo_view_state::State> RepoViewBuilder<'a, 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<'a, S> RepoViewBuilder<'a, S>
where
    S: repo_view_state::State,
    S::Moderation: repo_view_state::IsUnset,
{
    /// Set the `moderation` field (required)
    pub fn moderation(
        mut self,
        value: impl Into<moderation::Moderation<'a>>,
    ) -> RepoViewBuilder<'a, repo_view_state::SetModeration<S>> {
        self._fields.8 = Option::Some(value.into());
        RepoViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

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

impl<'a, S> RepoViewBuilder<'a, S>
where
    S: repo_view_state::State,
    S::Handle: repo_view_state::IsSet,
    S::Moderation: repo_view_state::IsSet,
    S::Did: repo_view_state::IsSet,
    S::RelatedRecords: repo_view_state::IsSet,
    S::IndexedAt: repo_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RepoView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RepoView<'a> {
        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 IndexedAt;
        type Handle;
        type RelatedRecords;
        type Moderation;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type IndexedAt = Unset;
        type Handle = Unset;
        type RelatedRecords = Unset;
        type Moderation = Unset;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Did = Set<members::did>;
        type IndexedAt = S::IndexedAt;
        type Handle = S::Handle;
        type RelatedRecords = S::RelatedRecords;
        type Moderation = S::Moderation;
    }
    ///State transition - sets the `indexed_at` field to Set
    pub struct SetIndexedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetIndexedAt<S> {}
    impl<S: State> State for SetIndexedAt<S> {
        type Did = S::Did;
        type IndexedAt = Set<members::indexed_at>;
        type Handle = S::Handle;
        type RelatedRecords = S::RelatedRecords;
        type Moderation = S::Moderation;
    }
    ///State transition - sets the `handle` field to Set
    pub struct SetHandle<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHandle<S> {}
    impl<S: State> State for SetHandle<S> {
        type Did = S::Did;
        type IndexedAt = S::IndexedAt;
        type Handle = Set<members::handle>;
        type RelatedRecords = S::RelatedRecords;
        type Moderation = S::Moderation;
    }
    ///State transition - sets the `related_records` field to Set
    pub struct SetRelatedRecords<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRelatedRecords<S> {}
    impl<S: State> State for SetRelatedRecords<S> {
        type Did = S::Did;
        type IndexedAt = S::IndexedAt;
        type Handle = S::Handle;
        type RelatedRecords = Set<members::related_records>;
        type Moderation = S::Moderation;
    }
    ///State transition - sets the `moderation` field to Set
    pub struct SetModeration<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetModeration<S> {}
    impl<S: State> State for SetModeration<S> {
        type Did = S::Did;
        type IndexedAt = S::IndexedAt;
        type Handle = S::Handle;
        type RelatedRecords = S::RelatedRecords;
        type Moderation = Set<members::moderation>;
    }
    /// 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 `indexed_at` field
        pub struct indexed_at(());
        ///Marker type for the `handle` field
        pub struct handle(());
        ///Marker type for the `related_records` field
        pub struct related_records(());
        ///Marker type for the `moderation` field
        pub struct moderation(());
    }
}

/// Builder for constructing an instance of this type
pub struct RepoViewDetailBuilder<'a, S: repo_view_detail_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Datetime>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<Handle<'a>>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<InviteCode<'a>>,
        Option<Vec<InviteCode<'a>>>,
        Option<bool>,
        Option<Vec<Label<'a>>>,
        Option<moderation::ModerationDetail<'a>>,
        Option<Vec<Data<'a>>>,
        Option<Vec<ThreatSignature<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

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

impl<'a, S: repo_view_detail_state::State> RepoViewDetailBuilder<'a, S> {
    /// Set the `invitedBy` field (optional)
    pub fn invited_by(mut self, value: impl Into<Option<InviteCode<'a>>>) -> 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<'a>>) -> Self {
        self._fields.7 = value;
        self
    }
}

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

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

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

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

impl<'a, S: repo_view_detail_state::State> RepoViewDetailBuilder<'a, S> {
    /// Set the `threatSignatures` field (optional)
    pub fn threat_signatures(
        mut self,
        value: impl Into<Option<Vec<ThreatSignature<'a>>>>,
    ) -> 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<'a>>>,
    ) -> Self {
        self._fields.13 = value;
        self
    }
}

impl<'a, S> RepoViewDetailBuilder<'a, S>
where
    S: repo_view_detail_state::State,
    S::Did: repo_view_detail_state::IsSet,
    S::IndexedAt: repo_view_detail_state::IsSet,
    S::Handle: repo_view_detail_state::IsSet,
    S::RelatedRecords: repo_view_detail_state::IsSet,
    S::Moderation: repo_view_detail_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RepoViewDetail<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RepoViewDetail<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Did = Set<members::did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `did` field
        pub struct did(());
    }
}

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

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

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

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

impl<'a, S> RepoViewNotFoundBuilder<'a, S>
where
    S: repo_view_not_found_state::State,
    S::Did: repo_view_not_found_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> RepoViewNotFound<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> RepoViewNotFound<'a> {
        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 Did;
        type LabeledRecordCount;
        type LabeledAccountCount;
        type TakendownAccountCount;
        type TakendownRecordCount;
        type ReportedAccountCount;
        type RecordReportCount;
        type AccountReportCount;
        type ReportedRecordCount;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Did = Unset;
        type LabeledRecordCount = Unset;
        type LabeledAccountCount = Unset;
        type TakendownAccountCount = Unset;
        type TakendownRecordCount = Unset;
        type ReportedAccountCount = Unset;
        type RecordReportCount = Unset;
        type AccountReportCount = Unset;
        type ReportedRecordCount = Unset;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Did = Set<members::did>;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `labeled_record_count` field to Set
    pub struct SetLabeledRecordCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLabeledRecordCount<S> {}
    impl<S: State> State for SetLabeledRecordCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = Set<members::labeled_record_count>;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `labeled_account_count` field to Set
    pub struct SetLabeledAccountCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLabeledAccountCount<S> {}
    impl<S: State> State for SetLabeledAccountCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = Set<members::labeled_account_count>;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `takendown_account_count` field to Set
    pub struct SetTakendownAccountCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTakendownAccountCount<S> {}
    impl<S: State> State for SetTakendownAccountCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = Set<members::takendown_account_count>;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `takendown_record_count` field to Set
    pub struct SetTakendownRecordCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTakendownRecordCount<S> {}
    impl<S: State> State for SetTakendownRecordCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = Set<members::takendown_record_count>;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `reported_account_count` field to Set
    pub struct SetReportedAccountCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReportedAccountCount<S> {}
    impl<S: State> State for SetReportedAccountCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = Set<members::reported_account_count>;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `record_report_count` field to Set
    pub struct SetRecordReportCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRecordReportCount<S> {}
    impl<S: State> State for SetRecordReportCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = Set<members::record_report_count>;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `account_report_count` field to Set
    pub struct SetAccountReportCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAccountReportCount<S> {}
    impl<S: State> State for SetAccountReportCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = Set<members::account_report_count>;
        type ReportedRecordCount = S::ReportedRecordCount;
    }
    ///State transition - sets the `reported_record_count` field to Set
    pub struct SetReportedRecordCount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReportedRecordCount<S> {}
    impl<S: State> State for SetReportedRecordCount<S> {
        type Did = S::Did;
        type LabeledRecordCount = S::LabeledRecordCount;
        type LabeledAccountCount = S::LabeledAccountCount;
        type TakendownAccountCount = S::TakendownAccountCount;
        type TakendownRecordCount = S::TakendownRecordCount;
        type ReportedAccountCount = S::ReportedAccountCount;
        type RecordReportCount = S::RecordReportCount;
        type AccountReportCount = S::AccountReportCount;
        type ReportedRecordCount = Set<members::reported_record_count>;
    }
    /// 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 `labeled_record_count` field
        pub struct labeled_record_count(());
        ///Marker type for the `labeled_account_count` field
        pub struct labeled_account_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(());
        ///Marker type for the `reported_account_count` field
        pub struct reported_account_count(());
        ///Marker type for the `record_report_count` field
        pub struct record_report_count(());
        ///Marker type for the `account_report_count` field
        pub struct account_report_count(());
        ///Marker type for the `reported_record_count` field
        pub struct reported_record_count(());
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

impl<'a, S> ReporterStatsBuilder<'a, S>
where
    S: reporter_stats_state::State,
    S::Did: reporter_stats_state::IsSet,
    S::LabeledRecordCount: reporter_stats_state::IsSet,
    S::LabeledAccountCount: reporter_stats_state::IsSet,
    S::TakendownAccountCount: reporter_stats_state::IsSet,
    S::TakendownRecordCount: reporter_stats_state::IsSet,
    S::ReportedAccountCount: reporter_stats_state::IsSet,
    S::RecordReportCount: reporter_stats_state::IsSet,
    S::AccountReportCount: reporter_stats_state::IsSet,
    S::ReportedRecordCount: reporter_stats_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ReporterStats<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ReporterStats<'a> {
        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 CreatedBy;
        type Did;
        type Id;
        type CreatedAt;
        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 CreatedBy = Unset;
        type Did = Unset;
        type Id = Unset;
        type CreatedAt = Unset;
        type Status = Unset;
    }
    ///State transition - sets the `action` field to Set
    pub struct SetAction<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAction<S> {}
    impl<S: State> State for SetAction<S> {
        type Action = Set<members::action>;
        type CreatedBy = S::CreatedBy;
        type Did = S::Did;
        type Id = S::Id;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
    }
    ///State transition - sets the `created_by` field to Set
    pub struct SetCreatedBy<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedBy<S> {}
    impl<S: State> State for SetCreatedBy<S> {
        type Action = S::Action;
        type CreatedBy = Set<members::created_by>;
        type Did = S::Did;
        type Id = S::Id;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type Action = S::Action;
        type CreatedBy = S::CreatedBy;
        type Did = Set<members::did>;
        type Id = S::Id;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Action = S::Action;
        type CreatedBy = S::CreatedBy;
        type Did = S::Did;
        type Id = Set<members::id>;
        type CreatedAt = S::CreatedAt;
        type Status = S::Status;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Action = S::Action;
        type CreatedBy = S::CreatedBy;
        type Did = S::Did;
        type Id = S::Id;
        type CreatedAt = Set<members::created_at>;
        type Status = S::Status;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStatus<S> {}
    impl<S: State> State for SetStatus<S> {
        type Action = S::Action;
        type CreatedBy = S::CreatedBy;
        type Did = S::Did;
        type Id = S::Id;
        type CreatedAt = S::CreatedAt;
        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_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 `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 ScheduledActionViewBuilder<'a, S: scheduled_action_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<ScheduledActionViewAction<'a>>,
        Option<Datetime>,
        Option<Did<'a>>,
        Option<Did<'a>>,
        Option<Data<'a>>,
        Option<Datetime>,
        Option<Datetime>,
        Option<Datetime>,
        Option<i64>,
        Option<i64>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<bool>,
        Option<ScheduledActionViewStatus<'a>>,
        Option<Datetime>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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

impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, S> {
    /// Set the `eventData` field (optional)
    pub fn event_data(mut self, value: impl Into<Option<Data<'a>>>) -> 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<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S> ScheduledActionViewBuilder<'a, S>
where
    S: scheduled_action_view_state::State,
    S::Id: scheduled_action_view_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<i64>,
    ) -> ScheduledActionViewBuilder<'a, scheduled_action_view_state::SetId<S>> {
        self._fields.9 = Option::Some(value.into());
        ScheduledActionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S> ScheduledActionViewBuilder<'a, S>
where
    S: scheduled_action_view_state::State,
    S::Status: scheduled_action_view_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<ScheduledActionViewStatus<'a>>,
    ) -> ScheduledActionViewBuilder<'a, scheduled_action_view_state::SetStatus<S>> {
        self._fields.13 = Option::Some(value.into());
        ScheduledActionViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: scheduled_action_view_state::State> ScheduledActionViewBuilder<'a, 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<'a, S> ScheduledActionViewBuilder<'a, S>
where
    S: scheduled_action_view_state::State,
    S::Action: scheduled_action_view_state::IsSet,
    S::CreatedBy: scheduled_action_view_state::IsSet,
    S::Did: scheduled_action_view_state::IsSet,
    S::Id: scheduled_action_view_state::IsSet,
    S::CreatedAt: scheduled_action_view_state::IsSet,
    S::Status: scheduled_action_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ScheduledActionView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> ScheduledActionView<'a> {
        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 UpdatedAt;
        type Id;
        type ReviewState;
        type Subject;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type UpdatedAt = Unset;
        type Id = Unset;
        type ReviewState = Unset;
        type Subject = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `updated_at` field to Set
    pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
    impl<S: State> State for SetUpdatedAt<S> {
        type UpdatedAt = Set<members::updated_at>;
        type Id = S::Id;
        type ReviewState = S::ReviewState;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type UpdatedAt = S::UpdatedAt;
        type Id = Set<members::id>;
        type ReviewState = S::ReviewState;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `review_state` field to Set
    pub struct SetReviewState<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReviewState<S> {}
    impl<S: State> State for SetReviewState<S> {
        type UpdatedAt = S::UpdatedAt;
        type Id = S::Id;
        type ReviewState = Set<members::review_state>;
        type Subject = S::Subject;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `subject` field to Set
    pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubject<S> {}
    impl<S: State> State for SetSubject<S> {
        type UpdatedAt = S::UpdatedAt;
        type Id = S::Id;
        type ReviewState = S::ReviewState;
        type Subject = Set<members::subject>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type UpdatedAt = S::UpdatedAt;
        type Id = S::Id;
        type ReviewState = S::ReviewState;
        type Subject = S::Subject;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `updated_at` field
        pub struct updated_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 `created_at` field
        pub struct created_at(());
    }
}

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

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

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

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `accountStats` field (optional)
    pub fn account_stats(
        mut self,
        value: impl Into<Option<moderation::AccountStats<'a>>>,
    ) -> 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<'a>>,
    ) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `accountStrike` field (optional)
    pub fn account_strike(
        mut self,
        value: impl Into<Option<moderation::AccountStrike<'a>>>,
    ) -> 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<'a>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `ageAssuranceState` field (optional)
    pub fn age_assurance_state(
        mut self,
        value: impl Into<Option<SubjectStatusViewAgeAssuranceState<'a>>>,
    ) -> 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<'a>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

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

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

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

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

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

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `lastReviewedBy` field (optional)
    pub fn last_reviewed_by(mut self, value: impl Into<Option<Did<'a>>>) -> 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<'a>>) -> Self {
        self._fields.12 = value;
        self
    }
}

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `recordsStats` field (optional)
    pub fn records_stats(
        mut self,
        value: impl Into<Option<moderation::RecordsStats<'a>>>,
    ) -> 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<'a>>,
    ) -> Self {
        self._fields.16 = value;
        self
    }
}

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

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

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, S> {
    /// Set the `subjectBlobCids` field (optional)
    pub fn subject_blob_cids(mut self, value: impl Into<Option<Vec<Cid<'a>>>>) -> 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<'a>>>) -> Self {
        self._fields.19 = value;
        self
    }
}

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

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

impl<'a, S: subject_status_view_state::State> SubjectStatusViewBuilder<'a, 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<'a, S> SubjectStatusViewBuilder<'a, S>
where
    S: subject_status_view_state::State,
    S::UpdatedAt: subject_status_view_state::IsUnset,
{
    /// Set the `updatedAt` field (required)
    pub fn updated_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> SubjectStatusViewBuilder<'a, subject_status_view_state::SetUpdatedAt<S>> {
        self._fields.24 = Option::Some(value.into());
        SubjectStatusViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> SubjectStatusViewBuilder<'a, S>
where
    S: subject_status_view_state::State,
    S::UpdatedAt: subject_status_view_state::IsSet,
    S::Id: subject_status_view_state::IsSet,
    S::ReviewState: subject_status_view_state::IsSet,
    S::Subject: subject_status_view_state::IsSet,
    S::CreatedAt: subject_status_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> SubjectStatusView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> SubjectStatusView<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubject<S> {}
    impl<S: State> State for SetSubject<S> {
        type Subject = Set<members::subject>;
        type Type = S::Type;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type Subject = S::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<'a, S: subject_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Data<'a>>,
        Option<moderation::RecordViewDetail<'a>>,
        Option<moderation::RepoViewDetail<'a>>,
        Option<moderation::SubjectStatusView<'a>>,
        Option<CowStr<'a>>,
        Option<SubjectType<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

impl<'a, S: subject_view_state::State> SubjectViewBuilder<'a, S> {
    /// Set the `repo` field (optional)
    pub fn repo(
        mut self,
        value: impl Into<Option<moderation::RepoViewDetail<'a>>>,
    ) -> 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<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

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

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

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

impl<'a, S> SubjectViewBuilder<'a, S>
where
    S: subject_view_state::State,
    S::Subject: subject_view_state::IsSet,
    S::Type: subject_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> SubjectView<'a> {
        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<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> SubjectView<'a> {
        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<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetHeight<S> {}
    impl<S: State> State for SetHeight<S> {
        type Height = Set<members::height>;
        type Length = S::Length;
        type Width = S::Width;
    }
    ///State transition - sets the `length` field to Set
    pub struct SetLength<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLength<S> {}
    impl<S: State> State for SetLength<S> {
        type Height = S::Height;
        type Length = Set<members::length>;
        type Width = S::Width;
    }
    ///State transition - sets the `width` field to Set
    pub struct SetWidth<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetWidth<S> {}
    impl<S: State> State for SetWidth<S> {
        type Height = S::Height;
        type Length = S::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<'a, S: video_details_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<i64>, Option<i64>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

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

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

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

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

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

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