late 0.0.1379

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.597.0
 * 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 CreateCreatorCampaignRequest {
    /// Profile the campaign lives in. Creator accounts connect into the same workspace.
    #[serde(rename = "profileId")]
    pub profile_id: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "brandName")]
    pub brand_name: String,
    #[serde(rename = "economics")]
    pub economics: Box<models::CreatorCampaignEconomics>,
    /// Omitted, the campaign starts with authenticityThreshold 40 and no other caps.
    #[serde(rename = "caps", skip_serializing_if = "Option::is_none")]
    pub caps: Option<Box<models::CreatorCampaignCaps>>,
    /// Platforms creators may post on. At least one is needed to activate. `twitter` (X) needs usage-based billing: X reads are billed at cost, up to `caps.maxXReadSpendCents`, and X views are the post's impressions. `facebook` takes Page reels and videos only.
    #[serde(rename = "platforms", skip_serializing_if = "Option::is_none")]
    pub platforms: Option<Vec<Platforms>>,
    #[serde(
        rename = "contentRules",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub content_rules: Option<Option<String>>,
    #[serde(
        rename = "startsAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub starts_at: Option<Option<String>>,
    #[serde(
        rename = "endsAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub ends_at: Option<Option<String>>,
    #[serde(rename = "trackingDays", skip_serializing_if = "Option::is_none")]
    pub tracking_days: Option<i32>,
    #[serde(rename = "holdDays", skip_serializing_if = "Option::is_none")]
    pub hold_days: Option<i32>,
    /// Optional maximum age in minutes of a post when it is submitted. Null or omitted (the default) accepts any age. Posts published before the campaign started are always refused.
    #[serde(
        rename = "maxPostAgeMinutes",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub max_post_age_minutes: Option<Option<i32>>,
    #[serde(rename = "settlement", skip_serializing_if = "Option::is_none")]
    pub settlement: Option<Settlement>,
    #[serde(
        rename = "branding",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub branding: Option<Option<Box<models::CreatorCampaignBranding>>>,
    /// The page creator tracking links open. Required unless `attribution` is `code`.
    #[serde(
        rename = "landingUrl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub landing_url: Option<Option<String>>,
    /// What each creator's discount code takes off an order. Required unless `attribution` is `link`.
    #[serde(
        rename = "codeDiscountPercent",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub code_discount_percent: Option<Option<i32>>,
    #[serde(
        rename = "autoPayout",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub auto_payout: Option<Option<Box<models::CreatorCampaignAutoPayout>>>,
    /// manual holds creators who join through the open link as `pending` until you approve them. Personal invites are never held.
    #[serde(rename = "joinApproval", skip_serializing_if = "Option::is_none")]
    pub join_approval: Option<JoinApproval>,
    /// Creators upload a draft for review before publishing, and each submitted post must name an approved draft.
    #[serde(
        rename = "requireDraftApproval",
        skip_serializing_if = "Option::is_none"
    )]
    pub require_draft_approval: Option<bool>,
    /// A connected Shopify or WooCommerce store account. On `commission` and smart `retainer` economics its orders pay commission: required there, and fixed once such a campaign leaves draft.  On any campaign creators can ask for free samples of its products (`sampleProductIds`). Changing it without `sampleProductIds` clears the sample products; null removes the store and the products.
    #[serde(
        rename = "storeAccountId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub store_account_id: Option<Option<String>>,
    /// Product ids in the store that creators can ask a free sample of. Each is read from the store and saved as `sampleProducts`; an unknown product answers 404 `product_not_found`. Needs a store, otherwise 400 `missing_required_field` (`param: storeAccountId`).
    #[serde(rename = "sampleProductIds", skip_serializing_if = "Option::is_none")]
    pub sample_product_ids: Option<Vec<String>>,
    /// Days after a sample is approved before a creator with no post since shows as owing content.
    #[serde(
        rename = "sampleContentDueDays",
        skip_serializing_if = "Option::is_none"
    )]
    pub sample_content_due_days: Option<i32>,
}

impl CreateCreatorCampaignRequest {
    pub fn new(
        profile_id: String,
        name: String,
        brand_name: String,
        economics: models::CreatorCampaignEconomics,
    ) -> CreateCreatorCampaignRequest {
        CreateCreatorCampaignRequest {
            profile_id,
            name,
            brand_name,
            economics: Box::new(economics),
            caps: None,
            platforms: None,
            content_rules: None,
            starts_at: None,
            ends_at: None,
            tracking_days: None,
            hold_days: None,
            max_post_age_minutes: None,
            settlement: None,
            branding: None,
            landing_url: None,
            code_discount_percent: None,
            auto_payout: None,
            join_approval: None,
            require_draft_approval: None,
            store_account_id: None,
            sample_product_ids: None,
            sample_content_due_days: None,
        }
    }
}
/// Platforms creators may post on. At least one is needed to activate. `twitter` (X) needs usage-based billing: X reads are billed at cost, up to `caps.maxXReadSpendCents`, and X views are the post's impressions. `facebook` takes Page reels and videos only.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platforms {
    #[serde(rename = "tiktok")]
    Tiktok,
    #[serde(rename = "instagram")]
    Instagram,
    #[serde(rename = "youtube")]
    Youtube,
    #[serde(rename = "threads")]
    Threads,
    #[serde(rename = "pinterest")]
    Pinterest,
    #[serde(rename = "facebook")]
    Facebook,
    #[serde(rename = "twitter")]
    Twitter,
}

impl Default for Platforms {
    fn default() -> Platforms {
        Self::Tiktok
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Settlement {
    #[serde(rename = "none")]
    None,
    #[serde(rename = "external")]
    External,
    #[serde(rename = "treasury")]
    Treasury,
}

impl Default for Settlement {
    fn default() -> Settlement {
        Self::None
    }
}
/// manual holds creators who join through the open link as `pending` until you approve them. Personal invites are never held.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum JoinApproval {
    #[serde(rename = "auto")]
    Auto,
    #[serde(rename = "manual")]
    Manual,
}

impl Default for JoinApproval {
    fn default() -> JoinApproval {
        Self::Auto
    }
}