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

pub mod create_webhook;
pub mod delete_webhook;
pub mod get_server_time;
pub mod get_webhook;
pub mod list_webhooks;
pub mod settings;
pub mod update_webhook;


#[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::{Datetime, UriValue};
use jacquard_derive::{IntoStatic, lexicon};
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::place_stream::server;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct RewriteRule<'a> {
    ///Text to search for and replace.
    #[serde(borrow)]
    pub from: CowStr<'a>,
    ///Text to replace with.
    #[serde(borrow)]
    pub to: CowStr<'a>,
}

/// A webhook configuration for receiving Streamplace events.

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Webhook<'a> {
    ///Whether this webhook is currently active.
    pub active: bool,
    ///When this webhook was created.
    pub created_at: Datetime,
    ///A description of what this webhook is used for.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub description: Option<CowStr<'a>>,
    ///Number of consecutive errors for this webhook.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_count: Option<i64>,
    ///The types of events this webhook should receive.
    #[serde(borrow)]
    pub events: Vec<CowStr<'a>>,
    ///Unique identifier for this webhook.
    #[serde(borrow)]
    pub id: CowStr<'a>,
    ///When this webhook was last triggered.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_triggered: Option<Datetime>,
    ///Words to filter out from chat messages. Messages containing any of these words will not be forwarded.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub mute_words: Option<Vec<CowStr<'a>>>,
    ///A user-friendly name for this webhook.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub name: Option<CowStr<'a>>,
    ///Text to prepend to webhook messages.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub prefix: Option<CowStr<'a>>,
    ///Text replacement rules for webhook messages.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub rewrite: Option<Vec<server::RewriteRule<'a>>>,
    ///Text to append to webhook messages.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub suffix: Option<CowStr<'a>>,
    ///When this webhook was last updated.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<Datetime>,
    ///The webhook URL where events will be sent.
    #[serde(borrow)]
    pub url: UriValue<'a>,
}

