late 0.0.803

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).
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).
 *
 * The version of the OpenAPI document: 1.0.4
 * 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 CreateAdCreativeRequest {
    /// Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token and Page.
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Meta ad account id (act_<n>).
    #[serde(rename = "adAccountId")]
    pub ad_account_id: String,
    #[serde(rename = "headline")]
    pub headline: String,
    /// Primary text
    #[serde(rename = "body")]
    pub body: String,
    /// Link description below the headline; omitted = Meta scrapes the destination's OG description.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// CTA type (same whitelist as POST /v1/ads/create).
    #[serde(rename = "callToAction", skip_serializing_if = "Option::is_none")]
    pub call_to_action: Option<String>,
    #[serde(rename = "linkUrl")]
    pub link_url: String,
    /// Publicly reachable image; uploaded to the account's library server-side.
    #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")]
    pub image_url: Option<String>,
    /// Existing library image hash (POST /v1/ads/images or GET /v1/ads/images).
    #[serde(rename = "imageHash", skip_serializing_if = "Option::is_none")]
    pub image_hash: Option<String>,
    #[serde(rename = "carouselCards", skip_serializing_if = "Option::is_none")]
    pub carousel_cards: Option<Vec<models::CreateAdCreativeRequestCarouselCardsInner>>,
    /// Appended to every outbound URL (e.g. utm_source=fb).
    #[serde(rename = "urlTags", skip_serializing_if = "Option::is_none")]
    pub url_tags: Option<String>,
    /// Advantage+ creative enhancements: partial map of Meta creative feature keys (snake_case) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Unspecified features default to OPT_OUT.
    #[serde(rename = "creativeFeatures", skip_serializing_if = "Option::is_none")]
    pub creative_features: Option<CreativeFeatures>,
    /// Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key — Meta rejects it there.
    #[serde(rename = "multiAdvertiser", skip_serializing_if = "Option::is_none")]
    pub multi_advertiser: Option<MultiAdvertiser>,
}

impl CreateAdCreativeRequest {
    pub fn new(
        account_id: String,
        ad_account_id: String,
        headline: String,
        body: String,
        link_url: String,
    ) -> CreateAdCreativeRequest {
        CreateAdCreativeRequest {
            account_id,
            ad_account_id,
            headline,
            body,
            description: None,
            call_to_action: None,
            link_url,
            image_url: None,
            image_hash: None,
            carousel_cards: None,
            url_tags: None,
            creative_features: None,
            multi_advertiser: None,
        }
    }
}
/// Advantage+ creative enhancements: partial map of Meta creative feature keys (snake_case) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Unspecified features default to OPT_OUT.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CreativeFeatures {
    #[serde(rename = "OPT_IN")]
    OptIn,
    #[serde(rename = "OPT_OUT")]
    OptOut,
}

impl Default for CreativeFeatures {
    fn default() -> CreativeFeatures {
        Self::OptIn
    }
}
/// Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key — Meta rejects it there.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MultiAdvertiser {
    #[serde(rename = "OPT_IN")]
    OptIn,
    #[serde(rename = "OPT_OUT")]
    OptOut,
}

impl Default for MultiAdvertiser {
    fn default() -> MultiAdvertiser {
        Self::OptIn
    }
}