/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * 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};

/// CreateStandaloneAdRequestPromotedObject : What the ad optimises against. Behaviour depends on the platform.  **Meta**: forwarded to the ad set's `promoted_object` (snake-cased). Required for goals whose ad-set optimization_goal points at a specific event/page/app (without it Meta rejects the ad-set create with `error_subcode: 1815430` \"Please select a promoted object for your ad set\"):   - `goal: conversions` (OFFSITE_CONVERSIONS): requires `pixelId` + `customEventType`   - `goal: app_promotion` (APP_INSTALLS): requires `applicationId` + `objectStoreUrl`   - `goal: lead_generation` (LEAD_GENERATION): `pageId` is auto-filled from the connected Page when omitted  Other Meta goals (engagement, traffic, awareness, video_views) ignore this field.  **TikTok**: only `goal: conversions` uses it.   - `pixelId` maps to the ad group's `pixel_id`. Required: a TikTok website-conversion     ad group without a pixel is rejected with `40002: Please select a pixel`.   - `customEventType` maps to the ad group's `optimization_event` (the pixel event to     optimise for). Optional: TikTok accepts a pixel-only auto-bid conversion ad group.     See the `customEventType` field below for the valid TikTok codes.  The remaining `promotedObject.*` fields are Meta-only. Platforms other than Meta and TikTok ignore `promotedObject` entirely.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateStandaloneAdRequestPromotedObject {
    /// Pixel ID. **Meta:** Facebook Pixel ID, required for `goal: conversions`. **TikTok:** TikTok Pixel ID, required for `goal: conversions`.
    #[serde(rename = "pixelId", skip_serializing_if = "Option::is_none")]
    pub pixel_id: Option<String>,
    /// The event the campaign/ad group optimises against.  **Meta:** standard event like `PURCHASE`, `LEAD`, `COMPLETE_REGISTRATION`, `ADD_TO_CART`. Uppercased internally so callers can pass any case. Required for `goal: conversions`.  **TikTok:** an `optimization_event` code (UPPER_SNAKE, not Meta's vocabulary and not PascalCase), e.g. `ON_WEB_ORDER` (Complete Payment), `INITIATE_ORDER` (Place an Order), `ON_WEB_CART` (Add to Cart), `ON_WEB_REGISTER` (Complete Registration), `FORM` (Submit Form), `ON_WEB_DETAIL` (View Content). Must be one of the events your TikTok Pixel is configured to track; passed through verbatim and validated by TikTok. Optional for `goal: conversions`.
    #[serde(rename = "customEventType", skip_serializing_if = "Option::is_none")]
    pub custom_event_type: Option<String>,
    /// Facebook Page ID. Used by `goal: lead_generation`. Auto-filled from the connected Page when omitted.
    #[serde(rename = "pageId", skip_serializing_if = "Option::is_none")]
    pub page_id: Option<String>,
    /// App ID. Required for `goal: app_promotion`.
    #[serde(rename = "applicationId", skip_serializing_if = "Option::is_none")]
    pub application_id: Option<String>,
    /// App Store / Play Store listing URL. Required for `goal: app_promotion`.
    #[serde(rename = "objectStoreUrl", skip_serializing_if = "Option::is_none")]
    pub object_store_url: Option<String>,
    /// Custom Conversion ID, when optimising against one instead of a standard event.
    #[serde(rename = "customConversionId", skip_serializing_if = "Option::is_none")]
    pub custom_conversion_id: Option<String>,
    /// Catalog ID for catalog/Advantage+ Shopping campaigns.
    #[serde(rename = "productCatalogId", skip_serializing_if = "Option::is_none")]
    pub product_catalog_id: Option<String>,
    /// Product Set ID inside the catalog.
    #[serde(rename = "productSetId", skip_serializing_if = "Option::is_none")]
    pub product_set_id: Option<String>,
}

impl CreateStandaloneAdRequestPromotedObject {
    /// What the ad optimises against. Behaviour depends on the platform.  **Meta**: forwarded to the ad set's `promoted_object` (snake-cased). Required for goals whose ad-set optimization_goal points at a specific event/page/app (without it Meta rejects the ad-set create with `error_subcode: 1815430` \"Please select a promoted object for your ad set\"):   - `goal: conversions` (OFFSITE_CONVERSIONS): requires `pixelId` + `customEventType`   - `goal: app_promotion` (APP_INSTALLS): requires `applicationId` + `objectStoreUrl`   - `goal: lead_generation` (LEAD_GENERATION): `pageId` is auto-filled from the connected Page when omitted  Other Meta goals (engagement, traffic, awareness, video_views) ignore this field.  **TikTok**: only `goal: conversions` uses it.   - `pixelId` maps to the ad group's `pixel_id`. Required: a TikTok website-conversion     ad group without a pixel is rejected with `40002: Please select a pixel`.   - `customEventType` maps to the ad group's `optimization_event` (the pixel event to     optimise for). Optional: TikTok accepts a pixel-only auto-bid conversion ad group.     See the `customEventType` field below for the valid TikTok codes.  The remaining `promotedObject.*` fields are Meta-only. Platforms other than Meta and TikTok ignore `promotedObject` entirely.
    pub fn new() -> CreateStandaloneAdRequestPromotedObject {
        CreateStandaloneAdRequestPromotedObject {
            pixel_id: None,
            custom_event_type: None,
            page_id: None,
            application_id: None,
            object_store_url: None,
            custom_conversion_id: None,
            product_catalog_id: None,
            product_set_id: None,
        }
    }
}
