use async_trait::async_trait;
use super::error::AdminError;
use super::types::{
AuditEntry, AuditLogParams, CreatePlatformInvite, ListOrgsParams, ListPlatformInvitesParams,
ListUsersParams, PaginatedResult, PlatformInvite, PlatformInviteConsumption, PlatformStats,
UpdateUser,
};
#[async_trait]
pub trait AdminStore: Send + Sync {
type User: Send + Sync;
type Organization: Send + Sync;
async fn is_platform_admin(&self, user_id: &str) -> Result<bool, AdminError>;
async fn list_users(
&self,
params: ListUsersParams,
) -> Result<PaginatedResult<Self::User>, AdminError>;
async fn get_user(&self, user_id: &str) -> Result<Option<Self::User>, AdminError>;
async fn update_user(&self, user_id: &str, updates: UpdateUser) -> Result<(), AdminError>;
async fn delete_user(&self, user_id: &str) -> Result<(), AdminError>;
async fn list_organizations(
&self,
params: ListOrgsParams,
) -> Result<PaginatedResult<Self::Organization>, AdminError>;
async fn get_organization(
&self,
org_id: &str,
) -> Result<Option<Self::Organization>, AdminError>;
async fn get_platform_stats(&self) -> Result<PlatformStats, AdminError>;
async fn get_audit_log(&self, _params: AuditLogParams) -> Result<Vec<AuditEntry>, AdminError> {
Ok(vec![])
}
async fn record_audit(
&self,
_user_id: &str,
_action: &str,
_details: Option<&str>,
_ip_address: Option<&str>,
) -> Result<(), AdminError> {
Ok(())
}
async fn create_platform_invite(
&self,
_admin_user_id: &str,
_invite: CreatePlatformInvite,
) -> Result<PlatformInvite, AdminError> {
Err(AdminError::NotSupported(
"Platform invitations not implemented".into(),
))
}
async fn list_platform_invites(
&self,
_params: ListPlatformInvitesParams,
) -> Result<PaginatedResult<PlatformInvite>, AdminError> {
Ok(PaginatedResult::new(vec![], 0, 1, 20))
}
async fn get_platform_invite(
&self,
_invite_id: &str,
) -> Result<Option<PlatformInvite>, AdminError> {
Ok(None)
}
async fn revoke_platform_invite(&self, _invite_id: &str) -> Result<(), AdminError> {
Err(AdminError::NotSupported(
"Platform invitations not implemented".into(),
))
}
async fn resend_platform_invite(&self, _invite_id: &str) -> Result<PlatformInvite, AdminError> {
Err(AdminError::NotSupported(
"Platform invitations not implemented".into(),
))
}
async fn consume_platform_invite(
&self,
_token: &str,
_user_id: &str,
) -> Result<Option<PlatformInviteConsumption>, AdminError> {
Ok(None)
}
async fn get_platform_invite_by_token(
&self,
_token: &str,
) -> Result<Option<PlatformInvite>, AdminError> {
Ok(None)
}
}