late 0.0.1385

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.605.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 CreateInboxConversationRequest {
    /// The account ID to send from
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// Recipient identifier. Provide either this or participantUsername.  - X: the numeric user ID. - WhatsApp and SMS: the recipient phone number in international format (digits, country code included). - Slack: the workspace member id (e.g. U01ABCDEF). - iMessage: a phone number in international format with the leading +, or an iMessage email.
    #[serde(rename = "participantId", skip_serializing_if = "Option::is_none")]
    pub participant_id: Option<String>,
    /// Recipient handle/username, an X or Bluesky handle (with or without @) or a Reddit username (with or without u/). Resolved via lookup. Provide either this or participantId.
    #[serde(
        rename = "participantUsername",
        skip_serializing_if = "Option::is_none"
    )]
    pub participant_username: Option<String>,
    /// Text content of the message. At least one of message, attachment, or (for WhatsApp) templateName is required. Required when category is set (a Direct Send utility message is a text message). Required on email accounts.
    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// Email accounts only (Google / Microsoft). Subject of the new thread.
    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
    pub subject: Option<String>,
    /// Email accounts only (Google / Microsoft). Extra recipients copied on the opening mail.
    #[serde(rename = "cc", skip_serializing_if = "Option::is_none")]
    pub cc: Option<Vec<String>>,
    /// X only. Skip the receives_your_dm eligibility check before sending. Use if you have already verified the recipient accepts DMs.
    #[serde(rename = "skipDmCheck", skip_serializing_if = "Option::is_none")]
    pub skip_dm_check: Option<bool>,
    /// WhatsApp only. Name of the approved template to start the conversation with. Required for WhatsApp unless category is used instead (Direct Send). Cannot be combined with category.
    #[serde(rename = "templateName", skip_serializing_if = "Option::is_none")]
    pub template_name: Option<String>,
    /// WhatsApp only (Meta Direct Send). Combined with message and without templateName, starts the conversation with a business-initiated UTILITY message and no pre-approved template. Meta matches or auto-creates a template asynchronously.  - The WhatsApp Business Account must be eligible for Direct Send; otherwise the send fails with an error telling you to use an approved message template instead. - Cannot be combined with templateName (templates are already categorized at creation). - Utility messages only: marketing content is not allowed under this category. - Accepted on the JSON body only, not on multipart requests.
    #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
    pub category: Option<Category>,
    /// WhatsApp only. Set false to send the Direct Send (category: 'utility') text message without a link-preview thumbnail for the first URL in the text.  Defaults to true, which is how every WhatsApp text has been sent to date. Does not apply to template sends. Accepted on the JSON body only, not on multipart requests.
    #[serde(rename = "linkPreview", skip_serializing_if = "Option::is_none")]
    pub link_preview: Option<bool>,
    /// WhatsApp only. Template language code (e.g. en_US).
    #[serde(rename = "templateLanguage", skip_serializing_if = "Option::is_none")]
    pub template_language: Option<String>,
    /// WhatsApp only. Template variable values as one flat array, in order of appearance across the whole template: text-header variables, then body variables, then one value per dynamic URL button (in button order).  Works with positional placeholders ({{1}}, {{2}}, ...) and named placeholders ({{name}}, {{company}}, as Meta Business Manager creates them); values fill named slots in order of appearance.  Example: a body with {{1}}, {{2}} plus a URL button https://example.com/{{1}} takes three values: [body1, body2, buttonSuffix].  For positional templates the list must cover every slot. Fewer values than the header + body + dynamic URL-button count is rejected with 400 (code INVALID_TEMPLATE_PARAMS) naming the expected split, rather than filling a button URL from the wrong value.  A dynamic URL button covered by templateButtonParams needs no value here, unless another uncovered dynamic URL button follows it (the override applies after slot numbering).  Take no value here:  - Media headers (image, video, document): filled automatically from the approved template. Use headerMedia to override the header asset per send. - Non-dynamic-URL buttons (copy-code, flow): use templateButtonParams.
    #[serde(rename = "templateParams", skip_serializing_if = "Option::is_none")]
    pub template_params: Option<Vec<String>>,
    /// WhatsApp only. Values for template buttons that take one at send time, each addressed by the button's position in the approved template.  This is the only way to send a copy-code button's payload (a Pix payment code, a coupon) or a flow token, since templateParams is a flat array of text variables covering dynamic URL buttons only.  - A button here overrides what templateParams would derive for that index, so no button is sent twice. - Repeating an index within this array is rejected with 400. - Each index must name a button of the matching kind on the approved template. This is checked before the send and returns 400 (INVALID_TEMPLATE_BUTTON_PARAM) rather than a Meta rejection.
    #[serde(
        rename = "templateButtonParams",
        skip_serializing_if = "Option::is_none"
    )]
    pub template_button_params:
        Option<Vec<models::CreateInboxConversationRequestTemplateButtonParamsInner>>,
    /// WhatsApp only. Per-card overrides for a CAROUSEL template, each addressed by the card's card_index.  Carousel card body variables restart at {{1}} per card, so they cannot be expressed in the flat templateParams slot order; use this instead.  Rejected with 400 (INVALID_TEMPLATE_CARD_PARAM): a cardIndex naming a card the approved template lacks, a duplicate cardIndex, or a params count that does not match the card body's token count.
    #[serde(rename = "templateCards", skip_serializing_if = "Option::is_none")]
    pub template_cards: Option<Vec<models::CreateInboxConversationRequestTemplateCardsInner>>,
    #[serde(rename = "headerMedia", skip_serializing_if = "Option::is_none")]
    pub header_media: Option<Box<models::CreateInboxConversationRequestHeaderMedia>>,
    #[serde(rename = "headerLocation", skip_serializing_if = "Option::is_none")]
    pub header_location: Option<Box<models::CreateInboxConversationRequestHeaderLocation>>,
}

impl CreateInboxConversationRequest {
    pub fn new(account_id: String) -> CreateInboxConversationRequest {
        CreateInboxConversationRequest {
            account_id,
            participant_id: None,
            participant_username: None,
            message: None,
            subject: None,
            cc: None,
            skip_dm_check: None,
            template_name: None,
            category: None,
            link_preview: None,
            template_language: None,
            template_params: None,
            template_button_params: None,
            template_cards: None,
            header_media: None,
            header_location: None,
        }
    }
}
/// WhatsApp only (Meta Direct Send). Combined with message and without templateName, starts the conversation with a business-initiated UTILITY message and no pre-approved template. Meta matches or auto-creates a template asynchronously.  - The WhatsApp Business Account must be eligible for Direct Send; otherwise the send fails with an error telling you to use an approved message template instead. - Cannot be combined with templateName (templates are already categorized at creation). - Utility messages only: marketing content is not allowed under this category. - Accepted on the JSON body only, not on multipart requests.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
    #[serde(rename = "utility")]
    Utility,
}

impl Default for Category {
    fn default() -> Category {
        Self::Utility
    }
}