/*
* 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.404.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 EstimateAdReachRequest {
/// Zernio account ID on the target ad platform (the estimate runs against its platform).
#[serde(rename = "accountId")]
pub account_id: String,
/// Required. The platform ad-account ID the reach call runs against (Meta act_..., LinkedIn numeric sponsoredAccount ID, Pinterest ad-account ID, X account ID) - every backing reach API is scoped to one ad account. Get it from GET /v1/ads/accounts.
#[serde(rename = "adAccountId")]
pub ad_account_id: String,
/// The targeting spec to estimate. Same shape used by POST /v1/ads/create. Required unless `rawTargeting` is sent; with `rawTargeting` it can be omitted or minimal.
#[serde(
rename = "spec",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub spec: Option<Option<Box<models::TargetingSpec>>>,
/// Meta only. A Meta-native targeting spec (snake_case: `geo_locations`, `age_min`, `flexible_spec`, `excluded_custom_audiences`, `user_os`, ...), the same field `POST /v1/ads/create` accepts, so the estimate covers the exact audience the ad set will use. For layered targeting, send `flexible_spec` here: entries AND together, ids inside one entry OR. It uses the same merge rules as `POST /v1/ads/create`: rawTargeting is the BASE layer and `spec`, converted to Meta's wire shape, is merged on top key by key, with `spec` winning on collision. The merge goes one level deep inside `geo_locations` and `excluded_geo_locations` (spec sub-keys win, raw-only sub-keys such as `location_types` survive). Array values (`flexible_spec`, ...) are replaced as a whole key when `spec` builds them, never element-merged, so `spec.interests` or `spec.behaviors` replace a raw `flexible_spec`. The result is sent to Meta `delivery_estimate` as `targeting_spec`. Sending it for an account on another platform returns 400 naming `rawTargeting`.
#[serde(rename = "rawTargeting", skip_serializing_if = "Option::is_none")]
pub raw_targeting: Option<std::collections::HashMap<String, serde_json::Value>>,
/// Optional. The optimization goal the estimate should assume (platform's own vocabulary, e.g. Meta `REACH`, `LINK_CLICKS`, `OFFSITE_CONVERSIONS`). Some platforms vary the estimate by goal; omit to use the platform default.
#[serde(rename = "optimizationGoal", skip_serializing_if = "Option::is_none")]
pub optimization_goal: Option<String>,
}
impl EstimateAdReachRequest {
pub fn new(account_id: String, ad_account_id: String) -> EstimateAdReachRequest {
EstimateAdReachRequest {
account_id,
ad_account_id,
spec: None,
raw_targeting: None,
optimization_goal: None,
}
}
}