/*
 * 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.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 PlatformAnalytics {
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "accountUsername", skip_serializing_if = "Option::is_none")]
    pub account_username: Option<String>,
    #[serde(rename = "analytics", skip_serializing_if = "Option::is_none")]
    pub analytics: Option<Box<models::PostAnalytics>>,
    /// Sync state of analytics for this platform
    #[serde(rename = "syncStatus", skip_serializing_if = "Option::is_none")]
    pub sync_status: Option<SyncStatus>,
    #[serde(rename = "platformPostUrl", skip_serializing_if = "Option::is_none")]
    pub platform_post_url: Option<String>,
    /// Error details when status is failed
    #[serde(rename = "errorMessage", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
}

impl PlatformAnalytics {
    pub fn new() -> PlatformAnalytics {
        PlatformAnalytics {
            platform: None,
            status: None,
            account_id: None,
            account_username: None,
            analytics: None,
            sync_status: None,
            platform_post_url: None,
            error_message: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "published")]
    Published,
    #[serde(rename = "failed")]
    Failed,
}

impl Default for Status {
    fn default() -> Status {
        Self::Published
    }
}
/// Sync state of analytics for this platform
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SyncStatus {
    #[serde(rename = "synced")]
    Synced,
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "unavailable")]
    Unavailable,
}

impl Default for SyncStatus {
    fn default() -> SyncStatus {
        Self::Synced
    }
}
