/*
 * 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 AdCampaign {
    #[serde(rename = "platformCampaignId", skip_serializing_if = "Option::is_none")]
    pub platform_campaign_id: Option<String>,
    #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
    pub platform: Option<Platform>,
    #[serde(rename = "campaignName", skip_serializing_if = "Option::is_none")]
    pub campaign_name: Option<String>,
    /// Delivery status derived from child ad statuses. Distinct from `reviewStatus`.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::AdStatus>,
    /// Platform-side review state of the campaign. See AdTreeCampaign.reviewStatus for the full description.
    #[serde(
        rename = "reviewStatus",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub review_status: Option<Option<ReviewStatus>>,
    /// Raw platform-level campaign status (Meta `effective_status`).
    #[serde(
        rename = "platformCampaignStatus",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_campaign_status: Option<Option<String>>,
    /// Platform-reported campaign issues (Meta `issues_info[]`).
    #[serde(
        rename = "campaignIssuesInfo",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub campaign_issues_info: Option<Option<Vec<serde_json::Value>>>,
    #[serde(rename = "adCount", skip_serializing_if = "Option::is_none")]
    pub ad_count: Option<i32>,
    #[serde(rename = "budget", skip_serializing_if = "Option::is_none")]
    pub budget: Option<Box<models::AdCampaignBudget>>,
    #[serde(rename = "campaignBudget", skip_serializing_if = "Option::is_none")]
    pub campaign_budget: Option<Box<models::AdCampaignCampaignBudget>>,
    /// Canonical CBO/ABO indicator. See AdTreeCampaign.budgetLevel.
    #[serde(
        rename = "budgetLevel",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub budget_level: Option<Option<BudgetLevel>>,
    /// Meta-only. Mirrors Campaign.is_budget_schedule_enabled.
    #[serde(
        rename = "isBudgetScheduleEnabled",
        skip_serializing_if = "Option::is_none"
    )]
    pub is_budget_schedule_enabled: Option<bool>,
    /// ISO 4217 currency code for all budget amounts. Budgets are NOT normalized to USD.
    #[serde(
        rename = "currency",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub currency: Option<Option<String>>,
    #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
    pub metrics: Option<Box<models::AdMetrics>>,
    #[serde(
        rename = "platformAdAccountId",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_ad_account_id: Option<String>,
    /// Human-readable advertiser/account name from the platform. Refreshed on every sync.
    #[serde(
        rename = "platformAdAccountName",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_ad_account_name: Option<Option<String>>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "profileId", skip_serializing_if = "Option::is_none")]
    pub profile_id: Option<String>,
    /// Google-only. Raw campaign.advertising_channel_type. See AdTreeCampaign.advertisingChannelType.
    #[serde(
        rename = "advertisingChannelType",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub advertising_channel_type: Option<Option<String>>,
    /// Raw Meta campaign objective (e.g. OUTCOME_SALES, OUTCOME_LEADS, OUTCOME_TRAFFIC)
    #[serde(
        rename = "platformObjective",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_objective: Option<Option<String>>,
    /// Meta optimization goal shared across ad sets, or comma-separated values when ad sets differ (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION)
    #[serde(
        rename = "optimizationGoal",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub optimization_goal: Option<Option<String>>,
    #[serde(
        rename = "bidStrategy",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub bid_strategy: Option<Option<models::BidStrategy>>,
    /// Representative bid cap from the top-spending ad set (whole currency units). Populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.
    #[serde(
        rename = "bidAmount",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub bid_amount: Option<Option<f64>>,
    /// Representative ROAS floor from the top-spending ad set. Decimal multiplier (2.0 = 2.0x).
    #[serde(
        rename = "roasAverageFloor",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub roas_average_floor: Option<Option<f64>>,
    #[serde(rename = "promotedObject", skip_serializing_if = "Option::is_none")]
    pub promoted_object: Option<Box<models::AdTreeCampaignPromotedObject>>,
    #[serde(rename = "earliestAd", skip_serializing_if = "Option::is_none")]
    pub earliest_ad: Option<String>,
    #[serde(rename = "latestAd", skip_serializing_if = "Option::is_none")]
    pub latest_ad: Option<String>,
}

impl AdCampaign {
    pub fn new() -> AdCampaign {
        AdCampaign {
            platform_campaign_id: None,
            platform: None,
            campaign_name: None,
            status: None,
            review_status: None,
            platform_campaign_status: None,
            campaign_issues_info: None,
            ad_count: None,
            budget: None,
            campaign_budget: None,
            budget_level: None,
            is_budget_schedule_enabled: None,
            currency: None,
            metrics: None,
            platform_ad_account_id: None,
            platform_ad_account_name: None,
            account_id: None,
            profile_id: None,
            advertising_channel_type: None,
            platform_objective: None,
            optimization_goal: None,
            bid_strategy: None,
            bid_amount: None,
            roas_average_floor: None,
            promoted_object: None,
            earliest_ad: None,
            latest_ad: 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
    }
}
/// Platform-side review state of the campaign. See AdTreeCampaign.reviewStatus for the full description.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ReviewStatus {
    #[serde(rename = "in_review")]
    InReview,
    #[serde(rename = "approved")]
    Approved,
    #[serde(rename = "rejected")]
    Rejected,
    #[serde(rename = "with_issues")]
    WithIssues,
}

impl Default for ReviewStatus {
    fn default() -> ReviewStatus {
        Self::InReview
    }
}
/// Canonical CBO/ABO indicator. See AdTreeCampaign.budgetLevel.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum BudgetLevel {
    #[serde(rename = "campaign")]
    Campaign,
    #[serde(rename = "adset")]
    Adset,
}

impl Default for BudgetLevel {
    fn default() -> BudgetLevel {
        Self::Campaign
    }
}
