/*
* 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.104.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Verification : A managed OTP verification. The code itself is never returned or stored (hash only).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Verification {
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
#[serde(rename = "channel", skip_serializing_if = "Option::is_none")]
pub channel: Option<Channel>,
#[serde(rename = "to", skip_serializing_if = "Option::is_none")]
pub to: Option<String>,
#[serde(rename = "expiresAt", skip_serializing_if = "Option::is_none")]
pub expires_at: Option<String>,
#[serde(rename = "attempts", skip_serializing_if = "Option::is_none")]
pub attempts: Option<i32>,
#[serde(rename = "maxAttempts", skip_serializing_if = "Option::is_none")]
pub max_attempts: Option<i32>,
/// Accepted deliveries (initial send + resends); each bills one verification fee.
#[serde(rename = "sendCount", skip_serializing_if = "Option::is_none")]
pub send_count: Option<i32>,
#[serde(
rename = "lastSentAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_sent_at: Option<Option<String>>,
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
/// Present on create responses: true when an active verification was resent instead of created.
#[serde(rename = "resend", skip_serializing_if = "Option::is_none")]
pub resend: Option<bool>,
}
impl Verification {
/// A managed OTP verification. The code itself is never returned or stored (hash only).
pub fn new() -> Verification {
Verification {
id: None,
status: None,
channel: None,
to: None,
expires_at: None,
attempts: None,
max_attempts: None,
send_count: None,
last_sent_at: None,
created_at: None,
resend: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "approved")]
Approved,
#[serde(rename = "expired")]
Expired,
#[serde(rename = "max_attempts_reached")]
MaxAttemptsReached,
#[serde(rename = "canceled")]
Canceled,
#[serde(rename = "delivery_failed")]
DeliveryFailed,
}
impl Default for Status {
fn default() -> Status {
Self::Pending
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Channel {
#[serde(rename = "sms")]
Sms,
}
impl Default for Channel {
fn default() -> Channel {
Self::Sms
}
}