use crate::{
Identifier, IdentityInfo, IggyError, Permissions, UserInfo, UserInfoDetails, UserStatus,
};
use async_trait::async_trait;
#[async_trait]
pub trait UserClient {
async fn get_user(&self, user_id: &Identifier) -> Result<Option<UserInfoDetails>, IggyError>;
async fn get_users(&self) -> Result<Vec<UserInfo>, IggyError>;
async fn create_user(
&self,
username: &str,
password: &str,
status: UserStatus,
permissions: Option<Permissions>,
) -> Result<UserInfoDetails, IggyError>;
async fn delete_user(&self, user_id: &Identifier) -> Result<(), IggyError>;
async fn update_user(
&self,
user_id: &Identifier,
username: Option<&str>,
status: Option<UserStatus>,
) -> Result<(), IggyError>;
async fn update_permissions(
&self,
user_id: &Identifier,
permissions: Option<Permissions>,
) -> Result<(), IggyError>;
async fn change_password(
&self,
user_id: &Identifier,
current_password: &str,
new_password: &str,
) -> Result<(), IggyError>;
async fn login_user(&self, username: &str, password: &str) -> Result<IdentityInfo, IggyError>;
async fn logout_user(&self) -> Result<(), IggyError>;
}