late 0.0.1372

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.572.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CreatorCampaignEconomicsAdPerformance : Pays on what the ads running a post achieve. `spend` and `purchase_value` take `rateBps` (a share of the amount), `purchases` and `clicks` take `centsPerUnit` each, and `impressions` takes `centsPerUnit` per 1,000.  Sending the other rate field, or `organicViewsOnly`, answers 400. Every campaign platform must be Instagram, Facebook or TikTok. Money from an ad billed in another currency than the campaign does not count.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreatorCampaignEconomicsAdPerformance {
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "metric")]
    pub metric: Metric,
    /// Basis points of the spend or purchase value: 1000 is 10%.
    #[serde(rename = "rateBps", skip_serializing_if = "Option::is_none")]
    pub rate_bps: Option<i32>,
    /// Cents per purchase or click, or per 1,000 impressions.
    #[serde(rename = "centsPerUnit", skip_serializing_if = "Option::is_none")]
    pub cents_per_unit: Option<i32>,
    #[serde(
        rename = "maxPayoutPerPostCents",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_payout_per_post_cents: Option<i32>,
    #[serde(rename = "budgetCents")]
    pub budget_cents: i32,
}

impl CreatorCampaignEconomicsAdPerformance {
    /// Pays on what the ads running a post achieve. `spend` and `purchase_value` take `rateBps` (a share of the amount), `purchases` and `clicks` take `centsPerUnit` each, and `impressions` takes `centsPerUnit` per 1,000.  Sending the other rate field, or `organicViewsOnly`, answers 400. Every campaign platform must be Instagram, Facebook or TikTok. Money from an ad billed in another currency than the campaign does not count.
    pub fn new(
        r#type: Type,
        metric: Metric,
        budget_cents: i32,
    ) -> CreatorCampaignEconomicsAdPerformance {
        CreatorCampaignEconomicsAdPerformance {
            r#type,
            metric,
            rate_bps: None,
            cents_per_unit: None,
            max_payout_per_post_cents: None,
            budget_cents,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "ad_performance")]
    AdPerformance,
}

impl Default for Type {
    fn default() -> Type {
        Self::AdPerformance
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Metric {
    #[serde(rename = "spend")]
    Spend,
    #[serde(rename = "purchases")]
    Purchases,
    #[serde(rename = "purchase_value")]
    PurchaseValue,
    #[serde(rename = "clicks")]
    Clicks,
    #[serde(rename = "impressions")]
    Impressions,
}

impl Default for Metric {
    fn default() -> Metric {
        Self::Spend
    }
}