late 0.0.1276

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api  Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal.  Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).  Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
 *
 * The version of the OpenAPI document: 1.390.0
 * 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>,
    /// Earliest `platformCreatedAt` (platform ad creation time; falls back to `createdAt`, Zernio's sync time, for ads synced before that field existed) across this ad set's ads. Not the ad set's own creation time on the platform, but a proxy usable for sorting.
    #[serde(
        rename = "createdTime",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub created_time: Option<Option<String>>,
    #[serde(rename = "adCount", skip_serializing_if = "Option::is_none")]
    pub ad_count: Option<i32>,
    /// TikTok only. true when this ad group belongs to an Upgraded Smart+ campaign. See AdTreeCampaign.isSmartPlus.
    #[serde(rename = "isSmartPlus", skip_serializing_if = "Option::is_none")]
    pub is_smart_plus: Option<bool>,
    #[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>>,
    /// Only with `compare=previous`. The same metrics over `previousRange`.
    #[serde(rename = "previousMetrics", skip_serializing_if = "Option::is_none")]
    pub previous_metrics: Option<Box<models::AdMetrics>>,
    /// What the delivery system optimizes for. Meta ad set optimization goal (e.g. OFFSITE_CONVERSIONS, VALUE, LEAD_GENERATION), or on LinkedIn the campaign's effective optimizationTargetType (NONE means manual bidding). See the `optimizationGoal` field on `Ad` for the full value spaces.
    #[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>>,
    /// Bid amount in whole currency units. On Meta/TikTok populated when bidStrategy is LOWEST_COST_WITH_BID_CAP or COST_CAP; on LinkedIn it is the campaign's effective unitCost and pairs with `costType`, where 0 is a real, delivery-stopping value.
    #[serde(
        rename = "bidAmount",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub bid_amount: Option<Option<f64>>,
    /// Minimum ROAS as a decimal multiplier (2.0 = 2.0x). Populated when bidStrategy is LOWEST_COST_WITH_MIN_ROAS.
    #[serde(
        rename = "roasAverageFloor",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub roas_average_floor: Option<Option<f64>>,
    /// LinkedIn only. Effective cost model (billing event) of the LinkedIn campaign backing this ad set: CPM, CPC or CPV. Null for non-LinkedIn ad sets.
    #[serde(
        rename = "costType",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub cost_type: Option<Option<String>>,
    /// LinkedIn only. Why the LinkedIn campaign backing this ad set is (or is not) delivering. A LinkedIn Campaign maps to this ad-set node, so this is the level where LinkedIn's holds actually apply. Empty means no serving data, [\"RUNNABLE\"] means eligible to serve, anything else is a hold. See the `servingStatuses` field on `Ad` for the known values.
    #[serde(rename = "servingStatuses", skip_serializing_if = "Option::is_none")]
    pub serving_statuses: Option<Vec<String>>,
    /// Meta only. Where the ad set stands in Meta's learning phase, as of the last sync: LEARNING while delivery is still being optimized (about 50 optimization events in 7 days end it), SUCCESS once it has left learning, FAIL when it could not gather enough events (Ads Manager's \"Learning limited\"). Null on other platforms and for ad sets not yet synced.
    #[serde(
        rename = "learningStatus",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub learning_status: Option<Option<LearningStatus>>,
    #[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). When the ad set has more than 100 ads these are the 100 highest-spending over the requested date range, so this array depends on `fromDate`/`toDate`; `adCount` is always the true ad set size. Returns a subset of Ad fields from the aggregation: `_id`, `name`, `platform`, `status`, `configuredStatus`, `reviewStatus`, `budget`, `metrics`, `creative`, `goal` and the `platform*` ids are always included; `targeting` and `schedule` may be absent. `configuredStatus` (the ad's own on/off toggle) and `reviewStatus` (the platform's review verdict) are part of this contract, not incidental: a rejected ad is only distinguishable from a healthy one through `reviewStatus`. When `timeIncrement=1&dailyLevel=ad`, each entry also carries a `daily[]` array of `AdDailyMetrics`.
    #[serde(rename = "ads", skip_serializing_if = "Option::is_none")]
    pub ads: Option<Vec<models::Ad>>,
    /// Per-day metric series for this ad set. Present only when `GET /v1/ads/tree` is called with `timeIncrement=1` and `dailyLevel` is `adset` or `ad`.
    #[serde(rename = "daily", skip_serializing_if = "Option::is_none")]
    pub daily: Option<Vec<models::AdDailyMetrics>>,
}

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,
            created_time: None,
            ad_count: None,
            is_smart_plus: None,
            budget: None,
            ad_set_budget: None,
            metrics: None,
            previous_metrics: None,
            optimization_goal: None,
            bid_strategy: None,
            bid_amount: None,
            roas_average_floor: None,
            cost_type: None,
            serving_statuses: None,
            learning_status: None,
            promoted_object: None,
            ads: None,
            daily: None,
        }
    }
}
/// Meta only. Where the ad set stands in Meta's learning phase, as of the last sync: LEARNING while delivery is still being optimized (about 50 optimization events in 7 days end it), SUCCESS once it has left learning, FAIL when it could not gather enough events (Ads Manager's \"Learning limited\"). Null on other platforms and for ad sets not yet synced.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LearningStatus {
    #[serde(rename = "LEARNING")]
    Learning,
    #[serde(rename = "SUCCESS")]
    Success,
    #[serde(rename = "FAIL")]
    Fail,
}

impl Default for LearningStatus {
    fn default() -> LearningStatus {
        Self::Learning
    }
}