/*
 * 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};

/// InstagramAccountInsightsResponse : Shared account-insights response envelope used by every platform-level analytics endpoint (/v1/analytics/{facebook|instagram|youtube|linkedin|tiktok}/_*). The name is historical - the shape was first shipped for Instagram and every new platform endpoint reuses it for response-shape consistency. The platform field echoes back which platform served the response.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstagramAccountInsightsResponse {
    #[serde(rename = "success", skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// The Zernio SocialAccount ID
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    /// Platform that served this response.
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<Platform>,
    #[serde(rename = "dateRange", skip_serializing_if = "Option::is_none")]
    pub date_range: Option<Box<models::InstagramAccountInsightsResponseDateRange>>,
    #[serde(rename = "metricType", skip_serializing_if = "Option::is_none")]
    pub metric_type: Option<MetricType>,
    /// Breakdown dimension used (only present when breakdown was requested)
    #[serde(rename = "breakdown", skip_serializing_if = "Option::is_none")]
    pub breakdown: Option<String>,
    /// Object keyed by metric name. For time_series: each metric has \"total\" (number) and \"values\" (array of {date, value}). For total_value: each metric has \"total\" (number) and optionally \"breakdowns\" (array of {dimension, value}).
    #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
    pub metrics: Option<
        std::collections::HashMap<String, models::InstagramAccountInsightsResponseMetricsValue>,
    >,
    #[serde(rename = "dataDelay", skip_serializing_if = "Option::is_none")]
    pub data_delay: Option<String>,
}

impl InstagramAccountInsightsResponse {
    /// Shared account-insights response envelope used by every platform-level analytics endpoint (/v1/analytics/{facebook|instagram|youtube|linkedin|tiktok}/_*). The name is historical - the shape was first shipped for Instagram and every new platform endpoint reuses it for response-shape consistency. The platform field echoes back which platform served the response.
    pub fn new() -> InstagramAccountInsightsResponse {
        InstagramAccountInsightsResponse {
            success: None,
            account_id: None,
            platform: None,
            date_range: None,
            metric_type: None,
            breakdown: None,
            metrics: None,
            data_delay: None,
        }
    }
}
/// Platform that served this response.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "youtube")]
    Youtube,
    #[serde(rename = "linkedin")]
    Linkedin,
    #[serde(rename = "tiktok")]
    Tiktok,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Facebook
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MetricType {
    #[serde(rename = "time_series")]
    TimeSeries,
    #[serde(rename = "total_value")]
    TotalValue,
}

impl Default for MetricType {
    fn default() -> MetricType {
        Self::TimeSeries
    }
}
