use crate::embedded::EmbeddedConfig;
use crate::{ChannelHandle, ConversationHandle, SdkError};
use super::{RemoteConfig, SdkChannelHandle, SdkConversationHandle};
#[derive(Clone, Debug)]
pub enum SdkConfig {
Embedded(EmbeddedConfig),
Remote(RemoteConfig),
}
impl SdkConfig {
#[must_use]
pub const fn embedded(config: EmbeddedConfig) -> Self {
Self::Embedded(config)
}
#[must_use]
pub const fn remote(config: RemoteConfig) -> Self {
Self::Remote(config)
}
pub fn channel_handle(&self) -> Result<SdkChannelHandle, SdkError> {
SdkChannelHandle::new(self)
}
pub fn conversation_handle(&self) -> Result<SdkConversationHandle, SdkError> {
SdkConversationHandle::new(self)
}
}
pub fn build_channel_handle(config: &SdkConfig) -> Result<impl ChannelHandle, SdkError> {
config.channel_handle()
}
pub fn build_conversation_handle(config: &SdkConfig) -> Result<impl ConversationHandle, SdkError> {
config.conversation_handle()
}