use crate::types::*;
use async_trait::async_trait;
#[async_trait]
pub trait AuthorizationServiceTrait: Send + Sync {
async fn check_authorization(
&self,
request: AuthorizationRequest,
) -> Result<AuthorizationResponse, AuthorizationError>;
async fn grant_permission_to_role(
&self,
role: &str,
permission: Permission,
) -> Result<(), AuthorizationError>;
async fn revoke_permission_from_role(
&self,
role: &str,
permission: &Permission,
) -> Result<(), AuthorizationError>;
async fn assign_role_to_user(
&self,
user_id: &str,
role: &str,
) -> Result<(), AuthorizationError>;
async fn remove_role_from_user(
&self,
user_id: &str,
role: &str,
) -> Result<(), AuthorizationError>;
async fn get_user_permissions(
&self,
user_id: &str,
) -> Result<Vec<Permission>, AuthorizationError>;
async fn user_has_permission(
&self,
user_id: &str,
permission: &Permission,
) -> Result<bool, AuthorizationError>;
}