late 0.0.1291

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

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

/// CreatorPortalCampaign : The campaign as a creator sees it: terms, never the budget.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreatorPortalCampaign {
    /// The campaign id, as in a link-recovery URL.
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "brandName")]
    pub brand_name: String,
    #[serde(rename = "logoUrl", deserialize_with = "Option::deserialize")]
    pub logo_url: Option<String>,
    /// Same keys as the `welcomeTheme` parameter of `GET /v1/connect/{platform}`.
    #[serde(rename = "theme", deserialize_with = "Option::deserialize")]
    pub theme: Option<serde_json::Value>,
    #[serde(rename = "status")]
    pub status: Status,
    #[serde(rename = "platforms")]
    pub platforms: Vec<String>,
    #[serde(rename = "contentRules", deserialize_with = "Option::deserialize")]
    pub content_rules: Option<String>,
    #[serde(rename = "startsAt", deserialize_with = "Option::deserialize")]
    pub starts_at: Option<String>,
    #[serde(rename = "endsAt", deserialize_with = "Option::deserialize")]
    pub ends_at: Option<String>,
    #[serde(rename = "currency")]
    pub currency: String,
    #[serde(rename = "economics")]
    pub economics: Box<models::CreatorPortalEconomics>,
    /// A post must be submitted within this many minutes of publishing. Null means any age. Either way, only posts published after the campaign started are accepted.
    #[serde(rename = "maxPostAgeMinutes", deserialize_with = "Option::deserialize")]
    pub max_post_age_minutes: Option<i32>,
    /// Days approved earnings stay owed before they become payable.
    #[serde(rename = "holdDays")]
    pub hold_days: i32,
    /// Days each submitted post is tracked for views.
    #[serde(rename = "trackingDays")]
    pub tracking_days: i32,
}

impl CreatorPortalCampaign {
    /// The campaign as a creator sees it: terms, never the budget.
    pub fn new(
        id: String,
        name: String,
        brand_name: String,
        logo_url: Option<String>,
        theme: Option<serde_json::Value>,
        status: Status,
        platforms: Vec<String>,
        content_rules: Option<String>,
        starts_at: Option<String>,
        ends_at: Option<String>,
        currency: String,
        economics: models::CreatorPortalEconomics,
        max_post_age_minutes: Option<i32>,
        hold_days: i32,
        tracking_days: i32,
    ) -> CreatorPortalCampaign {
        CreatorPortalCampaign {
            id,
            name,
            brand_name,
            logo_url,
            theme,
            status,
            platforms,
            content_rules,
            starts_at,
            ends_at,
            currency,
            economics: Box::new(economics),
            max_post_age_minutes,
            hold_days,
            tracking_days,
        }
    }
}
///
#[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
    }
}