use std::collections::BTreeSet;
use std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use fedimint_core::core::ModuleKind;
use fedimint_core::module::ApiAuth;
pub type DynSetupApi = Arc<dyn ISetupApi + Send + Sync + 'static>;
#[async_trait]
pub trait ISetupApi {
async fn setup_code(&self) -> Option<String>;
async fn guardian_name(&self) -> Option<String>;
async fn auth(&self) -> Option<ApiAuth>;
async fn connected_peers(&self) -> Vec<String>;
fn available_modules(&self) -> BTreeSet<ModuleKind>;
fn default_modules(&self) -> BTreeSet<ModuleKind>;
async fn reset_setup_codes(&self);
async fn set_local_parameters(
&self,
auth: ApiAuth,
name: String,
federation_name: Option<String>,
disable_base_fees: Option<bool>,
enabled_modules: Option<BTreeSet<ModuleKind>>,
federation_size: Option<u32>,
) -> Result<String>;
async fn add_peer_setup_code(&self, info: String) -> Result<String>;
async fn start_dkg(&self) -> Result<()>;
async fn federation_size(&self) -> Option<u32>;
async fn cfg_federation_name(&self) -> Option<String>;
async fn cfg_base_fees_disabled(&self) -> Option<bool>;
async fn cfg_enabled_modules(&self) -> Option<BTreeSet<ModuleKind>>;
fn into_dyn(self) -> DynSetupApi
where
Self: Sized + Send + Sync + 'static,
{
Arc::new(self)
}
}