late 0.0.297

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * 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 SocialAccount {
    #[serde(rename = "_id")]
    pub _id: String,
    #[serde(rename = "platform")]
    pub platform: Platform,
    #[serde(rename = "profileId")]
    pub profile_id: Box<models::SocialAccountProfileId>,
    #[serde(rename = "username", skip_serializing_if = "Option::is_none")]
    pub username: Option<String>,
    #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
    pub display_name: Option<String>,
    /// URL to the account's profile picture on the platform. May be null if the platform does not provide one.
    #[serde(rename = "profilePicture", skip_serializing_if = "Option::is_none")]
    pub profile_picture: Option<String>,
    /// Full profile URL for the connected account on its platform.
    #[serde(rename = "profileUrl", skip_serializing_if = "Option::is_none")]
    pub profile_url: Option<String>,
    #[serde(rename = "isActive")]
    pub is_active: bool,
    /// Follower count (only included if user has analytics add-on)
    #[serde(rename = "followersCount", skip_serializing_if = "Option::is_none")]
    pub followers_count: Option<f64>,
    /// Last time follower count was updated (only included if user has analytics add-on)
    #[serde(
        rename = "followersLastUpdated",
        skip_serializing_if = "Option::is_none"
    )]
    pub followers_last_updated: Option<String>,
    /// Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts.
    #[serde(rename = "parentAccountId", skip_serializing_if = "Option::is_none")]
    pub parent_account_id: Option<String>,
    /// Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Posting UI and scheduler ignore accounts with enabled: false.
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). Messages cannot be sent until the display name is approved by Meta. - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
}

impl SocialAccount {
    pub fn new(
        _id: String,
        platform: Platform,
        profile_id: models::SocialAccountProfileId,
        is_active: bool,
    ) -> SocialAccount {
        SocialAccount {
            _id,
            platform,
            profile_id: Box::new(profile_id),
            username: None,
            display_name: None,
            profile_picture: None,
            profile_url: None,
            is_active,
            followers_count: None,
            followers_last_updated: None,
            parent_account_id: None,
            enabled: None,
            metadata: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "tiktok")]
    Tiktok,
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "youtube")]
    Youtube,
    #[serde(rename = "linkedin")]
    Linkedin,
    #[serde(rename = "twitter")]
    Twitter,
    #[serde(rename = "threads")]
    Threads,
    #[serde(rename = "pinterest")]
    Pinterest,
    #[serde(rename = "reddit")]
    Reddit,
    #[serde(rename = "bluesky")]
    Bluesky,
    #[serde(rename = "googlebusiness")]
    Googlebusiness,
    #[serde(rename = "telegram")]
    Telegram,
    #[serde(rename = "snapchat")]
    Snapchat,
    #[serde(rename = "discord")]
    Discord,
    #[serde(rename = "whatsapp")]
    Whatsapp,
    #[serde(rename = "linkedinads")]
    Linkedinads,
    #[serde(rename = "metaads")]
    Metaads,
    #[serde(rename = "pinterestads")]
    Pinterestads,
    #[serde(rename = "tiktokads")]
    Tiktokads,
    #[serde(rename = "xads")]
    Xads,
    #[serde(rename = "googleads")]
    Googleads,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Tiktok
    }
}