/*
* 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.429.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 AdLead {
/// Zernio lead id.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Meta lead id. On LinkedIn, the leadFormResponse id.
#[serde(rename = "leadgenId", skip_serializing_if = "Option::is_none")]
pub leadgen_id: Option<String>,
#[serde(rename = "formId", skip_serializing_if = "Option::is_none")]
pub form_id: Option<String>,
#[serde(
rename = "formName",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub form_name: Option<Option<String>>,
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(
rename = "adId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub ad_id: Option<Option<String>>,
#[serde(
rename = "adsetId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub adset_id: Option<Option<String>>,
/// On LinkedIn, this is the LinkedIn Campaign id, which corresponds to platformAdSetId on GET /v1/ads (LinkedIn's Campaign Group is Zernio's campaign).
#[serde(
rename = "campaignId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub campaign_id: Option<Option<String>>,
#[serde(rename = "isOrganic", skip_serializing_if = "Option::is_none")]
pub is_organic: Option<bool>,
/// ISO 8601.
#[serde(
rename = "createdTime",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_time: Option<Option<String>>,
/// Question key → answer. On LinkedIn, the key is the lowercased predefinedField, else the question name, else the numeric questionId; multiple-choice values are option labels (unlike Meta, which returns the option key).
#[serde(rename = "fields", skip_serializing_if = "Option::is_none")]
pub fields: Option<std::collections::HashMap<String, String>>,
/// Raw Meta field_data.
#[serde(rename = "fieldData", skip_serializing_if = "Option::is_none")]
pub field_data: Option<Vec<serde_json::Value>>,
/// Meta lead forms only: the answer to every custom disclaimer checkbox, required or optional. Empty when the form has none, and may be empty on leads stored before 2026-10-22. LinkedIn leads do not carry the field.
#[serde(rename = "consents", skip_serializing_if = "Option::is_none")]
pub consents: Option<Vec<models::AdLeadConsent>>,
/// Meta leads only. `contacted` is set when the first WhatsApp message of a lead_received workflow is delivered, `unreachable` when it fails or the phone number is not valid.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
#[serde(
rename = "statusChangedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status_changed_at: Option<Option<String>>,
#[serde(
rename = "value",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub value: Option<Option<f64>>,
#[serde(
rename = "currency",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub currency: Option<Option<String>>,
/// The contact a lead_received workflow created or matched for this lead.
#[serde(
rename = "contactId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub contact_id: Option<Option<String>>,
/// When the first WhatsApp message to the lead was delivered.
#[serde(
rename = "firstContactedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub first_contacted_at: Option<Option<String>>,
/// The Inbox conversation a lead_received workflow opened with the lead.
#[serde(
rename = "conversationId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub conversation_id: Option<Option<String>>,
/// Meta leads only. When the `lead.received` webhook was delivered; null while it has not been.
#[serde(
rename = "webhookDeliveredAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub webhook_delivered_at: Option<Option<String>>,
}
impl AdLead {
pub fn new() -> AdLead {
AdLead {
id: None,
leadgen_id: None,
form_id: None,
form_name: None,
account_id: None,
ad_id: None,
adset_id: None,
campaign_id: None,
is_organic: None,
created_time: None,
fields: None,
field_data: None,
consents: None,
status: None,
status_changed_at: None,
value: None,
currency: None,
contact_id: None,
first_contacted_at: None,
conversation_id: None,
webhook_delivered_at: None,
}
}
}
/// Meta leads only. `contacted` is set when the first WhatsApp message of a lead_received workflow is delivered, `unreachable` when it fails or the phone number is not valid.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "new")]
New,
#[serde(rename = "contacted")]
Contacted,
#[serde(rename = "unreachable")]
Unreachable,
#[serde(rename = "qualified")]
Qualified,
#[serde(rename = "converted")]
Converted,
#[serde(rename = "disqualified")]
Disqualified,
}
impl Default for Status {
fn default() -> Status {
Self::New
}
}