late 0.0.1047

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.96.1
 * 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 AccountWithFollowerStats {
    #[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,
    /// The platform definitively reported the stored OAuth token as dead. While true, GET /v1/connect/{platform}/ads returns a fresh authUrl (implicit force=true) instead of alreadyConnected, so re-running the connect flow recovers the account. Cleared automatically when the account is re-authorized.
    #[serde(rename = "needsReconnection", skip_serializing_if = "Option::is_none")]
    pub needs_reconnection: Option<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. Meta ads business-login accounts also have no parent.
    #[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). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts.
    #[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). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - 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  For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token.  For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.  For Instagram accounts: - loginMethod: \"facebook_login\" when the account was connected through Facebook Login. Absent on accounts connected with Instagram Login. On facebook_login accounts, comment reads leave hidden comments out entirely instead of returning them with isHidden true.  For X (Twitter) accounts: - profileData.extraData.isPremium: Whether X reports a paid subscription (Basic, Premium, Premium+, or a blue verified badge), which raises the post length limit from 280 to 25,000 characters. Read live at connect and reconnect and refreshed by the daily follower snapshot; because X intermittently reports no subscription for subscribed accounts, a cancellation is stored on the fourth consecutive daily snapshot that reports it (about four days). Accounts connected before the extraData layout carry the same flag at profileData.isPremium.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
    /// Current follower count
    #[serde(rename = "currentFollowers", skip_serializing_if = "Option::is_none")]
    pub current_followers: Option<f64>,
    #[serde(rename = "lastUpdated", skip_serializing_if = "Option::is_none")]
    pub last_updated: Option<String>,
    /// Follower change over period
    #[serde(rename = "growth", skip_serializing_if = "Option::is_none")]
    pub growth: Option<f64>,
    /// Percentage growth
    #[serde(rename = "growthPercentage", skip_serializing_if = "Option::is_none")]
    pub growth_percentage: Option<f64>,
    /// Number of historical snapshots
    #[serde(rename = "dataPoints", skip_serializing_if = "Option::is_none")]
    pub data_points: Option<f64>,
    #[serde(rename = "accountStats", skip_serializing_if = "Option::is_none")]
    pub account_stats: Option<Box<models::AccountWithFollowerStatsAllOfAccountStats>>,
}

impl AccountWithFollowerStats {
    pub fn new(
        _id: String,
        platform: Platform,
        profile_id: models::SocialAccountProfileId,
        is_active: bool,
    ) -> AccountWithFollowerStats {
        AccountWithFollowerStats {
            _id,
            platform,
            profile_id: Box::new(profile_id),
            username: None,
            display_name: None,
            profile_picture: None,
            profile_url: None,
            is_active,
            needs_reconnection: None,
            followers_count: None,
            followers_last_updated: None,
            parent_account_id: None,
            enabled: None,
            metadata: None,
            current_followers: None,
            last_updated: None,
            growth: None,
            growth_percentage: None,
            data_points: None,
            account_stats: 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 = "slack")]
    Slack,
    #[serde(rename = "whatsapp")]
    Whatsapp,
    #[serde(rename = "shopify")]
    Shopify,
    #[serde(rename = "wordpress")]
    Wordpress,
    #[serde(rename = "linkedinads")]
    Linkedinads,
    #[serde(rename = "metaads")]
    Metaads,
    #[serde(rename = "pinterestads")]
    Pinterestads,
    #[serde(rename = "tiktokads")]
    Tiktokads,
    #[serde(rename = "xads")]
    Xads,
    #[serde(rename = "googleads")]
    Googleads,
    #[serde(rename = "openaiads")]
    Openaiads,
    #[serde(rename = "sms")]
    Sms,
    #[serde(rename = "phone")]
    Phone,
    #[serde(rename = "rcs")]
    Rcs,
}

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