/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.1
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

/// WebhookPayloadWhatsAppTemplateStatusUpdated : Webhook payload for the `whatsapp.template.status_updated` event. Fired when Meta completes (re)review of a template attached to a connected WABA. Maps Meta's `message_template_status_update` field onto our event envelope.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadWhatsAppTemplateStatusUpdated {
    /// Stable webhook event ID
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "event")]
    pub event: Event,
    #[serde(rename = "account")]
    pub account: Box<models::WebhookPayloadWhatsAppTemplateStatusUpdatedAccount>,
    #[serde(rename = "template")]
    pub template: Box<models::WebhookPayloadWhatsAppTemplateStatusUpdatedTemplate>,
    /// ISO-8601 timestamp the webhook was produced.
    #[serde(rename = "timestamp")]
    pub timestamp: String,
}

impl WebhookPayloadWhatsAppTemplateStatusUpdated {
    /// Webhook payload for the `whatsapp.template.status_updated` event. Fired when Meta completes (re)review of a template attached to a connected WABA. Maps Meta's `message_template_status_update` field onto our event envelope.
    pub fn new(
        id: String,
        event: Event,
        account: models::WebhookPayloadWhatsAppTemplateStatusUpdatedAccount,
        template: models::WebhookPayloadWhatsAppTemplateStatusUpdatedTemplate,
        timestamp: String,
    ) -> WebhookPayloadWhatsAppTemplateStatusUpdated {
        WebhookPayloadWhatsAppTemplateStatusUpdated {
            id,
            event,
            account: Box::new(account),
            template: Box::new(template),
            timestamp,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Event {
    #[serde(rename = "whatsapp.template.status_updated")]
    WhatsappTemplateStatusUpdated,
}

impl Default for Event {
    fn default() -> Event {
        Self::WhatsappTemplateStatusUpdated
    }
}
