/*
 * 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};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadCallEndedCall {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(rename = "metaCallId", skip_serializing_if = "Option::is_none")]
    pub meta_call_id: Option<String>,
    #[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
    pub account_id: Option<String>,
    #[serde(rename = "phoneNumberId", skip_serializing_if = "Option::is_none")]
    pub phone_number_id: Option<String>,
    #[serde(rename = "direction", skip_serializing_if = "Option::is_none")]
    pub direction: Option<Direction>,
    #[serde(rename = "from", skip_serializing_if = "Option::is_none")]
    pub from: Option<String>,
    #[serde(rename = "to", skip_serializing_if = "Option::is_none")]
    pub to: Option<String>,
    #[serde(rename = "startedAt", skip_serializing_if = "Option::is_none")]
    pub started_at: Option<String>,
    #[serde(rename = "endedAt", skip_serializing_if = "Option::is_none")]
    pub ended_at: Option<String>,
    #[serde(rename = "durationSeconds", skip_serializing_if = "Option::is_none")]
    pub duration_seconds: Option<i32>,
    #[serde(rename = "endReason", skip_serializing_if = "Option::is_none")]
    pub end_reason: Option<EndReason>,
    #[serde(rename = "recordingUrl", skip_serializing_if = "Option::is_none")]
    pub recording_url: Option<String>,
    #[serde(rename = "recordingExpiresAt", skip_serializing_if = "Option::is_none")]
    pub recording_expires_at: Option<String>,
    #[serde(rename = "billing", skip_serializing_if = "Option::is_none")]
    pub billing: Option<Box<models::WebhookPayloadCallEndedCallBilling>>,
}

impl WebhookPayloadCallEndedCall {
    pub fn new() -> WebhookPayloadCallEndedCall {
        WebhookPayloadCallEndedCall {
            id: None,
            meta_call_id: None,
            account_id: None,
            phone_number_id: None,
            direction: None,
            from: None,
            to: None,
            started_at: None,
            ended_at: None,
            duration_seconds: None,
            end_reason: None,
            recording_url: None,
            recording_expires_at: None,
            billing: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Direction {
    #[serde(rename = "inbound")]
    Inbound,
    #[serde(rename = "outbound")]
    Outbound,
}

impl Default for Direction {
    fn default() -> Direction {
        Self::Inbound
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EndReason {
    #[serde(rename = "hangup")]
    Hangup,
    #[serde(rename = "no_answer")]
    NoAnswer,
    #[serde(rename = "rejected")]
    Rejected,
    #[serde(rename = "error")]
    Error,
}

impl Default for EndReason {
    fn default() -> EndReason {
        Self::Hangup
    }
}
