/*
* 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).
*
* The version of the OpenAPI document: 1.13.0
* 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",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub activated_at: Option<Option<String>>,
#[serde(
rename = "createdAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_at: Option<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
}
}