use super::id::ProviderId;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum NetworkRequirement {
LocalOnly,
RequiresNetwork,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProviderStability {
Stable,
Experimental,
TestOnly,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ProviderOperations {
pub stt: bool,
pub tts: bool,
}
impl ProviderOperations {
pub const STT_ONLY: Self = Self {
stt: true,
tts: false,
};
pub const TTS_ONLY: Self = Self {
stt: false,
tts: true,
};
pub const BOTH: Self = Self {
stt: true,
tts: true,
};
pub fn supports_stt(self) -> bool {
self.stt
}
pub fn supports_tts(self) -> bool {
self.tts
}
}
#[derive(Debug, Clone)]
pub struct ProviderDescriptor {
pub id: ProviderId,
pub display_name: &'static str,
pub operations: ProviderOperations,
pub network: NetworkRequirement,
pub stability: ProviderStability,
}
impl ProviderDescriptor {
pub fn new(
id: ProviderId,
display_name: &'static str,
operations: ProviderOperations,
network: NetworkRequirement,
stability: ProviderStability,
) -> Self {
Self {
id,
display_name,
operations,
network,
stability,
}
}
}