/// Result of test webhook delivery
#[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 TestWebhookResponse {
    #[serde(rename = "success")]
    success: bool,
    #[serde(rename = "statusCode")]
    status_code: i32,
    #[builder(default, into)]
    #[serde(rename = "responseBody", skip_serializing_if = "Option::is_none", default)]
    response_body: Option<String>,
    #[builder(default, into)]
    #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none", default)]
    error_message: Option<String>,
    #[builder(default, into)]
    #[serde(
        rename = "evaluatedPayload",
        skip_serializing_if = "Option::is_none",
        default
    )]
    evaluated_payload: Option<String>,
    #[serde(rename = "latencyMillis")]
    latency_millis: conjure_object::SafeLong,
}
impl TestWebhookResponse {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(
        success: bool,
        status_code: i32,
        latency_millis: conjure_object::SafeLong,
    ) -> Self {
        Self::builder()
            .success(success)
            .status_code(status_code)
            .latency_millis(latency_millis)
            .build()
    }
    /// Whether the webhook was delivered successfully
    #[inline]
    pub fn success(&self) -> bool {
        self.success
    }
    /// HTTP status code from the webhook endpoint, or 0 if delivery failed before any HTTP request was sent (for example due to template errors, invalid JSON, or URL validation failures).
    #[inline]
    pub fn status_code(&self) -> i32 {
        self.status_code
    }
    /// Response body from webhook endpoint
    #[inline]
    pub fn response_body(&self) -> Option<&str> {
        self.response_body.as_ref().map(|o| &**o)
    }
    /// Error message if delivery failed
    #[inline]
    pub fn error_message(&self) -> Option<&str> {
        self.error_message.as_ref().map(|o| &**o)
    }
    /// The actual JSON payload that was sent
    #[inline]
    pub fn evaluated_payload(&self) -> Option<&str> {
        self.evaluated_payload.as_ref().map(|o| &**o)
    }
    /// Time taken to deliver webhook in milliseconds
    #[inline]
    pub fn latency_millis(&self) -> conjure_object::SafeLong {
        self.latency_millis
    }
}
