/// Request to send a test webhook
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct TestWebhookRequest {
    #[serde(rename = "integrationRid")]
    integration_rid: super::super::super::super::integrations::api::IntegrationRid,
    #[builder(into)]
    #[serde(rename = "template")]
    template: String,
    #[builder(
        default,
        map(
            key(type = String, into),
            value(
                custom(
                    type = impl
                    conjure_object::serde::Serialize,
                    convert = |v|conjure_object::Any::new(
                        v
                    ).expect("value failed to serialize")
                )
            )
        )
    )]
    #[serde(
        rename = "sampleContext",
        skip_serializing_if = "std::collections::BTreeMap::is_empty",
        default
    )]
    sample_context: std::collections::BTreeMap<String, conjure_object::Any>,
    #[builder(default, into)]
    #[serde(rename = "eventType", skip_serializing_if = "Option::is_none", default)]
    event_type: Option<String>,
}
impl TestWebhookRequest {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        integration_rid: super::super::super::super::integrations::api::IntegrationRid,
        template: impl Into<String>,
    ) -> Self {
        Self::builder().integration_rid(integration_rid).template(template).build()
    }
    /// RID of the SimpleWebhookIntegration to use
    #[inline]
    pub fn integration_rid(
        &self,
    ) -> &super::super::super::super::integrations::api::IntegrationRid {
        &self.integration_rid
    }
    /// Handlebars template for webhook payload
    #[inline]
    pub fn template(&self) -> &str {
        &*self.template
    }
    /// Sample variable values for template evaluation
    #[inline]
    pub fn sample_context(
        &self,
    ) -> &std::collections::BTreeMap<String, conjure_object::Any> {
        &self.sample_context
    }
    /// Event type header value (default: test.webhook)
    #[inline]
    pub fn event_type(&self) -> Option<&str> {
        self.event_type.as_ref().map(|o| &**o)
    }
}
