one-msg-sdk 2.0.3

Official Rust SDK for the 1msg WhatsApp Business API
/*
 * 1MSG WhatsApp Business API (Public)
 *
 * Public client API for sending messages, managing groups, flows, and templates.  This is the API exposed to end customers via platform.1msg.io  **Authentication:** Pass the channel token in **one** place. The API checks JSON body (`token`), then query string (`?token=`), then `Authorization: Bearer` header (preferred in production).  **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/ 
 *
 * The version of the OpenAPI document: 2.0.0
 * Contact: support@1msg.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetWebhook200Response {
    #[serde(rename = "webhookUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub webhook_url: Option<Option<Box<models::GetWebhook200ResponseWebhookUrl>>>,
    /// `true` when at least one URL in `webhookUrl` is sticky auto-disabled. Not \"the channel is dead\": other configured URLs still receive events. Send/receive are unaffected. 
    #[serde(rename = "haveDisabledWebhooks", skip_serializing_if = "Option::is_none")]
    pub have_disabled_webhooks: Option<bool>,
    /// Compatibility scalar for **one** URL (first sticky-disabled, else first configured). Not the channel as a whole. Prefer `webhookStatuses[].circuitState`. 
    #[serde(rename = "circuitState", skip_serializing_if = "Option::is_none")]
    pub circuit_state: Option<CircuitState>,
    /// Last qualifying fail reason of the summary URL (same URL as `circuitState`)
    #[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
    /// Diagnostic only (summary URL). Qualifying failures in the rolling ~10 minute breaker window — not lifetime and not customer retries. Prefer `webhookStatuses` / `disabledWebhooks`. 
    #[serde(rename = "fails", skip_serializing_if = "Option::is_none")]
    pub fails: Option<i32>,
    /// Diagnostic only (summary URL). Failed recovery probes (≈15 min → 1 h → 6 h). Sticky disable after 3. Not a blind unblock timer. 
    #[serde(rename = "trips", skip_serializing_if = "Option::is_none")]
    pub trips: Option<i32>,
    /// Epoch milliseconds when the summary URL became sticky-disabled
    #[serde(rename = "disabledAt", skip_serializing_if = "Option::is_none")]
    pub disabled_at: Option<i32>,
    /// Diagnostic only (summary URL). Epoch ms of the first fail in the current ~10 minute window (pairs with `fails`). 
    #[serde(rename = "firstFailAt", skip_serializing_if = "Option::is_none")]
    pub first_fail_at: Option<i32>,
    /// Last HTTP status from the summary URL, when known
    #[serde(rename = "lastStatus", skip_serializing_if = "Option::is_none")]
    pub last_status: Option<i32>,
    /// Epoch milliseconds of the next half-open probe for the summary URL, if any
    #[serde(rename = "nextProbeAt", skip_serializing_if = "Option::is_none")]
    pub next_probe_at: Option<i32>,
    /// Currently configured URLs that are sticky auto-disabled (subset of `webhookUrl`). Does not include leftover URLs that are no longer configured. 
    #[serde(rename = "disabledWebhooks", skip_serializing_if = "Option::is_none")]
    pub disabled_webhooks: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
    /// One entry per currently configured URL. Prefer this over top-level `haveDisabledWebhooks` / `circuitState` when more than one webhook is set. 
    #[serde(rename = "webhookStatuses", skip_serializing_if = "Option::is_none")]
    pub webhook_statuses: Option<Vec<models::WebhookUrlStatus>>,
}

impl GetWebhook200Response {
    pub fn new() -> GetWebhook200Response {
        GetWebhook200Response {
            webhook_url: None,
            have_disabled_webhooks: None,
            circuit_state: None,
            reason: None,
            fails: None,
            trips: None,
            disabled_at: None,
            first_fail_at: None,
            last_status: None,
            next_probe_at: None,
            disabled_webhooks: None,
            webhook_statuses: None,
        }
    }
}
/// Compatibility scalar for **one** URL (first sticky-disabled, else first configured). Not the channel as a whole. Prefer `webhookStatuses[].circuitState`. 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CircuitState {
    #[serde(rename = "ok")]
    Ok,
    #[serde(rename = "degraded")]
    Degraded,
    #[serde(rename = "open")]
    Open,
    #[serde(rename = "half_open")]
    HalfOpen,
    #[serde(rename = "disabled")]
    Disabled,
}

impl Default for CircuitState {
    fn default() -> CircuitState {
        Self::Ok
    }
}