use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveSessionAudioFormatPcmParam {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "rate")]
pub rate: Rate,
}
impl LiveSessionAudioFormatPcmParam {
pub fn new(r#type: Type, rate: Rate) -> LiveSessionAudioFormatPcmParam {
LiveSessionAudioFormatPcmParam { r#type, rate }
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "audio/pcm")]
AudioSlashPcm,
}
impl Default for Type {
fn default() -> Type {
Self::AudioSlashPcm
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Rate {
#[serde(rename = "16000")]
Variant16000,
#[serde(rename = "24000")]
Variant24000,
}
impl Default for Rate {
fn default() -> Rate {
Self::Variant16000
}
}
impl std::fmt::Display for LiveSessionAudioFormatPcmParam {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}