/*
 * 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 SendInboxMessageRequestButtonsInner {
    /// Button type. phone is Facebook only.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Button label (max 20 chars)
    #[serde(rename = "title")]
    pub title: String,
    /// URL for url-type buttons
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// Payload for postback-type buttons
    #[serde(rename = "payload", skip_serializing_if = "Option::is_none")]
    pub payload: Option<String>,
    /// Phone number for phone-type buttons (Facebook only)
    #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
    pub phone: Option<String>,
}

impl SendInboxMessageRequestButtonsInner {
    pub fn new(r#type: Type, title: String) -> SendInboxMessageRequestButtonsInner {
        SendInboxMessageRequestButtonsInner {
            r#type,
            title,
            url: None,
            payload: None,
            phone: None,
        }
    }
}
/// Button type. phone is Facebook only.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "url")]
    Url,
    #[serde(rename = "postback")]
    Postback,
    #[serde(rename = "phone")]
    Phone,
}

impl Default for Type {
    fn default() -> Type {
        Self::Url
    }
}
