late 0.0.1411

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.650.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 SalesforceSettings {
    /// Zernio account ID of the Salesforce connection.
    #[serde(rename = "_id")]
    pub _id: String,
    #[serde(rename = "platform")]
    pub platform: Platform,
    /// 18-character Salesforce organization ID.
    #[serde(rename = "orgId")]
    pub org_id: String,
    /// The org's name, when the connected user can read it.
    #[serde(rename = "orgName", deserialize_with = "Option::deserialize")]
    pub org_name: Option<String>,
    /// Whether the org was connected through login.salesforce.com or test.salesforce.com.
    #[serde(rename = "environment")]
    pub environment: Environment,
    /// The org's API host, for example `https://acme.my.salesforce.com`.
    #[serde(rename = "instanceUrl")]
    pub instance_url: String,
    /// Email or username of the Salesforce user who connected the org.
    #[serde(rename = "installedBy", deserialize_with = "Option::deserialize")]
    pub installed_by: Option<String>,
    /// Whether Zernio creates a Lead or Contact (per `createAs`) for an inbox contact that matches nobody by phone or email.
    #[serde(rename = "syncContacts")]
    pub sync_contacts: bool,
    /// Whether Zernio logs inbox messages. Each person, channel and UTC day gets one completed Task (subject `WhatsApp conversation ยท 2026-11-17`) whose Description holds the transcript; a day past 32,000 characters continues in a Task marked \"(part 2)\".
    #[serde(rename = "logMessages")]
    pub log_messages: bool,
    /// What a person new to Salesforce is created as.
    #[serde(rename = "createAs")]
    pub create_as: CreateAs,
    /// Whether sent messages in the transcript are marked delivered, read or failed.
    #[serde(rename = "logDeliveryStatus")]
    pub log_delivery_status: bool,
    #[serde(rename = "syncIssue")]
    pub sync_issue: Box<models::SalesforceSettingsSyncIssue>,
    /// Whether closed-won Opportunities count as sales (Amount, in the Opportunity's or the org's currency) on the ad campaign named by their Primary Campaign Source, in campaign results and ad rules. Lost or reopened Opportunities stop counting.
    #[serde(rename = "useOpportunitiesInResults")]
    pub use_opportunities_in_results: bool,
    /// Whether Zernio sends newly closed-won Opportunities as Purchase events (source `salesforce`) to the profile's event destinations.
    #[serde(rename = "reportOpportunitiesToAds")]
    pub report_opportunities_to_ads: bool,
}

impl SalesforceSettings {
    pub fn new(
        _id: String,
        platform: Platform,
        org_id: String,
        org_name: Option<String>,
        environment: Environment,
        instance_url: String,
        installed_by: Option<String>,
        sync_contacts: bool,
        log_messages: bool,
        create_as: CreateAs,
        log_delivery_status: bool,
        sync_issue: models::SalesforceSettingsSyncIssue,
        use_opportunities_in_results: bool,
        report_opportunities_to_ads: bool,
    ) -> SalesforceSettings {
        SalesforceSettings {
            _id,
            platform,
            org_id,
            org_name,
            environment,
            instance_url,
            installed_by,
            sync_contacts,
            log_messages,
            create_as,
            log_delivery_status,
            sync_issue: Box::new(sync_issue),
            use_opportunities_in_results,
            report_opportunities_to_ads,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Platform {
    #[serde(rename = "salesforce")]
    Salesforce,
}

impl Default for Platform {
    fn default() -> Platform {
        Self::Salesforce
    }
}
/// Whether the org was connected through login.salesforce.com or test.salesforce.com.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Environment {
    #[serde(rename = "production")]
    Production,
    #[serde(rename = "sandbox")]
    Sandbox,
}

impl Default for Environment {
    fn default() -> Environment {
        Self::Production
    }
}
/// What a person new to Salesforce is created as.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CreateAs {
    #[serde(rename = "lead")]
    Lead,
    #[serde(rename = "contact")]
    Contact,
}

impl Default for CreateAs {
    fn default() -> CreateAs {
        Self::Lead
    }
}