use crate::error::GarrisonResult;
use async_trait::async_trait;
pub mod types;
#[cfg(feature = "backend-embedded")]
pub mod embedded;
#[cfg(feature = "backend-remote")]
pub mod remote;
#[cfg(feature = "backend-kit")]
pub mod kit_builder;
#[cfg(test)]
mod tests;
pub use types::*;
#[cfg(feature = "backend-embedded")]
pub use embedded::BackendEmbedded;
#[cfg(feature = "backend-remote")]
pub use remote::BackendRemote;
#[cfg(feature = "backend-kit")]
pub use kit_builder::{BackendKitError, BackendModule};
#[async_trait]
pub trait AuthBackend: Send + Sync {
async fn login(&self, login_id: &str, params: &LoginParams) -> GarrisonResult<String>;
async fn logout(&self, token: &str) -> GarrisonResult<()>;
async fn check_login(&self, token: &str) -> GarrisonResult<bool>;
async fn check_permission(&self, token: &str, permission: &str) -> GarrisonResult<()>;
async fn check_role(&self, token: &str, role: &str) -> GarrisonResult<()>;
async fn check_safe(&self, token: &str) -> GarrisonResult<bool>;
async fn check_disable(&self, token: &str) -> GarrisonResult<bool>;
async fn check_api_key(&self, api_key: &str, namespace: &str) -> GarrisonResult<()>;
async fn get_token_info(&self, token: &str) -> GarrisonResult<TokenInfo>;
async fn get_session(&self, token: &str) -> GarrisonResult<SessionData>;
async fn kickout(&self, login_id: &str) -> GarrisonResult<()>;
async fn switch_to(&self, token: &str, target_login_id: &str) -> GarrisonResult<()>;
async fn renew_to_equivalent(&self, token: &str) -> GarrisonResult<String>;
}