use super::error::PermissionError;
use super::types::{PermissionAction, RolePolicy};
use async_trait::async_trait;
#[async_trait]
pub trait PermissionChecker: Send + Sync {
async fn check(&self, role: &str, table: &str, action: PermissionAction) -> Result<bool, PermissionError>;
}
#[async_trait]
pub trait PolicyManager: Send + Sync {
async fn get_policy(&self, role: &str) -> Result<Option<RolePolicy>, PermissionError>;
async fn refresh(&self) -> Result<(), PermissionError>;
}
#[async_trait]
pub trait PermissionLifecycle: Send + Sync {
async fn health_check(&self) -> anyhow::Result<()>;
async fn shutdown(&self);
}
pub trait PermissionProvider: PermissionChecker + PolicyManager + PermissionLifecycle {}