// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: tools.ozone.moderation.cancelScheduledActions
//
// 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;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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::tools_ozone::moderation::cancel_scheduled_actions;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CancellationResults<S: BosStr = DefaultStr> {
    ///DIDs for which cancellation failed with error details
    pub failed: Vec<cancel_scheduled_actions::FailedCancellation<S>>,
    ///DIDs for which all pending scheduled actions were successfully cancelled
    pub succeeded: Vec<Did<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct CancelScheduledActions<S: BosStr = DefaultStr> {
    ///Optional comment describing the reason for cancellation
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<S>,
    ///Array of DID subjects to cancel scheduled actions for
    pub subjects: Vec<Did<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


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

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

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

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

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

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

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

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

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

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

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

impl<S: BosStr> CancellationResults<S> {
    /// Create a new builder for this type
    pub fn builder() -> CancellationResultsBuilder<
        cancellation_results_state::Empty,
        S,
    > {
        CancellationResultsBuilder::builder()
    }
}

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

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

impl<St, S: BosStr> CancellationResultsBuilder<St, S>
where
    St: cancellation_results_state::State,
    St::Failed: cancellation_results_state::IsUnset,
{
    /// Set the `failed` field (required)
    pub fn failed(
        mut self,
        value: impl Into<Vec<cancel_scheduled_actions::FailedCancellation<S>>>,
    ) -> CancellationResultsBuilder<cancellation_results_state::SetFailed<St>, S> {
        self._fields.0 = Option::Some(value.into());
        CancellationResultsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> CancellationResultsBuilder<St, S>
where
    St: cancellation_results_state::State,
    St::Failed: cancellation_results_state::IsSet,
    St::Succeeded: cancellation_results_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> CancellationResults<S> {
        CancellationResults {
            failed: self._fields.0.unwrap(),
            succeeded: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> CancellationResults<S> {
        CancellationResults {
            failed: self._fields.0.unwrap(),
            succeeded: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_tools_ozone_moderation_cancelScheduledActions() -> 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.cancelScheduledActions"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("cancellationResults"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("succeeded"),
                            SmolStr::new_static("failed")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("failed"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "DIDs for which cancellation failed with error details",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#failedCancellation"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("succeeded"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "DIDs for which all pending scheduled actions were successfully cancelled",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::Did),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("failedCancellation"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("did"), SmolStr::new_static("error")],
                    ),
                    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.insert(
                            SmolStr::new_static("error"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("errorCode"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            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("subjects")]),
                                properties: {
                                    #[allow(unused_mut)]
                                    let mut map = BTreeMap::new();
                                    map.insert(
                                        SmolStr::new_static("comment"),
                                        LexObjectProperty::String(LexString {
                                            description: Some(
                                                CowStr::new_static(
                                                    "Optional comment describing the reason for cancellation",
                                                ),
                                            ),
                                            ..Default::default()
                                        }),
                                    );
                                    map.insert(
                                        SmolStr::new_static("subjects"),
                                        LexObjectProperty::Array(LexArray {
                                            description: Some(
                                                CowStr::new_static(
                                                    "Array of DID subjects to cancel scheduled actions for",
                                                ),
                                            ),
                                            items: LexArrayItem::String(LexString {
                                                format: Some(LexStringFormat::Did),
                                                ..Default::default()
                                            }),
                                            max_length: Some(100usize),
                                            ..Default::default()
                                        }),
                                    );
                                    map
                                },
                                ..Default::default()
                            }),
                        ),
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

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

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

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

impl<S: BosStr> FailedCancellation<S> {
    /// Create a new builder for this type
    pub fn builder() -> FailedCancellationBuilder<failed_cancellation_state::Empty, S> {
        FailedCancellationBuilder::builder()
    }
}

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

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

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

impl<St, S: BosStr> FailedCancellationBuilder<St, S>
where
    St: failed_cancellation_state::State,
    St::Error: failed_cancellation_state::IsUnset,
{
    /// Set the `error` field (required)
    pub fn error(
        mut self,
        value: impl Into<S>,
    ) -> FailedCancellationBuilder<failed_cancellation_state::SetError<St>, S> {
        self._fields.1 = Option::Some(value.into());
        FailedCancellationBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

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

impl<St, S: BosStr> FailedCancellationBuilder<St, S>
where
    St: failed_cancellation_state::State,
    St::Did: failed_cancellation_state::IsSet,
    St::Error: failed_cancellation_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> FailedCancellation<S> {
        FailedCancellation {
            did: self._fields.0.unwrap(),
            error: self._fields.1.unwrap(),
            error_code: self._fields.2,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> FailedCancellation<S> {
        FailedCancellation {
            did: self._fields.0.unwrap(),
            error: self._fields.1.unwrap(),
            error_code: self._fields.2,
            extra_data: Some(extra_data),
        }
    }
}

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

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

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

impl<S: BosStr> CancelScheduledActions<S> {
    /// Create a new builder for this type
    pub fn builder() -> CancelScheduledActionsBuilder<
        cancel_scheduled_actions_state::Empty,
        S,
    > {
        CancelScheduledActionsBuilder::builder()
    }
}

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

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

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

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

impl<St, S: BosStr> CancelScheduledActionsBuilder<St, S>
where
    St: cancel_scheduled_actions_state::State,
    St::Subjects: cancel_scheduled_actions_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> CancelScheduledActions<S> {
        CancelScheduledActions {
            comment: self._fields.0,
            subjects: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data.
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<SmolStr, Data<S>>,
    ) -> CancelScheduledActions<S> {
        CancelScheduledActions {
            comment: self._fields.0,
            subjects: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}