zernio 0.0.132

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateWhatsAppTemplateRequest {
    /// WhatsApp social account ID
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Template name (lowercase, letters/numbers/underscores, must start with a letter)
    #[serde(rename = "name")]
    pub name: String,
    /// Template category
    #[serde(rename = "category")]
    pub category: Category,
    /// Template language code (e.g., en_US)
    #[serde(rename = "language")]
    pub language: String,
    /// Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name.
    #[serde(rename = "components", skip_serializing_if = "Option::is_none")]
    pub components: Option<Vec<models::WhatsAppTemplateComponent>>,
    /// Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\", \"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved by Meta with no review wait. Omit `components` when using this field.
    #[serde(
        rename = "library_template_name",
        skip_serializing_if = "Option::is_none"
    )]
    pub library_template_name: Option<String>,
    /// Optional body customizations for library templates. Available options depend on the template (e.g., add_contact_number, add_learn_more_link, add_security_recommendation, add_track_package_link, code_expiration_minutes).
    #[serde(
        rename = "library_template_body_inputs",
        skip_serializing_if = "Option::is_none"
    )]
    pub library_template_body_inputs: Option<serde_json::Value>,
    /// Optional button customizations for library templates. Each item specifies button type and configuration (e.g., URL, phone number, quick reply).
    #[serde(
        rename = "library_template_button_inputs",
        skip_serializing_if = "Option::is_none"
    )]
    pub library_template_button_inputs:
        Option<Vec<models::CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner>>,
}

impl CreateWhatsAppTemplateRequest {
    pub fn new(
        account_id: String,
        name: String,
        category: Category,
        language: String,
    ) -> CreateWhatsAppTemplateRequest {
        CreateWhatsAppTemplateRequest {
            account_id,
            name,
            category,
            language,
            components: None,
            library_template_name: None,
            library_template_body_inputs: None,
            library_template_button_inputs: None,
        }
    }
}
/// Template category
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "AUTHENTICATION")]
    Authentication,
    #[serde(rename = "MARKETING")]
    Marketing,
    #[serde(rename = "UTILITY")]
    Utility,
}

impl Default for Category {
    fn default() -> Category {
        Self::Authentication
    }
}