use crate::platform::container::user::{User, UserError, UserProfile};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use uuid::Uuid;
#[derive(Debug, Clone)]
pub struct UserRegistrationRequest {
pub username: String,
pub email: String,
pub password: String,
pub profile: Option<UserProfile>,
}
#[derive(Debug, Clone)]
pub struct UserLoginRequest {
pub email: String,
pub password: String,
}
#[derive(Debug, Clone)]
pub struct UserProfileUpdateRequest {
pub user_id: Uuid,
pub username: Option<String>,
pub email: Option<String>,
pub profile: Option<UserProfile>,
}
#[derive(Debug, Clone)]
pub struct UserAuthenticationResult {
pub user_id: Uuid,
pub username: String,
pub email: String,
pub is_verified: bool,
pub success: bool,
pub token: Option<String>,
pub token_expires_at: Option<DateTime<Utc>>,
}
#[async_trait]
pub trait UserServiceTrait: Send + Sync {
async fn register_user(&self, request: UserRegistrationRequest) -> Result<User, UserError>;
async fn login_user(
&self,
request: UserLoginRequest,
) -> Result<UserAuthenticationResult, UserError>;
async fn update_user_profile(
&self,
request: UserProfileUpdateRequest,
) -> Result<User, UserError>;
async fn get_user_by_id(&self, user_id: Uuid) -> Result<Option<User>, UserError>;
async fn get_user_by_email(&self, email: &str) -> Result<Option<User>, UserError>;
async fn delete_user(&self, user_id: Uuid) -> Result<(), UserError>;
async fn list_users(&self) -> Result<Vec<User>, UserError>;
async fn activate_user(&self, user_id: Uuid) -> Result<(), UserError>;
async fn deactivate_user(&self, user_id: Uuid) -> Result<(), UserError>;
async fn verify_user(&self, user_id: Uuid) -> Result<(), UserError>;
async fn find_by_active_status(&self, is_active: bool) -> Result<Vec<User>, UserError>;
async fn find_by_verification_status(&self, is_verified: bool) -> Result<Vec<User>, UserError>;
async fn count_users(&self) -> Result<u64, UserError>;
}