/*
 * 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.1
 * 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 CreateAdAudienceRequest {
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Must start with act_
    #[serde(rename = "adAccountId")]
    pub ad_account_id: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Required for website audiences
    #[serde(rename = "pixelId", skip_serializing_if = "Option::is_none")]
    pub pixel_id: Option<String>,
    /// Required for website audiences
    #[serde(rename = "retentionDays", skip_serializing_if = "Option::is_none")]
    pub retention_days: Option<i32>,
    /// Required for lookalike audiences
    #[serde(rename = "sourceAudienceId", skip_serializing_if = "Option::is_none")]
    pub source_audience_id: Option<String>,
    /// 2-letter code, required for lookalike audiences
    #[serde(rename = "country", skip_serializing_if = "Option::is_none")]
    pub country: Option<String>,
    /// Required for lookalike audiences
    #[serde(rename = "ratio", skip_serializing_if = "Option::is_none")]
    pub ratio: Option<f64>,
    /// Pixel event rule for website audiences (optional)
    #[serde(rename = "rule", skip_serializing_if = "Option::is_none")]
    pub rule: Option<serde_json::Value>,
    /// Data source declaration for GDPR compliance (customer_list only)
    #[serde(rename = "customerFileSource", skip_serializing_if = "Option::is_none")]
    pub customer_file_source: Option<String>,
}

impl CreateAdAudienceRequest {
    pub fn new(
        account_id: String,
        ad_account_id: String,
        name: String,
        r#type: Type,
    ) -> CreateAdAudienceRequest {
        CreateAdAudienceRequest {
            account_id,
            ad_account_id,
            name,
            description: None,
            r#type,
            pixel_id: None,
            retention_days: None,
            source_audience_id: None,
            country: None,
            ratio: None,
            rule: None,
            customer_file_source: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "customer_list")]
    CustomerList,
    #[serde(rename = "website")]
    Website,
    #[serde(rename = "lookalike")]
    Lookalike,
}

impl Default for Type {
    fn default() -> Type {
        Self::CustomerList
    }
}
