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

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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};

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

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::admin::RepoRef;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::tools_ozone::moderation::AccountEvent;
use crate::tools_ozone::moderation::AgeAssuranceEvent;
use crate::tools_ozone::moderation::AgeAssuranceOverrideEvent;
use crate::tools_ozone::moderation::AgeAssurancePurgeEvent;
use crate::tools_ozone::moderation::CancelScheduledTakedownEvent;
use crate::tools_ozone::moderation::IdentityEvent;
use crate::tools_ozone::moderation::ModEventAcknowledge;
use crate::tools_ozone::moderation::ModEventComment;
use crate::tools_ozone::moderation::ModEventDivert;
use crate::tools_ozone::moderation::ModEventEmail;
use crate::tools_ozone::moderation::ModEventEscalate;
use crate::tools_ozone::moderation::ModEventLabel;
use crate::tools_ozone::moderation::ModEventMute;
use crate::tools_ozone::moderation::ModEventMuteReporter;
use crate::tools_ozone::moderation::ModEventPriorityScore;
use crate::tools_ozone::moderation::ModEventReport;
use crate::tools_ozone::moderation::ModEventResolveAppeal;
use crate::tools_ozone::moderation::ModEventReverseTakedown;
use crate::tools_ozone::moderation::ModEventTag;
use crate::tools_ozone::moderation::ModEventTakedown;
use crate::tools_ozone::moderation::ModEventUnmute;
use crate::tools_ozone::moderation::ModEventUnmuteReporter;
use crate::tools_ozone::moderation::ModEventView;
use crate::tools_ozone::moderation::ModTool;
use crate::tools_ozone::moderation::RecordEvent;
use crate::tools_ozone::moderation::RevokeAccountCredentialsEvent;
use crate::tools_ozone::moderation::ScheduleTakedownEvent;
use crate::tools_ozone::moderation::emit_event;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct EmitEvent<S: BosStr = DefaultStr> {
    pub created_by: Did<S>,
    pub event: EmitEventEvent<S>,
    ///An optional external ID for the event, used to deduplicate events from external systems. Fails when an event of same type with the same external ID exists for the same subject.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub external_id: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mod_tool: Option<ModTool<S>>,
    ///Optional report-level targeting. If provided, this event will be linked to specific reports and reporters may be notified.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub report_action: Option<emit_event::ReportAction<S>>,
    pub subject: EmitEventSubject<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_blob_cids: Option<Vec<Cid<S>>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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


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


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


#[derive(
    Serialize,
    Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    thiserror::Error,
    miette::Diagnostic
)]

#[serde(tag = "error", content = "message")]
pub enum EmitEventError {
    #[serde(rename = "SubjectHasAction")]
    SubjectHasAction(Option<SmolStr>),
    /// An event with the same external ID already exists for the subject.
    #[serde(rename = "DuplicateExternalId")]
    DuplicateExternalId(Option<SmolStr>),
    /// Catch-all for unknown error codes.
    #[serde(untagged)]
    Other { error: SmolStr, message: Option<SmolStr> },
}

impl core::fmt::Display for EmitEventError {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        match self {
            Self::SubjectHasAction(msg) => {
                write!(f, "SubjectHasAction")?;
                if let Some(msg) = msg {
                    write!(f, ": {}", msg)?;
                }
                Ok(())
            }
            Self::DuplicateExternalId(msg) => {
                write!(f, "DuplicateExternalId")?;
                if let Some(msg) = msg {
                    write!(f, ": {}", msg)?;
                }
                Ok(())
            }
            Self::Other { error, message } => {
                write!(f, "{}", error)?;
                if let Some(msg) = message {
                    write!(f, ": {}", msg)?;
                }
                Ok(())
            }
        }
    }
}

