use crate::error::Result;
use crate::types::Config;
use async_trait::async_trait;
use std::any::Any;
use std::path::Path;
#[async_trait]
pub trait ConfigProvider: Send + Sync {
async fn load_config(&self) -> Result<Config>;
async fn save_config(&self, config: &Config) -> Result<()>;
async fn validate_config(&self, config: &Config) -> Result<()>;
async fn config_exists(&self) -> Result<bool>;
fn config_path(&self) -> Option<&Path>;
fn as_any(&self) -> &dyn Any;
}
#[async_trait]
pub trait ConfigManager: Send + Sync {
async fn initialize(&self) -> Result<Config>;
async fn load(&self) -> Result<Config>;
async fn save(&self, config: &Config) -> Result<()>;
async fn update_section<T>(&self, section: &str, data: T) -> Result<()> where T: Send + Sync;
async fn backup(&self) -> Result<String>;
async fn restore(&self, backup_id: &str) -> Result<()>;
}