late 0.0.1389

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.610.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 CreatorCampaign {
    #[serde(rename = "id")]
    pub id: String,
    /// The workspace billing owner the campaign belongs to.
    #[serde(rename = "userId")]
    pub user_id: String,
    /// The profile that scopes the campaign: API keys, teammates and webhooks scoped to it reach the campaign.
    #[serde(rename = "profileId")]
    pub profile_id: String,
    #[serde(rename = "kind")]
    pub kind: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "brandName")]
    pub brand_name: String,
    /// draft until activated; active accepts submissions and accrues; paused stops new submissions; closed is final.
    #[serde(rename = "status")]
    pub status: Status,
    /// Same as economics.type.
    #[serde(rename = "type")]
    pub r#type: Type,
    #[serde(rename = "currency")]
    pub currency: String,
    #[serde(rename = "platforms")]
    pub platforms: Vec<Platforms>,
    /// Free-text rules shown to creators on the join page.
    #[serde(rename = "contentRules", deserialize_with = "Option::deserialize")]
    pub content_rules: Option<String>,
    #[serde(rename = "startsAt", deserialize_with = "Option::deserialize")]
    pub starts_at: Option<String>,
    /// No new submissions after this time; the campaign closes once every tracking window had its final read.
    #[serde(rename = "endsAt", deserialize_with = "Option::deserialize")]
    pub ends_at: Option<String>,
    /// How long each submitted post is tracked.
    #[serde(rename = "trackingDays")]
    pub tracking_days: i32,
    /// Days approved earnings are held before they become payable.
    #[serde(rename = "holdDays")]
    pub hold_days: i32,
    /// A post older than this many minutes when submitted is refused. Null (the default) accepts any age. Either way, a post published before the campaign started (`startsAt`, or `activatedAt` without one) is refused.
    #[serde(rename = "maxPostAgeMinutes", deserialize_with = "Option::deserialize")]
    pub max_post_age_minutes: Option<i32>,
    /// When the campaign was first activated. Without `startsAt`, posts must be published after this moment.
    #[serde(rename = "activatedAt", deserialize_with = "Option::deserialize")]
    pub activated_at: Option<String>,
    /// none: settle records a payout made elsewhere. external: you pay from your own rails on campaign_payout.payable and settle with your reference. treasury: you pay by card with a payout batch and Zernio pays each creator in your name 7 days after the charge.
    #[serde(rename = "settlement")]
    pub settlement: Settlement,
    #[serde(rename = "economics")]
    pub economics: Box<models::CreatorCampaignEconomics>,
    #[serde(rename = "caps")]
    pub caps: Box<models::CreatorCampaignCaps>,
    #[serde(rename = "branding", deserialize_with = "Option::deserialize")]
    pub branding: Option<Box<models::CreatorCampaignBranding>>,
    #[serde(rename = "budgetExhaustedAt", deserialize_with = "Option::deserialize")]
    pub budget_exhausted_at: Option<String>,
    #[serde(rename = "closedAt", deserialize_with = "Option::deserialize")]
    pub closed_at: Option<String>,
    /// Internal watermark of the payable scan.
    #[serde(rename = "payableScannedAt", deserialize_with = "Option::deserialize")]
    pub payable_scanned_at: Option<String>,
    /// auto: creators who join through the open link are active at once. manual: they land `pending` until you approve or deny them. Personal invites are never held.
    #[serde(rename = "joinApproval")]
    pub join_approval: JoinApproval,
    /// Creators upload a draft for review first, and submit the live post for an approved draft (`draftId`).
    #[serde(rename = "requireDraftApproval")]
    pub require_draft_approval: bool,
    /// The connected store (Shopify or WooCommerce) whose orders pay commission and whose products creators can ask as samples. Null when the campaign has neither.
    #[serde(rename = "storeAccountId", deserialize_with = "Option::deserialize")]
    pub store_account_id: Option<String>,
    /// Products creators can ask a free sample of.
    #[serde(rename = "sampleProducts")]
    pub sample_products: Vec<models::CreatorCampaignSampleProduct>,
    /// Days after a sample is approved before a creator with no post since shows as owing content (`contentOwed`).
    #[serde(rename = "sampleContentDueDays")]
    pub sample_content_due_days: i32,
    #[serde(rename = "createdAt")]
    pub created_at: String,
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    /// True once an open invite link was created. The link itself is returned only when it is created.
    #[serde(rename = "hasOpenInvite")]
    pub has_open_invite: bool,
    /// Budget used so far: earnings accrued, approved or adjusted against the campaign.
    #[serde(rename = "consumedCents")]
    pub consumed_cents: i32,
    #[serde(rename = "participantCount")]
    pub participant_count: i32,
    #[serde(rename = "submissionCounts")]
    pub submission_counts: Box<models::CampaignSubmissionCounts>,
    /// What the campaign's creators can be paid now, summed over every participant's payable balance.
    #[serde(rename = "payableCents")]
    pub payable_cents: i32,
    /// The page creator tracking links open.
    #[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 discount code takes off.
    #[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>>>,
    /// Creators who asked to join through the open link and wait for a decision. Not counted in `participantCount`.
    #[serde(rename = "pendingParticipantCount")]
    pub pending_participant_count: i32,
    #[serde(rename = "draftCounts")]
    pub draft_counts: Box<models::CampaignDraftCounts>,
    #[serde(rename = "sampleCounts")]
    pub sample_counts: Box<models::CampaignSampleCounts>,
}

