/*
 * 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 SendWhatsAppFlowMessageRequest {
    /// WhatsApp social account ID
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Recipient phone number (E.164 format, e.g. +1234567890)
    #[serde(rename = "to")]
    pub to: String,
    /// Published flow ID
    #[serde(rename = "flow_id")]
    pub flow_id: String,
    /// CTA button text (e.g. 'Book Now', 'Sign Up')
    #[serde(rename = "flow_cta")]
    pub flow_cta: String,
    /// Action type: navigate opens a screen directly, data_exchange hits your endpoint first
    #[serde(rename = "flow_action", skip_serializing_if = "Option::is_none")]
    pub flow_action: Option<FlowAction>,
    /// Unique token to correlate responses. If omitted, auto-generated as '<flowId>:<uuid>' so the response can be attributed to this flow in the Flow Responses view.
    #[serde(rename = "flow_token", skip_serializing_if = "Option::is_none")]
    pub flow_token: Option<String>,
    #[serde(
        rename = "flow_action_payload",
        skip_serializing_if = "Option::is_none"
    )]
    pub flow_action_payload: Option<Box<models::SendWhatsAppFlowMessageRequestFlowActionPayload>>,
    /// Message body text
    #[serde(rename = "body")]
    pub body: String,
    #[serde(rename = "header", skip_serializing_if = "Option::is_none")]
    pub header: Option<Box<models::SendWhatsAppFlowMessageRequestHeader>>,
    /// Optional footer text
    #[serde(rename = "footer", skip_serializing_if = "Option::is_none")]
    pub footer: Option<String>,
    /// Set true to test an unpublished (DRAFT) flow
    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
    pub draft: Option<bool>,
}

impl SendWhatsAppFlowMessageRequest {
    pub fn new(
        account_id: String,
        to: String,
        flow_id: String,
        flow_cta: String,
        body: String,
    ) -> SendWhatsAppFlowMessageRequest {
        SendWhatsAppFlowMessageRequest {
            account_id,
            to,
            flow_id,
            flow_cta,
            flow_action: None,
            flow_token: None,
            flow_action_payload: None,
            body,
            header: None,
            footer: None,
            draft: None,
        }
    }
}
/// Action type: navigate opens a screen directly, data_exchange hits your endpoint first
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum FlowAction {
    #[serde(rename = "navigate")]
    Navigate,
    #[serde(rename = "data_exchange")]
    DataExchange,
}

impl Default for FlowAction {
    fn default() -> FlowAction {
        Self::Navigate
    }
}
