/*
* 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.429.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 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: settle moves the money from your Zernio balance to the creator's Stripe account, and the creator sets up payouts from their campaign page.
#[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>,
#[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,
}
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>,
created_at: String,
updated_at: String,
has_open_invite: bool,
consumed_cents: i32,
participant_count: i32,
submission_counts: models::CampaignSubmissionCounts,
payable_cents: i32,
) -> 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,
created_at,
updated_at,
has_open_invite,
consumed_cents,
participant_count,
submission_counts: Box::new(submission_counts),
payable_cents,
}
}
}
/// 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,
}
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: settle moves the money from your Zernio balance to the creator's Stripe account, and the creator sets up payouts from their campaign page.
#[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
}
}