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

/// AdTreeAdSet : Ad set (or ad group/line item depending on platform) with rolled-up metrics and child ads
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AdTreeAdSet {
    #[serde(rename = "platformAdSetId", skip_serializing_if = "Option::is_none")]
    pub platform_ad_set_id: Option<String>,
    #[serde(rename = "adSetName", skip_serializing_if = "Option::is_none")]
    pub ad_set_name: Option<String>,
    /// Derived from child ad statuses
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<models::AdStatus>,
    #[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::AdTreeAdSetBudget>>,
    #[serde(rename = "adSetBudget", skip_serializing_if = "Option::is_none")]
    pub ad_set_budget: Option<Box<models::AdTreeAdSetAdSetBudget>>,
    #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
    pub metrics: Option<Box<models::AdMetrics>>,
    /// Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION)
    #[serde(rename = "optimizationGoal", skip_serializing_if = "Option::is_none")]
    pub optimization_goal: Option<String>,
    /// Bid strategy for this ad set (overrides campaign level when set)
    #[serde(rename = "bidStrategy", skip_serializing_if = "Option::is_none")]
    pub bid_strategy: Option<models::BidStrategy>,
    /// Bid cap in whole currency units. Populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP.
    #[serde(rename = "bidAmount", skip_serializing_if = "Option::is_none")]
    pub bid_amount: Option<f64>,
    /// Minimum ROAS as a decimal multiplier (2.0 = 2.0x). Populated when bidStrategy is LOWEST_COST_WITH_MIN_ROAS.
    #[serde(rename = "roasAverageFloor", skip_serializing_if = "Option::is_none")]
    pub roas_average_floor: Option<f64>,
    #[serde(rename = "promotedObject", skip_serializing_if = "Option::is_none")]
    pub promoted_object: Option<Box<models::AdTreeAdSetPromotedObject>>,
    /// Individual ads within this ad set (capped at 100). Returns a subset of Ad fields from the aggregation (core fields like _id, name, platform, status, budget, metrics, creative, goal are included; targeting and schedule may be absent).
    #[serde(rename = "ads", skip_serializing_if = "Option::is_none")]
    pub ads: Option<Vec<models::Ad>>,
}

impl AdTreeAdSet {
    /// Ad set (or ad group/line item depending on platform) with rolled-up metrics and child ads
    pub fn new() -> AdTreeAdSet {
        AdTreeAdSet {
            platform_ad_set_id: None,
            ad_set_name: None,
            status: None,
            ad_count: None,
            budget: None,
            ad_set_budget: None,
            metrics: None,
            optimization_goal: None,
            bid_strategy: None,
            bid_amount: None,
            roas_average_floor: None,
            promoted_object: None,
            ads: None,
        }
    }
}
