aurum_core/provider_platform/
descriptor.rs1use super::id::ProviderId;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(rename_all = "snake_case")]
9pub enum NetworkRequirement {
10 LocalOnly,
12 RequiresNetwork,
14}
15
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(rename_all = "snake_case")]
19pub enum ProviderStability {
20 Stable,
22 Experimental,
24 TestOnly,
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
30pub struct ProviderOperations {
31 pub stt: bool,
32 pub tts: bool,
33}
34
35impl ProviderOperations {
36 pub const STT_ONLY: Self = Self {
37 stt: true,
38 tts: false,
39 };
40 pub const TTS_ONLY: Self = Self {
41 stt: false,
42 tts: true,
43 };
44 pub const BOTH: Self = Self {
45 stt: true,
46 tts: true,
47 };
48
49 pub fn supports_stt(self) -> bool {
50 self.stt
51 }
52
53 pub fn supports_tts(self) -> bool {
54 self.tts
55 }
56}
57
58#[derive(Debug, Clone)]
60pub struct ProviderDescriptor {
61 pub id: ProviderId,
62 pub display_name: &'static str,
63 pub operations: ProviderOperations,
64 pub network: NetworkRequirement,
65 pub stability: ProviderStability,
66}
67
68impl ProviderDescriptor {
69 pub fn new(
70 id: ProviderId,
71 display_name: &'static str,
72 operations: ProviderOperations,
73 network: NetworkRequirement,
74 stability: ProviderStability,
75 ) -> Self {
76 Self {
77 id,
78 display_name,
79 operations,
80 network,
81 stability,
82 }
83 }
84}