impl CreatorCampaign {
    pub fn new(
        id: String,
        user_id: String,
        profile_id: String,
        kind: String,
        name: String,
        brand_name: String,
        status: Status,
        r#type: Type,
        currency: String,
        platforms: Vec<Platforms>,
        content_rules: Option<String>,
        starts_at: Option<String>,
        ends_at: Option<String>,
        tracking_days: i32,
        hold_days: i32,
        max_post_age_minutes: Option<i32>,
        activated_at: Option<String>,
        settlement: Settlement,
        economics: models::CreatorCampaignEconomics,
        caps: models::CreatorCampaignCaps,
        branding: Option<models::CreatorCampaignBranding>,
        budget_exhausted_at: Option<String>,
        closed_at: Option<String>,
        payable_scanned_at: Option<String>,
        join_approval: JoinApproval,
        require_draft_approval: bool,
        store_account_id: Option<String>,
        sample_products: Vec<models::CreatorCampaignSampleProduct>,
        sample_content_due_days: i32,
        created_at: String,
        updated_at: String,
        has_open_invite: bool,
        consumed_cents: i32,
        participant_count: i32,
        submission_counts: models::CampaignSubmissionCounts,
        payable_cents: i32,
        pending_participant_count: i32,
        draft_counts: models::CampaignDraftCounts,
        sample_counts: models::CampaignSampleCounts,
    ) -> CreatorCampaign {
        CreatorCampaign {
            id,
            user_id,
            profile_id,
            kind,
            name,
            brand_name,
            status,
            r#type,
            currency,
            platforms,
            content_rules,
            starts_at,
            ends_at,
            tracking_days,
            hold_days,
            max_post_age_minutes,
            activated_at,
            settlement,
            economics: Box::new(economics),
            caps: Box::new(caps),
            branding: if let Some(x) = branding {
                Some(Box::new(x))
            } else {
                None
            },
            budget_exhausted_at,
            closed_at,
            payable_scanned_at,
            join_approval,
            require_draft_approval,
            store_account_id,
            sample_products,
            sample_content_due_days,
            created_at,
            updated_at,
            has_open_invite,
            consumed_cents,
            participant_count,
            submission_counts: Box::new(submission_counts),
            payable_cents,
            landing_url: None,
            code_discount_percent: None,
            auto_payout: None,
            pending_participant_count,
            draft_counts: Box::new(draft_counts),
            sample_counts: Box::new(sample_counts),
        }
    }
}
/// draft until activated; active accepts submissions and accrues; paused stops new submissions; closed is final.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "draft")]
    Draft,
    #[serde(rename = "active")]
    Active,
    #[serde(rename = "paused")]
    Paused,
    #[serde(rename = "closed")]
    Closed,
}

impl Default for Status {
    fn default() -> Status {
        Self::Draft
    }
}
/// Same as economics.type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "cpm")]
    Cpm,
    #[serde(rename = "per_post")]
    PerPost,
    #[serde(rename = "pool")]
    Pool,
    #[serde(rename = "retainer")]
    Retainer,
    #[serde(rename = "commission")]
    Commission,
    #[serde(rename = "ad_performance")]
    AdPerformance,
}

impl Default for Type {
    fn default() -> Type {
        Self::Cpm
    }
}
///
#[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
    }
}
/// none: settle records a payout made elsewhere. external: you pay from your own rails on campaign_payout.payable and settle with your reference. treasury: you pay by card with a payout batch and Zernio pays each creator in your name 7 days after the charge.
#[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
    }
}
/// auto: creators who join through the open link are active at once. manual: they land `pending` until you approve or deny 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
    }
}