late 0.0.1141

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.236.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 UpdateAdCampaignRequest {
    /// Required: platform campaign IDs are not globally unique.
    #[serde(rename = "platform")]
    pub platform: Platform,
    /// **Meta only.** Zernio SocialAccount id owning the ad account. Needed only for an EMPTY campaign (zero ads); ignored otherwise.
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    /// **Meta + Google.** On Meta, the campaign default that ad sets inherit unless they override it. On Google, the campaign's own bidding strategy. On Google: LOWEST_COST_WITHOUT_CAP = Maximize Conversions, COST_CAP + bidAmount = Target CPA, LOWEST_COST_WITH_MIN_ROAS + roasAverageFloor = Target ROAS, LOWEST_COST_WITH_BID_CAP + bidAmount = Maximize Clicks with a CPC ceiling; portfolioBidStrategyId attaches a portfolio strategy instead.
    #[serde(rename = "bidStrategy", skip_serializing_if = "Option::is_none")]
    pub bid_strategy: Option<models::BidStrategy>,
    /// **Google only.** Whole currency units (USD: 12 = $12.00). Max CPC for LOWEST_COST_WITH_BID_CAP, CPA target for COST_CAP; required for both.
    #[serde(rename = "bidAmount", skip_serializing_if = "Option::is_none")]
    pub bid_amount: Option<f64>,
    /// **Google only.** Decimal ROAS multiplier (2.0 = 2.0x), required for LOWEST_COST_WITH_MIN_ROAS.
    #[serde(rename = "roasAverageFloor", skip_serializing_if = "Option::is_none")]
    pub roas_average_floor: Option<f64>,
    /// **Google only.** Attach an existing portfolio bid strategy (numeric id from GET /v1/ads/bid-strategies) instead of setting bidStrategy. Exclusive with bidStrategy.
    #[serde(
        rename = "portfolioBidStrategyId",
        skip_serializing_if = "Option::is_none"
    )]
    pub portfolio_bid_strategy_id: Option<String>,
    /// Google only. Explicitly allow changing a shared campaign budget (flagged as shared by Google, or used by more than one campaign), affecting every campaign that uses it. Does not bypass an unknown sharing state. Also required to move a campaign onto a shared budget with sharedBudgetId.
    #[serde(
        rename = "allowSharedBudgetUpdate",
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_shared_budget_update: Option<bool>,
    /// Google Search only. Target impression share bidding. Exclusive with bidStrategy, portfolioBidStrategyId and manualCpc; bidAmount is refused alongside it (the ceiling is maxCpc).
    #[serde(
        rename = "targetImpressionShare",
        skip_serializing_if = "Option::is_none"
    )]
    pub target_impression_share: Option<Box<models::GoogleTargetImpressionShare>>,
    #[serde(rename = "manualCpc", skip_serializing_if = "Option::is_none")]
    pub manual_cpc: Option<Box<models::GoogleManualCpc>>,
    #[serde(rename = "networkSettings", skip_serializing_if = "Option::is_none")]
    pub network_settings: Option<Box<models::GoogleNetworkSettings>>,
    /// **Google only.** campaign.tracking_url_template; an empty string clears it.
    #[serde(
        rename = "trackingUrlTemplate",
        skip_serializing_if = "Option::is_none"
    )]
    pub tracking_url_template: Option<String>,
    /// **Google only.** campaign.final_url_suffix; an empty string clears it.
    #[serde(rename = "finalUrlSuffix", skip_serializing_if = "Option::is_none")]
    pub final_url_suffix: Option<String>,
    /// **Google only.** Move the campaign onto this shared budget (id from GET /v1/ads/shared-budgets), or null to move it back onto a budget of its own sized by `budget`.
    #[serde(
        rename = "sharedBudgetId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub shared_budget_id: Option<Option<String>>,
    #[serde(rename = "budget", skip_serializing_if = "Option::is_none")]
    pub budget: Option<Box<models::UpdateAdCampaignRequestBudget>>,
    /// **Meta only.** Rename the campaign.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(
        rename = "platformSpecificData",
        skip_serializing_if = "Option::is_none"
    )]
    pub platform_specific_data: Option<Box<models::UpdateAdCampaignRequestPlatformSpecificData>>,
}

impl UpdateAdCampaignRequest {
    pub fn new(platform: Platform) -> UpdateAdCampaignRequest {
        UpdateAdCampaignRequest {
            platform,
            account_id: None,
            bid_strategy: None,
            bid_amount: None,
            roas_average_floor: None,
            portfolio_bid_strategy_id: None,
            allow_shared_budget_update: None,
            target_impression_share: None,
            manual_cpc: None,
            network_settings: None,
            tracking_url_template: None,
            final_url_suffix: None,
            shared_budget_id: None,
            budget: None,
            name: None,
            platform_specific_data: None,
        }
    }
}
/// Required: platform campaign IDs are not globally unique.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "google")]
    Google,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Facebook
    }
}