late 0.0.1291

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.416.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 apply.  - Empty: no serving data. - [\"RUNNABLE\"]: eligible to serve. - Anything else: 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. Null on other platforms and for ad sets not yet synced.  - LEARNING: delivery is still being optimized (about 50 optimization events in 7 days end it). - SUCCESS: it has left learning. - FAIL: it could not gather enough events (Ads Manager's \"Learning limited\").
    #[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>>,
    /// Meta only. Where the ad set sends people (Meta `destination_type`), e.g. WEBSITE, MESSENGER, WHATSAPP, INSTAGRAM_DIRECT, ON_AD. Meta answers UNDEFINED for an ad set with no explicit destination. As of the last sync; null on other platforms and for ad sets not yet synced.
    #[serde(
        rename = "destinationType",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub destination_type: Option<Option<String>>,
    /// Meta only. The ad set's conversion attribution windows (Meta `attribution_spec`), in the same shape `attributionSpec` takes on ad creation so a clone can send it back unchanged. As of the last sync; null on other platforms, for ad sets not yet synced and when Meta reports none.
    #[serde(
        rename = "attributionSpec",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub attribution_spec: Option<Option<Vec<models::AdTreeAdSetAttributionSpecInner>>>,
    /// Meta only. Regional regulated categories declared on the ad set (Meta `regional_regulated_categories`), e.g. AUSTRALIA_FINSERV, TAIWAN_UNIVERSAL, SINGAPORE_UNIVERSAL or VOLUNTARY_VERIFICATION. As of the last sync; null on other platforms, for ad sets not yet synced and when Meta reports none.
    #[serde(
        rename = "regionalRegulatedCategories",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub regional_regulated_categories: Option<Option<Vec<String>>>,
    /// Meta only. Verified identity IDs per regional regulation role (Meta `regional_regulation_identities`), keyed by Meta's role name. IDs are strings because they can exceed a JSON number's precision. As of the last sync; null on other platforms, for ad sets not yet synced and when Meta reports none.
    #[serde(
        rename = "regionalRegulationIdentities",
        skip_serializing_if = "Option::is_none"
    )]
    pub regional_regulation_identities: Option<std::collections::HashMap<String, String>>,
    /// Individual ads within this ad set (capped at 100). With more than 100 ads these are the 100 highest-spending over the requested date range, so the array depends on `fromDate`/`toDate`. `adCount` is always the true ad set size.  A subset of Ad fields from the aggregation. Always included: `_id`, `name`, `platform`, `status`, `configuredStatus`, `reviewStatus`, `budget`, `metrics`, `creative`, `goal` and the `platform*` ids. `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: only `reviewStatus` distinguishes a rejected ad from a healthy one.  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,
            destination_type: None,
            attribution_spec: None,
            regional_regulated_categories: None,
            regional_regulation_identities: None,
            ads: None,
            daily: None,
        }
    }
}
/// Meta only. Where the ad set stands in Meta's learning phase, as of the last sync. Null on other platforms and for ad sets not yet synced.  - LEARNING: delivery is still being optimized (about 50 optimization events in 7 days end it). - SUCCESS: it has left learning. - FAIL: it could not gather enough events (Ads Manager's \"Learning limited\").
#[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
    }
}