late 0.0.297

API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
Documentation
/*
 * Zernio API
 *
 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
 *
 * The version of the OpenAPI document: 1.0.4
 * Contact: support@zernio.com
 * Generated by: https://openapi-generator.tech
 */

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

/// WhatsAppSandboxSession : A per-user activation session against the shared WhatsApp sandbox number. Transitions `pending → active` when the inbound webhook receives a reply from the matching phone (the reply itself proves ownership).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WhatsAppSandboxSession {
    /// Session id. Use this to revoke via DELETE.
    #[serde(rename = "id")]
    pub id: String,
    /// Digits-only E.164 form (no +, spaces, or dashes).
    #[serde(rename = "phoneE164")]
    pub phone_e164: String,
    /// `pending` until the phone replies to the activation template, then `active`. Expired sessions are pruned by TTL and never appear in list responses.
    #[serde(rename = "status")]
    pub status: Status,
    /// UTC timestamp at which the session becomes invalid. Pending sessions get a 24h window; activated sessions get 7 days.
    #[serde(rename = "expiresAt")]
    pub expires_at: String,
    /// When the session transitioned `pending → active`, or null.
    #[serde(rename = "activatedAt", skip_serializing_if = "Option::is_none")]
    pub activated_at: Option<String>,
    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
}

impl WhatsAppSandboxSession {
    /// A per-user activation session against the shared WhatsApp sandbox number. Transitions `pending → active` when the inbound webhook receives a reply from the matching phone (the reply itself proves ownership).
    pub fn new(
        id: String,
        phone_e164: String,
        status: Status,
        expires_at: String,
    ) -> WhatsAppSandboxSession {
        WhatsAppSandboxSession {
            id,
            phone_e164,
            status,
            expires_at,
            activated_at: None,
            created_at: None,
        }
    }
}
/// `pending` until the phone replies to the activation template, then `active`. Expired sessions are pruned by TTL and never appear in list responses.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "active")]
    Active,
}

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