late 0.0.1364

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.563.0
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ScheduledEmail : An email sent with `scheduledFor`. `status` moves scheduled, sending, then sent or failed; a cancelled one never leaves.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ScheduledEmail {
    /// The `scheduleId`.
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    #[serde(rename = "scheduledFor", skip_serializing_if = "Option::is_none")]
    pub scheduled_for: Option<String>,
    /// True when the email waits as a draft in the mailbox and is sent as that draft stands at `scheduledFor`.
    #[serde(rename = "holdAsDraft", skip_serializing_if = "Option::is_none")]
    pub hold_as_draft: Option<bool>,
    /// The mailbox draft of a `holdAsDraft` send: the Gmail draft id, or the Outlook message id. `null` otherwise.
    #[serde(
        rename = "draftId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub draft_id: Option<Option<String>>,
    #[serde(rename = "to", skip_serializing_if = "Option::is_none")]
    pub to: Option<Vec<models::EmailAddress>>,
    /// Empty on a reply that keeps the thread subject. `null` once the send finishes under zero content retention.
    #[serde(
        rename = "subject",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub subject: Option<Option<String>>,
    /// Present and `true` when the email content was dropped under [zero content retention](/security/zero-content-retention).
    #[serde(rename = "contentNotRetained", skip_serializing_if = "Option::is_none")]
    pub content_not_retained: Option<bool>,
    /// Set when scheduled through the reply route.
    #[serde(
        rename = "replyToMessageId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub reply_to_message_id: Option<Option<String>>,
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, String>>,
    #[serde(
        rename = "sentAt",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub sent_at: Option<Option<String>>,
    /// Provider id of the sent message once `status` is sent.
    #[serde(
        rename = "sentMessageId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub sent_message_id: Option<Option<String>>,
    #[serde(
        rename = "sentThreadId",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub sent_thread_id: Option<Option<String>>,
    /// Why a failed send did not leave.
    #[serde(
        rename = "error",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub error: Option<Option<String>>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
}

impl ScheduledEmail {
    /// An email sent with `scheduledFor`. `status` moves scheduled, sending, then sent or failed; a cancelled one never leaves.
    pub fn new() -> ScheduledEmail {
        ScheduledEmail {
            id: None,
            account_id: None,
            status: None,
            scheduled_for: None,
            hold_as_draft: None,
            draft_id: None,
            to: None,
            subject: None,
            content_not_retained: None,
            reply_to_message_id: None,
            metadata: None,
            sent_at: None,
            sent_message_id: None,
            sent_thread_id: None,
            error: None,
            created_at: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "scheduled")]
    Scheduled,
    #[serde(rename = "sending")]
    Sending,
    #[serde(rename = "sent")]
    Sent,
    #[serde(rename = "failed")]
    Failed,
    #[serde(rename = "cancelled")]
    Cancelled,
}

impl Default for Status {
    fn default() -> Status {
        Self::Scheduled
    }
}