impl<'a> LexiconSchema for RewriteRule<'a> {
    fn nsid() -> &'static str {
        "place.stream.server.defs"
    }
    fn def_name() -> &'static str {
        "rewriteRule"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_place_stream_server_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.from;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("from"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.from;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 1usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("from"),
                    min: 1usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.to;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("to"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for Webhook<'a> {
    fn nsid() -> &'static str {
        "place.stream.server.defs"
    }
    fn def_name() -> &'static str {
        "webhook"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_place_stream_server_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        if let Some(ref value) = self.description {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("description"),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.name {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("name"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.prefix {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("prefix"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.suffix {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 100usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("suffix"),
                    max: 100usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

fn lexicon_doc_place_stream_server_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("place.stream.server.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("rewriteRule"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("from"), SmolStr::new_static("to")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("from"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Text to search for and replace."),
                                ),
                                min_length: Some(1usize),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("to"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Text to replace with."),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("webhook"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static(
                            "A webhook configuration for receiving Streamplace events.",
                        ),
                    ),
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("url"),
                            SmolStr::new_static("events"), SmolStr::new_static("active"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    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("createdAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("When this webhook was created."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "A description of what this webhook is used for.",
                                    ),
                                ),
                                max_length: Some(500usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("errorCount"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("events"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "The types of events this webhook should receive.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Unique identifier for this webhook."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lastTriggered"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("When this webhook was last triggered."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("muteWords"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Words to filter out from chat messages. Messages containing any of these words will not be forwarded.",
                                    ),
                                ),
                                items: LexArrayItem::String(LexString {
                                    max_length: Some(100usize),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("A user-friendly name for this webhook."),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("prefix"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Text to prepend to webhook messages."),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("rewrite"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Text replacement rules for webhook messages.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#rewriteRule"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("suffix"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Text to append to webhook messages."),
                                ),
                                max_length: Some(100usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("updatedAt"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("When this webhook was last updated."),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("url"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The webhook URL where events will be sent.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Uri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod webhook_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 Events;
        type CreatedAt;
        type Active;
        type Url;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type Events = Unset;
        type CreatedAt = Unset;
        type Active = Unset;
        type Url = 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 Events = S::Events;
        type CreatedAt = S::CreatedAt;
        type Active = S::Active;
        type Url = S::Url;
    }
    ///State transition - sets the `events` field to Set
    pub struct SetEvents<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetEvents<S> {}
    impl<S: State> State for SetEvents<S> {
        type Id = S::Id;
        type Events = Set<members::events>;
        type CreatedAt = S::CreatedAt;
        type Active = S::Active;
        type Url = S::Url;
    }
    ///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 Events = S::Events;
        type CreatedAt = Set<members::created_at>;
        type Active = S::Active;
        type Url = S::Url;
    }
    ///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 Id = S::Id;
        type Events = S::Events;
        type CreatedAt = S::CreatedAt;
        type Active = Set<members::active>;
        type Url = S::Url;
    }
    ///State transition - sets the `url` field to Set
    pub struct SetUrl<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUrl<S> {}
    impl<S: State> State for SetUrl<S> {
        type Id = S::Id;
        type Events = S::Events;
        type CreatedAt = S::CreatedAt;
        type Active = S::Active;
        type Url = Set<members::url>;
    }
    /// 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 `events` field
        pub struct events(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `active` field
        pub struct active(());
        ///Marker type for the `url` field
        pub struct url(());
    }
}

/// Builder for constructing an instance of this type
pub struct WebhookBuilder<'a, S: webhook_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<bool>,
        Option<Datetime>,
        Option<CowStr<'a>>,
        Option<i64>,
        Option<Vec<CowStr<'a>>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<Vec<CowStr<'a>>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
        Option<Vec<server::RewriteRule<'a>>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<UriValue<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Webhook<'a> {
    /// Create a new builder for this type
    pub fn new() -> WebhookBuilder<'a, webhook_state::Empty> {
        WebhookBuilder::new()
    }
}

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

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

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

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

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `errorCount` field (optional)
    pub fn error_count(mut self, value: impl Into<Option<i64>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `errorCount` field to an Option value (optional)
    pub fn maybe_error_count(mut self, value: Option<i64>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S> WebhookBuilder<'a, S>
where
    S: webhook_state::State,
    S::Events: webhook_state::IsUnset,
{
    /// Set the `events` field (required)
    pub fn events(
        mut self,
        value: impl Into<Vec<CowStr<'a>>>,
    ) -> WebhookBuilder<'a, webhook_state::SetEvents<S>> {
        self._fields.4 = Option::Some(value.into());
        WebhookBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `lastTriggered` field (optional)
    pub fn last_triggered(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `lastTriggered` field to an Option value (optional)
    pub fn maybe_last_triggered(mut self, value: Option<Datetime>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `muteWords` field (optional)
    pub fn mute_words(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `muteWords` field to an Option value (optional)
    pub fn maybe_mute_words(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
        self._fields.7 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `name` field (optional)
    pub fn name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.8 = value.into();
        self
    }
    /// Set the `name` field to an Option value (optional)
    pub fn maybe_name(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.8 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `prefix` field (optional)
    pub fn prefix(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.9 = value.into();
        self
    }
    /// Set the `prefix` field to an Option value (optional)
    pub fn maybe_prefix(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.9 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `rewrite` field (optional)
    pub fn rewrite(
        mut self,
        value: impl Into<Option<Vec<server::RewriteRule<'a>>>>,
    ) -> Self {
        self._fields.10 = value.into();
        self
    }
    /// Set the `rewrite` field to an Option value (optional)
    pub fn maybe_rewrite(mut self, value: Option<Vec<server::RewriteRule<'a>>>) -> Self {
        self._fields.10 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `suffix` field (optional)
    pub fn suffix(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.11 = value.into();
        self
    }
    /// Set the `suffix` field to an Option value (optional)
    pub fn maybe_suffix(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.11 = value;
        self
    }
}

impl<'a, S: webhook_state::State> WebhookBuilder<'a, S> {
    /// Set the `updatedAt` field (optional)
    pub fn updated_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
        self._fields.12 = 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.12 = value;
        self
    }
}

impl<'a, S> WebhookBuilder<'a, S>
where
    S: webhook_state::State,
    S::Url: webhook_state::IsUnset,
{
    /// Set the `url` field (required)
    pub fn url(
        mut self,
        value: impl Into<UriValue<'a>>,
    ) -> WebhookBuilder<'a, webhook_state::SetUrl<S>> {
        self._fields.13 = Option::Some(value.into());
        WebhookBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> WebhookBuilder<'a, S>
where
    S: webhook_state::State,
    S::Id: webhook_state::IsSet,
    S::Events: webhook_state::IsSet,
    S::CreatedAt: webhook_state::IsSet,
    S::Active: webhook_state::IsSet,
    S::Url: webhook_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Webhook<'a> {
        Webhook {
            active: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            description: self._fields.2,
            error_count: self._fields.3,
            events: self._fields.4.unwrap(),
            id: self._fields.5.unwrap(),
            last_triggered: self._fields.6,
            mute_words: self._fields.7,
            name: self._fields.8,
            prefix: self._fields.9,
            rewrite: self._fields.10,
            suffix: self._fields.11,
            updated_at: self._fields.12,
            url: self._fields.13.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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Webhook<'a> {
        Webhook {
            active: self._fields.0.unwrap(),
            created_at: self._fields.1.unwrap(),
            description: self._fields.2,
            error_count: self._fields.3,
            events: self._fields.4.unwrap(),
            id: self._fields.5.unwrap(),
            last_triggered: self._fields.6,
            mute_words: self._fields.7,
            name: self._fields.8,
            prefix: self._fields.9,
            rewrite: self._fields.10,
            suffix: self._fields.11,
            updated_at: self._fields.12,
            url: self._fields.13.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}