/*
 * 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.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WhatsAppTemplateButton {
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Visible button label. Required for all types except copy_code (whose label is fixed by WhatsApp).
    #[serde(rename = "text", skip_serializing_if = "Option::is_none")]
    pub text: Option<String>,
    /// Required when type is URL
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    #[serde(
        rename = "example",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub example: Option<Option<serde_json::Value>>,
    /// Required when type is phone_number
    #[serde(rename = "phone_number", skip_serializing_if = "Option::is_none")]
    pub phone_number: Option<String>,
    /// Required when type is otp
    #[serde(rename = "otp_type", skip_serializing_if = "Option::is_none")]
    pub otp_type: Option<OtpType>,
    #[serde(rename = "autofill_text", skip_serializing_if = "Option::is_none")]
    pub autofill_text: Option<String>,
    #[serde(rename = "package_name", skip_serializing_if = "Option::is_none")]
    pub package_name: Option<String>,
    #[serde(rename = "signature_hash", skip_serializing_if = "Option::is_none")]
    pub signature_hash: Option<String>,
    #[serde(rename = "flow_id", skip_serializing_if = "Option::is_none")]
    pub flow_id: Option<String>,
    #[serde(rename = "flow_name", skip_serializing_if = "Option::is_none")]
    pub flow_name: Option<String>,
    #[serde(rename = "flow_json", skip_serializing_if = "Option::is_none")]
    pub flow_json: Option<String>,
    #[serde(rename = "flow_action", skip_serializing_if = "Option::is_none")]
    pub flow_action: Option<String>,
    #[serde(rename = "navigate_screen", skip_serializing_if = "Option::is_none")]
    pub navigate_screen: Option<String>,
}

impl WhatsAppTemplateButton {
    pub fn new(r#type: Type) -> WhatsAppTemplateButton {
        WhatsAppTemplateButton {
            r#type,
            text: None,
            url: None,
            example: None,
            phone_number: None,
            otp_type: None,
            autofill_text: None,
            package_name: None,
            signature_hash: None,
            flow_id: None,
            flow_name: None,
            flow_json: None,
            flow_action: None,
            navigate_screen: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "quick_reply")]
    QuickReply,
    #[serde(rename = "url")]
    Url,
    #[serde(rename = "phone_number")]
    PhoneNumber,
    #[serde(rename = "otp")]
    Otp,
    #[serde(rename = "copy_code")]
    CopyCode,
    #[serde(rename = "flow")]
    Flow,
    #[serde(rename = "mpm")]
    Mpm,
    #[serde(rename = "catalog")]
    Catalog,
}

impl Default for Type {
    fn default() -> Type {
        Self::QuickReply
    }
}
/// Required when type is otp
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OtpType {
    #[serde(rename = "copy_code")]
    CopyCode,
    #[serde(rename = "one_tap")]
    OneTap,
    #[serde(rename = "zero_tap")]
    ZeroTap,
}

impl Default for OtpType {
    fn default() -> OtpType {
        Self::CopyCode
    }
}