/// Target specific reports when emitting a moderation event

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ReportAction<S: BosStr = DefaultStr> {
    ///Target ALL reports on the subject
    #[serde(skip_serializing_if = "Option::is_none")]
    pub all: Option<bool>,
    ///Target specific report IDs
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ids: Option<Vec<i64>>,
    ///Note to send to reporter(s) when actioning their report
    #[serde(skip_serializing_if = "Option::is_none")]
    pub note: Option<S>,
    ///Target reports matching these report types on the subject (fully qualified NSIDs)
    #[serde(skip_serializing_if = "Option::is_none")]
    pub types: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/** Response marker for the `tools.ozone.moderation.emitEvent` procedure.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `EmitEventOutput<S>` for this endpoint.*/
pub struct EmitEventResponse;
impl jacquard_common::xrpc::XrpcResp for EmitEventResponse {
    const NSID: &'static str = "tools.ozone.moderation.emitEvent";
    const ENCODING: &'static str = "application/json";
    type Output<S: BosStr> = EmitEventOutput<S>;
    type Err = EmitEventError;
}

impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for EmitEvent<S> {
    const NSID: &'static str = "tools.ozone.moderation.emitEvent";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = EmitEventResponse;
}

/** Endpoint marker for the `tools.ozone.moderation.emitEvent` procedure.

Path: `/xrpc/tools.ozone.moderation.emitEvent`. The request payload type is `EmitEvent<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
pub struct EmitEventRequest;
impl jacquard_common::xrpc::XrpcEndpoint for EmitEventRequest {
    const PATH: &'static str = "/xrpc/tools.ozone.moderation.emitEvent";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<S: BosStr> = EmitEvent<S>;
    type Response = EmitEventResponse;
}

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

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

/// Builder for constructing an instance of this type.
pub struct EmitEventBuilder<St: emit_event_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<Did<S>>,
        Option<EmitEventEvent<S>>,
        Option<S>,
        Option<ModTool<S>>,
        Option<emit_event::ReportAction<S>>,
        Option<EmitEventSubject<S>>,
        Option<Vec<Cid<S>>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

impl<S: BosStr> EmitEvent<S> {
    /// Create a new builder for this type
    pub fn builder() -> EmitEventBuilder<emit_event_state::Empty, S> {
        EmitEventBuilder::builder()
    }
}

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

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

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

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

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

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

impl<St: emit_event_state::State, S: BosStr> EmitEventBuilder<St, S> {
    /// Set the `reportAction` field (optional)
    pub fn report_action(
        mut self,
        value: impl Into<Option<emit_event::ReportAction<S>>>,
    ) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `reportAction` field to an Option value (optional)
    pub fn maybe_report_action(
        mut self,
        value: Option<emit_event::ReportAction<S>>,
    ) -> Self {
        self._fields.4 = value;
        self
    }
}

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

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

impl<St, S: BosStr> EmitEventBuilder<St, S>
where
    St: emit_event_state::State,
    St::CreatedBy: emit_event_state::IsSet,
    St::Event: emit_event_state::IsSet,
    St::Subject: emit_event_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> EmitEvent<S> {
        EmitEvent {
            created_by: self._fields.0.unwrap(),
            event: self._fields.1.unwrap(),
            external_id: self._fields.2,
            mod_tool: self._fields.3,
            report_action: self._fields.4,
            subject: self._fields.5.unwrap(),
            subject_blob_cids: self._fields.6,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> EmitEvent<S> {
        EmitEvent {
            created_by: self._fields.0.unwrap(),
            event: self._fields.1.unwrap(),
            external_id: self._fields.2,
            mod_tool: self._fields.3,
            report_action: self._fields.4,
            subject: self._fields.5.unwrap(),
            subject_blob_cids: self._fields.6,
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_tools_ozone_moderation_emitEvent() -> 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.emitEvent"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcProcedure(LexXrpcProcedure {
                    input: Some(LexXrpcBody {
                        encoding: CowStr::new_static("application/json"),
                        schema: Some(
                            LexXrpcBodySchema::Object(LexObject {
                                required: Some(
                                    vec![
                                        SmolStr::new_static("event"),
                                        SmolStr::new_static("subject"),
                                        SmolStr::new_static("createdBy")
                                    ],
                                ),
                                properties: {
                                    #[allow(unused_mut)]
                                    let mut map = BTreeMap::new();
                                    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("tools.ozone.moderation.defs#modEventTakedown"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventAcknowledge"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventEscalate"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventComment"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventLabel"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventReport"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventMute"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventUnmute"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventMuteReporter"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventUnmuteReporter"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventReverseTakedown"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventResolveAppeal"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventEmail"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventDivert"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventTag"),
                                                CowStr::new_static("tools.ozone.moderation.defs#accountEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#identityEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#recordEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#modEventPriorityScore"),
                                                CowStr::new_static("tools.ozone.moderation.defs#ageAssuranceEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#ageAssuranceOverrideEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#ageAssurancePurgeEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#revokeAccountCredentialsEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#scheduleTakedownEvent"),
                                                CowStr::new_static("tools.ozone.moderation.defs#cancelScheduledTakedownEvent")
                                            ],
                                            ..Default::default()
                                        }),
                                    );
                                    map.insert(
                                        SmolStr::new_static("externalId"),
                                        LexObjectProperty::String(LexString {
                                            description: Some(
                                                CowStr::new_static(
                                                    "An optional external ID for the event, used to deduplicate events from external systems. Fails when an event of same type with the same external ID exists for the same subject.",
                                                ),
                                            ),
                                            ..Default::default()
                                        }),
                                    );
                                    map.insert(
                                        SmolStr::new_static("modTool"),
                                        LexObjectProperty::Ref(LexRef {
                                            r#ref: CowStr::new_static(
                                                "tools.ozone.moderation.defs#modTool",
                                            ),
                                            ..Default::default()
                                        }),
                                    );
                                    map.insert(
                                        SmolStr::new_static("reportAction"),
                                        LexObjectProperty::Ref(LexRef {
                                            r#ref: CowStr::new_static("#reportAction"),
                                            ..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")
                                            ],
                                            ..Default::default()
                                        }),
                                    );
                                    map.insert(
                                        SmolStr::new_static("subjectBlobCids"),
                                        LexObjectProperty::Array(LexArray {
                                            items: LexArrayItem::String(LexString {
                                                format: Some(LexStringFormat::Cid),
                                                ..Default::default()
                                            }),
                                            ..Default::default()
                                        }),
                                    );
                                    map
                                },
                                ..Default::default()
                            }),
                        ),
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reportAction"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "Target specific reports when emitting a moderation event",
                        ),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("all"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ids"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static("Target specific report IDs"),
                                ),
                                items: LexArrayItem::Integer(LexInteger {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("note"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "Note to send to reporter(s) when actioning their report",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("types"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Target reports matching these report types on the subject (fully qualified NSIDs)",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}