use crate::storage::Error;
use async_trait::async_trait;
use pbbson::Model;

#[async_trait]
pub trait ConfigStore<B: ToString>: Sync + Send {
    async fn create(&self, bucket: B, model: Model) -> Result<Model, Error>;
    async fn delete(&self, bucket: B, id: &str, by_account_id: Option<String>) -> Result<(), Error>;
    async fn find(&self, bucket: B, id: &str) -> Result<Model, Error>;
    async fn find_many(&self, bucket: B, filter: Model, ordering: Option<Model>) -> Result<Vec<Model>, Error>;
    async fn update(&self, bucket: B, model: Model) -> Result<Model, Error>;
}
