late 0.0.1142

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.237.0
 * 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 CreateConversionActionRequest {
    /// SocialAccount ID. Must be a `googleads` account.
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Platform ad account ID (Google customer ID, digits only). Resolved automatically when the connection has exactly one accessible customer.
    #[serde(rename = "adAccountId", skip_serializing_if = "Option::is_none")]
    pub ad_account_id: Option<String>,
    /// Alias of adAccountId, kept for existing callers
    #[serde(rename = "customerId", skip_serializing_if = "Option::is_none")]
    pub customer_id: Option<String>,
    #[serde(rename = "name")]
    pub name: String,
    /// Only WEBPAGE is supported for creation today.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Default conversion value used when an event doesn't carry its own value.
    #[serde(rename = "defaultValue", skip_serializing_if = "Option::is_none")]
    pub default_value: Option<f64>,
    /// When true, always use defaultValue and ignore any value sent with the event. Defaults to true when defaultValue is set.
    #[serde(
        rename = "alwaysUseDefaultValue",
        skip_serializing_if = "Option::is_none"
    )]
    pub always_use_default_value: Option<bool>,
    /// conversion_action.category. Defaults to DEFAULT on create.
    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
    pub category: Option<Category>,
    /// ONE_PER_CLICK counts one conversion per ad click (leads); MANY_PER_CLICK counts every one (purchases).
    #[serde(rename = "countingType", skip_serializing_if = "Option::is_none")]
    pub counting_type: Option<CountingType>,
    /// ISO 4217 currency of defaultValue (value_settings.default_currency_code).
    #[serde(rename = "defaultCurrency", skip_serializing_if = "Option::is_none")]
    pub default_currency: Option<String>,
    /// Days after an ad click a conversion still counts.
    #[serde(
        rename = "clickThroughLookbackWindowDays",
        skip_serializing_if = "Option::is_none"
    )]
    pub click_through_lookback_window_days: Option<i32>,
    /// Days after an ad view a view-through conversion still counts.
    #[serde(
        rename = "viewThroughLookbackWindowDays",
        skip_serializing_if = "Option::is_none"
    )]
    pub view_through_lookback_window_days: Option<i32>,
    /// true = primary (counts toward bidding when its goal is biddable), false = secondary.
    #[serde(rename = "primaryForGoal", skip_serializing_if = "Option::is_none")]
    pub primary_for_goal: Option<bool>,
}

impl CreateConversionActionRequest {
    pub fn new(account_id: String, name: String, r#type: Type) -> CreateConversionActionRequest {
        CreateConversionActionRequest {
            account_id,
            ad_account_id: None,
            customer_id: None,
            name,
            r#type,
            default_value: None,
            always_use_default_value: None,
            category: None,
            counting_type: None,
            default_currency: None,
            click_through_lookback_window_days: None,
            view_through_lookback_window_days: None,
            primary_for_goal: None,
        }
    }
}
/// Only WEBPAGE is supported for creation today.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "WEBPAGE")]
    Webpage,
}

impl Default for Type {
    fn default() -> Type {
        Self::Webpage
    }
}
/// conversion_action.category. Defaults to DEFAULT on create.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "DEFAULT")]
    Default,
    #[serde(rename = "PAGE_VIEW")]
    PageView,
    #[serde(rename = "PURCHASE")]
    Purchase,
    #[serde(rename = "SIGNUP")]
    Signup,
    #[serde(rename = "DOWNLOAD")]
    Download,
    #[serde(rename = "ADD_TO_CART")]
    AddToCart,
    #[serde(rename = "BEGIN_CHECKOUT")]
    BeginCheckout,
    #[serde(rename = "SUBSCRIBE_PAID")]
    SubscribePaid,
    #[serde(rename = "PHONE_CALL_LEAD")]
    PhoneCallLead,
    #[serde(rename = "IMPORTED_LEAD")]
    ImportedLead,
    #[serde(rename = "SUBMIT_LEAD_FORM")]
    SubmitLeadForm,
    #[serde(rename = "BOOK_APPOINTMENT")]
    BookAppointment,
    #[serde(rename = "REQUEST_QUOTE")]
    RequestQuote,
    #[serde(rename = "GET_DIRECTIONS")]
    GetDirections,
    #[serde(rename = "OUTBOUND_CLICK")]
    OutboundClick,
    #[serde(rename = "CONTACT")]
    Contact,
    #[serde(rename = "ENGAGEMENT")]
    Engagement,
    #[serde(rename = "STORE_VISIT")]
    StoreVisit,
    #[serde(rename = "STORE_SALE")]
    StoreSale,
    #[serde(rename = "QUALIFIED_LEAD")]
    QualifiedLead,
    #[serde(rename = "CONVERTED_LEAD")]
    ConvertedLead,
}

impl Default for Category {
    fn default() -> Category {
        Self::Default
    }
}
/// ONE_PER_CLICK counts one conversion per ad click (leads); MANY_PER_CLICK counts every one (purchases).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CountingType {
    #[serde(rename = "ONE_PER_CLICK")]
    OnePerClick,
    #[serde(rename = "MANY_PER_CLICK")]
    ManyPerClick,
}

impl Default for CountingType {
    fn default() -> CountingType {
        Self::OnePerClick
    }
}