/*
 * 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 Ad {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub _id: Option<String>,
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<Platform>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::AdStatus>,
    #[serde(rename = "adType", skip_serializing_if = "Option::is_none")]
    pub ad_type: Option<AdType>,
    /// Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
    #[serde(rename = "goal", skip_serializing_if = "Option::is_none")]
    pub goal: Option<Goal>,
    /// True for ads synced from platform ad managers
    #[serde(rename = "isExternal", skip_serializing_if = "Option::is_none")]
    pub is_external: Option<bool>,
    #[serde(rename = "budget", skip_serializing_if = "Option::is_none")]
    pub budget: Option<Box<models::AdBudget>>,
    #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
    pub metrics: Option<Box<models::AdMetrics>>,
    #[serde(rename = "platformAdId", skip_serializing_if = "Option::is_none")]
    pub platform_ad_id: Option<String>,
    #[serde(
        rename = "platformAdAccountId",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_ad_account_id: Option<String>,
    #[serde(rename = "platformCampaignId", skip_serializing_if = "Option::is_none")]
    pub platform_campaign_id: Option<String>,
    #[serde(rename = "platformAdSetId", skip_serializing_if = "Option::is_none")]
    pub platform_ad_set_id: Option<String>,
    #[serde(rename = "campaignName", skip_serializing_if = "Option::is_none")]
    pub campaign_name: Option<String>,
    #[serde(rename = "adSetName", skip_serializing_if = "Option::is_none")]
    pub ad_set_name: Option<String>,
    /// Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC). Only present for Meta ads.
    #[serde(rename = "platformObjective", skip_serializing_if = "Option::is_none")]
    pub platform_objective: Option<String>,
    /// Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION, LINK_CLICKS). Only present for Meta ads.
    #[serde(rename = "optimizationGoal", skip_serializing_if = "Option::is_none")]
    pub optimization_goal: Option<String>,
    /// Bid strategy (e.g. LOWEST_COST_WITHOUT_CAP, COST_CAP, LOWEST_COST_WITH_MIN_ROAS). Ad set level overrides campaign level. Only present for Meta ads.
    #[serde(rename = "bidStrategy", skip_serializing_if = "Option::is_none")]
    pub bid_strategy: Option<String>,
    #[serde(rename = "promotedObject", skip_serializing_if = "Option::is_none")]
    pub promoted_object: Option<Box<models::AdPromotedObject>>,
    #[serde(rename = "creative", skip_serializing_if = "Option::is_none")]
    pub creative: Option<Box<models::AdCreative>>,
    #[serde(rename = "targeting", skip_serializing_if = "Option::is_none")]
    pub targeting: Option<serde_json::Value>,
    #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")]
    pub schedule: Option<Box<models::AdSchedule>>,
    #[serde(rename = "rejectionReason", skip_serializing_if = "Option::is_none")]
    pub rejection_reason: Option<String>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<String>,
}

impl Ad {
    pub fn new() -> Ad {
        Ad {
            _id: None,
            name: None,
            platform: None,
            status: None,
            ad_type: None,
            goal: None,
            is_external: None,
            budget: None,
            metrics: None,
            platform_ad_id: None,
            platform_ad_account_id: None,
            platform_campaign_id: None,
            platform_ad_set_id: None,
            campaign_name: None,
            ad_set_name: None,
            platform_objective: None,
            optimization_goal: None,
            bid_strategy: None,
            promoted_object: None,
            creative: None,
            targeting: None,
            schedule: None,
            rejection_reason: None,
            created_at: None,
            updated_at: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "tiktok")]
    Tiktok,
    #[serde(rename = "linkedin")]
    Linkedin,
    #[serde(rename = "pinterest")]
    Pinterest,
    #[serde(rename = "google")]
    Google,
    #[serde(rename = "twitter")]
    Twitter,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Facebook
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AdType {
    #[serde(rename = "boost")]
    Boost,
    #[serde(rename = "standalone")]
    Standalone,
}

impl Default for AdType {
    fn default() -> AdType {
        Self::Boost
    }
}
/// Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Goal {
    #[serde(rename = "engagement")]
    Engagement,
    #[serde(rename = "traffic")]
    Traffic,
    #[serde(rename = "awareness")]
    Awareness,
    #[serde(rename = "video_views")]
    VideoViews,
    #[serde(rename = "lead_generation")]
    LeadGeneration,
    #[serde(rename = "conversions")]
    Conversions,
    #[serde(rename = "app_promotion")]
    AppPromotion,
}

impl Default for Goal {
    fn default() -> Goal {
        Self::Engagement
    }
}
