late 0.0.1055

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.104.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

/// WebhookPayloadMessageMetadata : Platform-specific message context (present when the message is a quick reply tap, postback button tap, inline keyboard callback, a quote-reply to an earlier message, a WhatsApp inbound that Meta Business Agent is answering, or a TikTok DM that is not plain text)
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadMessageMetadata {
    /// WhatsApp only. true when this inbound arrived while Meta Business Agent held the conversation: the agent answers it, and Zernio only observes. Sending a reply takes control back. See conversation.control_changed.
    #[serde(rename = "standby", skip_serializing_if = "Option::is_none")]
    pub standby: Option<bool>,
    /// Raw platform envelope id (WhatsApp `context.id`; Instagram and Facebook Messenger `reply_to.mid`) of the message this one is a quote-reply to, forwarded verbatim. It may not equal the stored id of that message (see `quotedMessage.platformMessageId`). On outgoing messages the same field appears on `message.sent`, but only on some surfaces: see WebhookPayloadMessageSent.metadata.quotedMessageId.
    #[serde(rename = "quotedMessageId", skip_serializing_if = "Option::is_none")]
    pub quoted_message_id: Option<String>,
    #[serde(rename = "quotedMessage", skip_serializing_if = "Option::is_none")]
    pub quoted_message: Option<Box<models::WebhookPayloadMessageMetadataQuotedMessage>>,
    /// Payload from a quick reply tap (Facebook/Instagram Messenger).
    #[serde(rename = "quickReplyPayload", skip_serializing_if = "Option::is_none")]
    pub quick_reply_payload: Option<String>,
    /// Payload from a postback button tap (Facebook/Instagram Messenger).
    #[serde(rename = "postbackPayload", skip_serializing_if = "Option::is_none")]
    pub postback_payload: Option<String>,
    /// Title of the tapped postback button (Facebook/Instagram Messenger).
    #[serde(rename = "postbackTitle", skip_serializing_if = "Option::is_none")]
    pub postback_title: Option<String>,
    /// Callback data from an inline keyboard button tap (Telegram).
    #[serde(rename = "callbackData", skip_serializing_if = "Option::is_none")]
    pub callback_data: Option<String>,
    /// WhatsApp only. Which kind of interactive reply the user sent: `button_reply` (tap on an interactive button), `list_reply` (tap on a list row), or `nfm_reply` (a WhatsApp Flow submission or an `address_message` submission, see `nfmReplyName`).
    #[serde(rename = "interactiveType", skip_serializing_if = "Option::is_none")]
    pub interactive_type: Option<InteractiveType>,
    /// WhatsApp only. The `id` of the tapped button or list row, matching the `id` you supplied when the message was sent. Not set for Flow responses.
    #[serde(rename = "interactiveId", skip_serializing_if = "Option::is_none")]
    pub interactive_id: Option<String>,
    /// WhatsApp only. Payload attached to a tapped template button. Template buttons emit a plain `button` webhook (not an interactive reply), so `interactiveType` is empty while this field is populated.
    #[serde(rename = "buttonPayload", skip_serializing_if = "Option::is_none")]
    pub button_payload: Option<String>,
    /// WhatsApp only. Raw `nfm_reply.response_json` string returned by a Flow submission. Useful if you need the exact wire payload; for typed access use `flowResponseData` instead.
    #[serde(rename = "flowResponseJson", skip_serializing_if = "Option::is_none")]
    pub flow_response_json: Option<String>,
    /// WhatsApp only. Parsed Flow response JSON. Populated when `flowResponseJson` is valid JSON; otherwise omitted. Keys and value types depend on the specific Flow that was submitted. An `address_message` submission (`nfmReplyName: address_message`) carries the address fields (`name`, `address`, `city`, `state`, `in_pin_code`, ...), either at the top level or nested under `values`; read both.
    #[serde(rename = "flowResponseData", skip_serializing_if = "Option::is_none")]
    pub flow_response_data: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// WhatsApp only. `nfm_reply.name` as Meta sent it, e.g. `flow` or `address_message`. Address submissions share the `nfm_reply` envelope with Flow submissions and are otherwise indistinguishable in `flowResponseData`; use this field to tell them apart.
    #[serde(rename = "nfmReplyName", skip_serializing_if = "Option::is_none")]
    pub nfm_reply_name: Option<String>,
    #[serde(rename = "order", skip_serializing_if = "Option::is_none")]
    pub order: Option<Box<models::WebhookPayloadMessageMetadataOrder>>,
    #[serde(rename = "referredProduct", skip_serializing_if = "Option::is_none")]
    pub referred_product: Option<Box<models::WebhookPayloadMessageMetadataReferredProduct>>,
    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
    pub location: Option<Box<models::WebhookPayloadMessageMetadataLocation>>,
    /// WhatsApp only. Contact cards the user shared, forwarded verbatim from Meta. Read `contactsOrigin` before treating any number here as the sender's own.
    #[serde(rename = "contacts", skip_serializing_if = "Option::is_none")]
    pub contacts: Option<Vec<std::collections::HashMap<String, serde_json::Value>>>,
    /// WhatsApp only. How the contact card was shared. `contact_request` means the user tapped a `request_contact_info` button, so the number is their own and consented. `other` means they picked a card from their address book: it may be anyone's, and must NOT be stored as the sender's identity. Omitted when Meta sends no origin.
    #[serde(rename = "contactsOrigin", skip_serializing_if = "Option::is_none")]
    pub contacts_origin: Option<ContactsOrigin>,
    #[serde(rename = "storyReply", skip_serializing_if = "Option::is_none")]
    pub story_reply: Option<Box<models::WebhookPayloadMessageMetadataStoryReply>>,
    /// Instagram only. True when the message was generated by an IG user mentioning the account in their own story (`story_mention` attachment type). Mutually exclusive in practice with `storyReply`.
    #[serde(rename = "isStoryMention", skip_serializing_if = "Option::is_none")]
    pub is_story_mention: Option<bool>,
    #[serde(rename = "referral", skip_serializing_if = "Option::is_none")]
    pub referral: Option<Box<models::WebhookPayloadMessageMetadataReferral>>,
    #[serde(rename = "unsupported", skip_serializing_if = "Option::is_none")]
    pub unsupported: Option<Box<models::WebhookPayloadMessageMetadataUnsupported>>,
    /// Instagram / Facebook Messenger only. Set when the message carries nothing an integrator can render (a `template` attachment with no text and no parseable content, or Meta's own `is_unsupported` flag). Sibling of `unsupported` above (WhatsApp only, carries Meta's error code/title/details): this field has no error envelope, only the boolean. Absence means \"not flagged\", never \"checked and renderable\".
    #[serde(
        rename = "noRenderableContent",
        skip_serializing_if = "Option::is_none"
    )]
    pub no_renderable_content: Option<bool>,
    /// TikTok only. The message type as TikTok reports it, forwarded verbatim (for example image, video, sticker, share_post, emoji, reaction, template). Present on every TikTok DM that is not plain text; those arrive with text empty and, for image, video, share_post, sticker and emoji, an attachment (share_post as type share with the embed url and payload.videoId; sticker/emoji as type sticker, url signed and expiring).
    #[serde(rename = "tiktokMessageType", skip_serializing_if = "Option::is_none")]
    pub tiktok_message_type: Option<String>,
}

