late 0.0.1344

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

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

/// AdCreative : Platform-specific creative data. Fields vary by platform.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AdCreative {
    /// Initial Performance Max asset group input. Use the asset-groups endpoint for current Google assets.
    #[serde(rename = "assetGroup", skip_serializing_if = "Option::is_none")]
    pub asset_group: Option<Box<models::GooglePmaxAssetGroupInput>>,
    /// Google resource name of the created Performance Max asset group.
    #[serde(
        rename = "assetGroupResourceName",
        skip_serializing_if = "Option::is_none"
    )]
    pub asset_group_resource_name: Option<String>,
    /// Google RSA: the headline assets as objects (3 to 15). Meta: every title variation of the creative (`asset_feed_spec.titles`) as strings, the same shape as the `headlines` create input. Present only with 2 or more titles; a single title is `headline`.
    #[serde(rename = "headlines", skip_serializing_if = "Option::is_none")]
    pub headlines: Option<Vec<models::AdCreativeHeadlinesInner>>,
    /// Google RSA: the description assets as objects (2 to 4). Meta: every description variation of the creative (`asset_feed_spec.descriptions`) as strings, the same shape as the `descriptions` create input. Present only with 2 or more descriptions; a single one is `description`.
    #[serde(rename = "descriptions", skip_serializing_if = "Option::is_none")]
    pub descriptions: Option<Vec<models::AdCreativeDescriptionsInner>>,
    /// Meta: the creative's title (`link_data.name`, `video_data.title`, or the first `asset_feed_spec.titles` entry). Absent when the creative has none.
    #[serde(rename = "headline", skip_serializing_if = "Option::is_none")]
    pub headline: Option<String>,
    /// Meta: every primary text variation of the creative (`asset_feed_spec.bodies`), the same shape as the `bodies` create input. Present only with 2 or more texts; a single text is `body`.
    #[serde(rename = "bodies", skip_serializing_if = "Option::is_none")]
    pub bodies: Option<Vec<String>>,
    /// Meta: the creative's description under the title (`link_data.description`, `video_data.link_description`, or the first `asset_feed_spec.descriptions` entry).
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Meta: the call to action type (`call_to_action.type`, or the first `asset_feed_spec.call_to_action_types` entry), e.g. LEARN_MORE or SIGN_UP. TikTok: the ad's `call_to_action`.
    #[serde(rename = "callToAction", skip_serializing_if = "Option::is_none")]
    pub call_to_action: Option<String>,
    /// TikTok only, with `live=true` on GET /v1/ads/{adId}: the identity the ad runs as (`identity_id`), the same id GET /v1/ads/tiktok-identities lists.
    #[serde(rename = "identityId", skip_serializing_if = "Option::is_none")]
    pub identity_id: Option<String>,
    /// TikTok only, with `live=true`: the identity type (`identity_type`), e.g. TT_USER, BC_AUTH_TT, CUSTOMIZED_USER or AUTH_CODE.
    #[serde(rename = "identityType", skip_serializing_if = "Option::is_none")]
    pub identity_type: Option<String>,
    /// TikTok only, with `live=true`: the Business Center that authorized a BC_AUTH_TT identity (`identity_authorized_bc_id`).
    #[serde(
        rename = "identityAuthorizedBcId",
        skip_serializing_if = "Option::is_none"
    )]
    pub identity_authorized_bc_id: Option<String>,
    /// TikTok only, with `live=true`: the TikTok post a Spark ad runs (`tiktok_item_id`).
    #[serde(rename = "tiktokItemId", skip_serializing_if = "Option::is_none")]
    pub tiktok_item_id: Option<String>,
    /// Meta: the instant form the call to action opens (`call_to_action.value.lead_gen_form_id`, or the asset feed's `call_to_actions` on a dynamic creative), the same value as the `leadGenFormId` create input. Absent on ads without a lead form.
    #[serde(rename = "leadGenFormId", skip_serializing_if = "Option::is_none")]
    pub lead_gen_form_id: Option<String>,
    /// Meta: the ad image hash (`image_hash`), reusable as `imageHash` on POST /v1/ads/create within the same ad account. `thumbnailUrl` and `mediaUrls` carry its stable full resolution permalink when Meta resolves it.
    #[serde(rename = "imageHash", skip_serializing_if = "Option::is_none")]
    pub image_hash: Option<String>,
    /// Meta: the creative's `url_tags` query string appended to the destination URL.
    #[serde(
        rename = "urlTags",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub url_tags: Option<Option<String>>,
    /// Google RSA only. Replaces final URLs. Omitted lists stay unchanged.
    #[serde(rename = "finalUrls", skip_serializing_if = "Option::is_none")]
    pub final_urls: Option<Vec<String>>,
    /// Primary thumbnail/image URL
    #[serde(
        rename = "thumbnailUrl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub thumbnail_url: Option<Option<String>>,
    /// Alternative image URL
    #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")]
    pub image_url: Option<String>,
    /// Google Display only. Resource name of the landscape marketing image asset (`creative.imageUrl`), for example customers/1234567890/assets/123. Set at creation and updated when PUT /v1/ads/{adId} replaces `creative.imageUrl`; replacing only `creative.squareImageUrl` leaves it unchanged.
    #[serde(rename = "assetResourceName", skip_serializing_if = "Option::is_none")]
    pub asset_resource_name: Option<String>,
    #[serde(rename = "assets", skip_serializing_if = "Option::is_none")]
    pub assets: Option<Box<models::AdCreativeAssets>>,
    /// Meta video ID for VIDEO-type ads (TikTok: the ad library `video_id`). Null for non-video ads. Callers that need an embeddable MP4 can call GET /{videoId}?fields=source with the page access token.
    #[serde(
        rename = "videoId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub video_id: Option<Option<String>>,
    /// Public Facebook watch URL for VIDEO-type ads (https://www.facebook.com/watch/?v={videoId}). Null for non-video ads.
    #[serde(
        rename = "videoUrl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub video_url: Option<Option<String>>,
    /// Meta ad creative id backing this ad, refreshed from Meta on every sync. Reusable via existingCreativeId on POST /v1/ads/create, and readable raw through GET /v1/ads/creatives/{creativeId}. Ads synced from Meta also carry it as the legacy `id` key.
    #[serde(
        rename = "creativeId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub creative_id: Option<Option<String>>,
    /// Meta only. The creativeFeatures map sent at creation (degrees_of_freedom_spec.creative_features_spec). Absent on ads synced from Meta.
    #[serde(rename = "creativeFeatures", skip_serializing_if = "Option::is_none")]
    pub creative_features: Option<CreativeFeatures>,
    #[serde(rename = "catalog", skip_serializing_if = "Option::is_none")]
    pub catalog: Option<Box<models::AdCreativeCatalog>>,
    /// Meta creative object_type (e.g. SHARE, VIDEO, PRIVACY_CHECK_FAIL, POST_DELETED). Use this to render state-aware previews: when Meta moderation strips image/video fields, only thumbnailUrl at 64x64 is available.
    #[serde(rename = "objectType", skip_serializing_if = "Option::is_none")]
    pub object_type: Option<String>,
    /// Meta creative `object_story_id` (the SHARE reference). Frequently absent, because Meta omits it for SHARE creatives. Use effectiveObjectStoryId instead.
    #[serde(
        rename = "objectStoryId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub object_story_id: Option<Option<String>>,
    /// Meta `effective_object_story_id`, the `{pageId}_{postId}` of the Facebook post the ad's engagement (comments) lives on. Pass to GET /v1/ads?effectiveObjectStoryId= to map a Business-Manager-visible post back to this ad; GET /v1/ads/{adId}/comments resolves comments against it.
    #[serde(
        rename = "effectiveObjectStoryId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub effective_object_story_id: Option<Option<String>>,
    /// Facebook Page backing the creative (Meta only). What the `pageId` filter on /v1/ads, /v1/ads/campaigns and /v1/ads/tree matches against. Absent for non-Meta ads and rare Meta creatives with no page signal.
    #[serde(
        rename = "pageId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub page_id: Option<Option<String>>,
    /// Meta `effective_instagram_media_id`, the Instagram media ID of the boosted post the ad's engagement lives on. Pass to GET /v1/ads?effectiveInstagramMediaId= to map a Business-Manager-visible IG post back to this ad.
    #[serde(
        rename = "effectiveInstagramMediaId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub effective_instagram_media_id: Option<Option<String>>,
    /// Meta `instagram_user_id`, the Instagram-scoped business ID that owns the boosted media.
    #[serde(
        rename = "instagramUserId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub instagram_user_id: Option<Option<String>>,
    /// Meta `instagram_permalink_url`, the public Instagram post URL of the boosted media.
    #[serde(
        rename = "instagramPermalinkUrl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub instagram_permalink_url: Option<Option<String>>,
    /// All media URLs for this ad (carousel images, multiple assets). Populated for Meta (carousel child_attachments), Google Ads (responsive display marketing_images), and LinkedIn (multi-image posts).
    #[serde(rename = "mediaUrls", skip_serializing_if = "Option::is_none")]
    pub media_urls: Option<Vec<String>>,
    /// Meta only today. The carousel's cards in display order, one per Meta `link_data.child_attachments` entry, using the same field names as the `carouselCards` create input. Absent on non-carousel ads and other platforms.  - Synced from Meta: `imageUrl` is resolved exactly like `mediaUrls` (the stable `/adimages` permalink first), so cards with an image line up with `mediaUrls` in order. A card whose image Meta does not resolve keeps its place without `imageUrl`. - Created through Zernio: starts as the cards you sent. - Synced carousels stored before this field existed fill it in on their next sync.
    #[serde(rename = "carouselCards", skip_serializing_if = "Option::is_none")]
    pub carousel_cards: Option<Vec<models::AdCreativeCarouselCardsInner>>,
    /// LinkedIn only. Whether LinkedIn is currently serving this specific creative. Complements the ad-level `servingStatuses`, which describes the parent campaign.
    #[serde(
        rename = "isServing",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub is_serving: Option<Option<bool>>,
    /// LinkedIn (and TikTok with `live=true`). The LinkedIn ad format, in LinkedIn's own vocabulary: STANDARD_UPDATE, SINGLE_VIDEO, CAROUSEL, NATIVE_DOCUMENT, EVENT, TEXT_AD, SPOTLIGHT, FOLLOW_COMPANY, JOBS, SPONSORED_INMAILS and others. The list is open, so treat an unrecognized value as valid.  - On an ad Zernio created: the format it was created as. - On an ad synced from Campaign Manager: the parent campaign's raw `format`, which is what LinkedIn actually enforces on its creatives.  Absent on LinkedIn ads not yet re-synced. On TikTok with `live=true`: the ad's `ad_format` (e.g. SINGLE_VIDEO). Absent on every other platform.
    #[serde(
        rename = "adFormat",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub ad_format: Option<Option<String>>,
    /// LinkedIn only. Why this specific creative is not being served. Empty when it is serving.  A superset of the ad-level `servingStatuses`: it repeats the inherited campaign, campaign group and account holds AND adds creative-only causes, such as:  - UNDER_REVIEW, REJECTED, PROCESSING, PROCESSING_FAILED; - FORM_HOLD (lead-gen-form creatives); - REFERRED_CONTENT_QUALITY_HOLD; - JOB_POSTING_ON_HOLD and JOB_POSTING_INVALID (job ads).  Some values are format-specific and will never appear on other ad formats. The list is open, so treat unrecognized values as holds rather than errors.
    #[serde(rename = "servingHoldReasons", skip_serializing_if = "Option::is_none")]
    pub serving_hold_reasons: Option<Vec<String>>,
    /// Ad copy/text
    #[serde(rename = "body", skip_serializing_if = "Option::is_none")]
    pub body: Option<String>,
    /// Google Ads headline
    #[serde(rename = "googleHeadline", skip_serializing_if = "Option::is_none")]
    pub google_headline: Option<String>,
    /// Google Ads description
    #[serde(rename = "googleDescription", skip_serializing_if = "Option::is_none")]
    pub google_description: Option<String>,
    /// Google only. YouTube video ids behind a Video campaign ad (video and responsive video ads) or a Demand Gen video ad, same id as `youtubeVideoId` on Performance Max asset groups. When the ad has no image, `thumbnailUrl` is the first video's YouTube thumbnail. Absent on ads without a video.
    #[serde(rename = "youtubeVideoIds", skip_serializing_if = "Option::is_none")]
    pub youtube_video_ids: Option<Vec<String>>,
    /// Destination URL
    #[serde(rename = "linkUrl", skip_serializing_if = "Option::is_none")]
    pub link_url: Option<String>,
    /// Explicit E.164 WhatsApp number supplied when creating a Meta boost or messaging ad. Absent when omitted by the caller or on older records.
    #[serde(
        rename = "whatsappPhoneNumber",
        skip_serializing_if = "Option::is_none"
    )]
    pub whatsapp_phone_number: Option<String>,
    #[serde(
        rename = "instagramVideoFallback",
        skip_serializing_if = "Option::is_none"
    )]
    pub instagram_video_fallback: Option<Box<models::InstagramVideoFallback>>,
    #[serde(rename = "pinterestImageUrl", skip_serializing_if = "Option::is_none")]
    pub pinterest_image_url: Option<String>,
    #[serde(rename = "pinterestTitle", skip_serializing_if = "Option::is_none")]
    pub pinterest_title: Option<String>,
    #[serde(
        rename = "pinterestDescription",
        skip_serializing_if = "Option::is_none"
    )]
    pub pinterest_description: Option<String>,
}

