/*
 * 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 WebhookPayloadReactionReaction {
    /// The emoji reacted with. May be an empty string when `action` is `removed` on WhatsApp (Meta does not report which emoji was removed).
    #[serde(rename = "emoji")]
    pub emoji: String,
    #[serde(rename = "action")]
    pub action: Action,
    /// Internal Zernio message ID of the reacted-to message, when resolvable from the platform ID.
    #[serde(rename = "messageId", skip_serializing_if = "Option::is_none")]
    pub message_id: Option<String>,
    /// Platform-native ID of the reacted-to message (e.g. WhatsApp wamid).
    #[serde(rename = "platformMessageId")]
    pub platform_message_id: String,
    #[serde(rename = "sender")]
    pub sender: Box<models::WebhookPayloadReactionReactionSender>,
    #[serde(rename = "reactedAt")]
    pub reacted_at: String,
}

impl WebhookPayloadReactionReaction {
    pub fn new(
        emoji: String,
        action: Action,
        platform_message_id: String,
        sender: models::WebhookPayloadReactionReactionSender,
        reacted_at: String,
    ) -> WebhookPayloadReactionReaction {
        WebhookPayloadReactionReaction {
            emoji,
            action,
            message_id: None,
            platform_message_id,
            sender: Box::new(sender),
            reacted_at,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Action {
    #[serde(rename = "added")]
    Added,
    #[serde(rename = "removed")]
    Removed,
}

impl Default for Action {
    fn default() -> Action {
        Self::Added
    }
}
