/*
* 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).
*
* 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 Conversation {
/// 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, PSID, wa_id, etc.)
#[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 Conversation {
pub fn new(
id: String,
platform: Platform,
platform_conversation_id: String,
participant_name: String,
status: Status,
) -> Conversation {
Conversation {
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,
#[serde(rename = "sms")]
Sms,
#[serde(rename = "slack")]
Slack,
}
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
}
}