/*
 * 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 WebhookPayloadConversationStartedConversation {
    /// Internal conversation ID
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "platform")]
    pub platform: Platform,
    #[serde(rename = "platformConversationId")]
    pub platform_conversation_id: String,
    /// Contact's platform identifier (IGSID
    #[serde(rename = "participantId", skip_serializing_if = "Option::is_none")]
    pub participant_id: Option<String>,
    #[serde(rename = "participantName")]
    pub participant_name: String,
    /// Contact's handle when the platform exposes one
    #[serde(
        rename = "participantUsername",
        skip_serializing_if = "Option::is_none"
    )]
    pub participant_username: Option<String>,
    #[serde(rename = "participantPicture", skip_serializing_if = "Option::is_none")]
    pub participant_picture: Option<String>,
    #[serde(rename = "status")]
    pub status: Status,
    /// Zernio CRM Contact ID for the participant, when one exists. Resolved by joining `participantId` to the ContactChannel collection (same join used by message.*, reaction.received, and call.* webhooks). Best-effort: omitted when no channel matches or `participantId` is absent. Lets integrators seed the CRM straight from `conversation.started` without waiting for the first `message.*` event.
    #[serde(rename = "contactId", skip_serializing_if = "Option::is_none")]
    pub contact_id: Option<String>,
}

impl WebhookPayloadConversationStartedConversation {
    pub fn new(
        id: String,
        platform: Platform,
        platform_conversation_id: String,
        participant_name: String,
        status: Status,
    ) -> WebhookPayloadConversationStartedConversation {
        WebhookPayloadConversationStartedConversation {
            id,
            platform,
            platform_conversation_id,
            participant_id: None,
            participant_name,
            participant_username: None,
            participant_picture: None,
            status,
            contact_id: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "telegram")]
    Telegram,
    #[serde(rename = "whatsapp")]
    Whatsapp,
    #[serde(rename = "twitter")]
    Twitter,
    #[serde(rename = "reddit")]
    Reddit,
    #[serde(rename = "bluesky")]
    Bluesky,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Instagram
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "archived")]
    Archived,
}

impl Default for Status {
    fn default() -> Status {
        Self::Active
    }
}
