late 0.0.297

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateConversionDestinationRequest {
    /// Sponsored ad account ID. Numeric (e.g. \"5123456\") or full `urn:li:sponsoredAccount:{id}` URN.
    #[serde(rename = "adAccountId")]
    pub ad_account_id: String,
    #[serde(rename = "name")]
    pub name: String,
    /// Either a unified standard event name (e.g. \"Purchase\", \"Lead\", \"AddToCart\") or a LinkedIn rule type enum value (e.g. \"PURCHASE\", \"QUALIFIED_LEAD\"). The API maps standard names to LinkedIn enum values automatically.
    #[serde(rename = "type")]
    pub r#type: String,
    #[serde(rename = "attributionType", skip_serializing_if = "Option::is_none")]
    pub attribution_type: Option<AttributionType>,
    /// Default 30. 365 only allowed for LEAD, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, SUBMIT_APPLICATION rule types — the API rejects other combinations locally.
    #[serde(
        rename = "postClickAttributionWindowSize",
        skip_serializing_if = "Option::is_none"
    )]
    pub post_click_attribution_window_size: Option<PostClickAttributionWindowSize>,
    /// Default 7. Same 365-day-window type restriction applies as `postClickAttributionWindowSize`.
    #[serde(
        rename = "viewThroughAttributionWindowSize",
        skip_serializing_if = "Option::is_none"
    )]
    pub view_through_attribution_window_size: Option<ViewThroughAttributionWindowSize>,
    /// DYNAMIC (default) uses the per-event `value` from `sendConversions`. FIXED uses the rule's `value` field. NO_VALUE drops monetary value entirely.
    #[serde(rename = "valueType", skip_serializing_if = "Option::is_none")]
    pub value_type: Option<ValueType>,
    #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
    pub value: Option<Box<models::CreateConversionDestinationRequestValue>>,
    /// Controls campaign association at rule-creation time: - ALL_CAMPAIGNS: associate the rule with every active,   paused, and draft campaign in the ad account - OBJECTIVE_BASED: associate only campaigns whose   objective matches the rule's type - NONE: don't auto-associate. Manage associations via   the `/associations` endpoints below. Note: auto-association runs once at create time; new campaigns added after the rule still need explicit association.
    #[serde(
        rename = "autoAssociationType",
        skip_serializing_if = "Option::is_none"
    )]
    pub auto_association_type: Option<AutoAssociationType>,
}

impl CreateConversionDestinationRequest {
    pub fn new(
        ad_account_id: String,
        name: String,
        r#type: String,
    ) -> CreateConversionDestinationRequest {
        CreateConversionDestinationRequest {
            ad_account_id,
            name,
            r#type,
            attribution_type: None,
            post_click_attribution_window_size: None,
            view_through_attribution_window_size: None,
            value_type: None,
            value: None,
            auto_association_type: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AttributionType {
    #[serde(rename = "LAST_TOUCH_BY_CAMPAIGN")]
    LastTouchByCampaign,
    #[serde(rename = "LAST_TOUCH_BY_CONVERSION")]
    LastTouchByConversion,
}

impl Default for AttributionType {
    fn default() -> AttributionType {
        Self::LastTouchByCampaign
    }
}
/// Default 30. 365 only allowed for LEAD, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, SUBMIT_APPLICATION rule types — the API rejects other combinations locally.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PostClickAttributionWindowSize {
    #[serde(rename = "1")]
    Variant1,
    #[serde(rename = "7")]
    Variant7,
    #[serde(rename = "30")]
    Variant30,
    #[serde(rename = "90")]
    Variant90,
    #[serde(rename = "365")]
    Variant365,
}

impl Default for PostClickAttributionWindowSize {
    fn default() -> PostClickAttributionWindowSize {
        Self::Variant1
    }
}
/// Default 7. Same 365-day-window type restriction applies as `postClickAttributionWindowSize`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ViewThroughAttributionWindowSize {
    #[serde(rename = "1")]
    Variant1,
    #[serde(rename = "7")]
    Variant7,
    #[serde(rename = "30")]
    Variant30,
    #[serde(rename = "90")]
    Variant90,
    #[serde(rename = "365")]
    Variant365,
}

impl Default for ViewThroughAttributionWindowSize {
    fn default() -> ViewThroughAttributionWindowSize {
        Self::Variant1
    }
}
/// DYNAMIC (default) uses the per-event `value` from `sendConversions`. FIXED uses the rule's `value` field. NO_VALUE drops monetary value entirely.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ValueType {
    #[serde(rename = "DYNAMIC")]
    Dynamic,
    #[serde(rename = "FIXED")]
    Fixed,
    #[serde(rename = "NO_VALUE")]
    NoValue,
}

impl Default for ValueType {
    fn default() -> ValueType {
        Self::Dynamic
    }
}
/// Controls campaign association at rule-creation time: - ALL_CAMPAIGNS: associate the rule with every active,   paused, and draft campaign in the ad account - OBJECTIVE_BASED: associate only campaigns whose   objective matches the rule's type - NONE: don't auto-associate. Manage associations via   the `/associations` endpoints below. Note: auto-association runs once at create time; new campaigns added after the rule still need explicit association.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AutoAssociationType {
    #[serde(rename = "ALL_CAMPAIGNS")]
    AllCampaigns,
    #[serde(rename = "OBJECTIVE_BASED")]
    ObjectiveBased,
    #[serde(rename = "NONE")]
    None,
}

impl Default for AutoAssociationType {
    fn default() -> AutoAssociationType {
        Self::AllCampaigns
    }
}