impl WebhookPayloadMessageMetadata {
    /// Platform-specific message context (present when the message is a quick reply tap, postback button tap, inline keyboard callback, a quote-reply to an earlier message, a WhatsApp inbound that Meta Business Agent is answering, or a TikTok DM that is not plain text)
    pub fn new() -> WebhookPayloadMessageMetadata {
        WebhookPayloadMessageMetadata {
            standby: None,
            quoted_message_id: None,
            quoted_message: None,
            quick_reply_payload: None,
            postback_payload: None,
            postback_title: None,
            callback_data: None,
            interactive_type: None,
            interactive_id: None,
            button_payload: None,
            flow_response_json: None,
            flow_response_data: None,
            nfm_reply_name: None,
            order: None,
            referred_product: None,
            location: None,
            contacts: None,
            contacts_origin: None,
            story_reply: None,
            is_story_mention: None,
            referral: None,
            unsupported: None,
            no_renderable_content: None,
            tiktok_message_type: None,
        }
    }
}
/// WhatsApp only. Which kind of interactive reply the user sent: `button_reply` (tap on an interactive button), `list_reply` (tap on a list row), or `nfm_reply` (a WhatsApp Flow submission or an `address_message` submission, see `nfmReplyName`).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum InteractiveType {
    #[serde(rename = "button_reply")]
    ButtonReply,
    #[serde(rename = "list_reply")]
    ListReply,
    #[serde(rename = "nfm_reply")]
    NfmReply,
}

impl Default for InteractiveType {
    fn default() -> InteractiveType {
        Self::ButtonReply
    }
}
/// WhatsApp only. How the contact card was shared. `contact_request` means the user tapped a `request_contact_info` button, so the number is their own and consented. `other` means they picked a card from their address book: it may be anyone's, and must NOT be stored as the sender's identity. Omitted when Meta sends no origin.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ContactsOrigin {
    #[serde(rename = "contact_request")]
    ContactRequest,
    #[serde(rename = "other")]
    Other,
}

impl Default for ContactsOrigin {
    fn default() -> ContactsOrigin {
        Self::ContactRequest
    }
}