impl AdCreative {
    /// Platform-specific creative data. Fields vary by platform.
    pub fn new() -> AdCreative {
        AdCreative {
            asset_group: None,
            asset_group_resource_name: None,
            headlines: None,
            descriptions: None,
            headline: None,
            bodies: None,
            description: None,
            call_to_action: None,
            identity_id: None,
            identity_type: None,
            identity_authorized_bc_id: None,
            tiktok_item_id: None,
            lead_gen_form_id: None,
            image_hash: None,
            url_tags: None,
            final_urls: None,
            thumbnail_url: None,
            image_url: None,
            asset_resource_name: None,
            assets: None,
            video_id: None,
            video_url: None,
            creative_id: None,
            creative_features: None,
            catalog: None,
            object_type: None,
            object_story_id: None,
            effective_object_story_id: None,
            page_id: None,
            effective_instagram_media_id: None,
            instagram_user_id: None,
            instagram_permalink_url: None,
            media_urls: None,
            carousel_cards: None,
            is_serving: None,
            ad_format: None,
            serving_hold_reasons: None,
            body: None,
            google_headline: None,
            google_description: None,
            youtube_video_ids: None,
            link_url: None,
            whatsapp_phone_number: None,
            instagram_video_fallback: None,
            pinterest_image_url: None,
            pinterest_title: None,
            pinterest_description: None,
        }
    }
}
/// Meta only. The creativeFeatures map sent at creation (degrees_of_freedom_spec.creative_features_spec). Absent on ads synced from Meta.
#[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
    }
}