use async_trait::async_trait;
use chrono::{DateTime, Utc};
use super::types::{Account, AccountStatus};
use crate::error::Error;
#[cfg(feature = "database")]
pub mod pg;
#[cfg(feature = "turso")]
pub mod turso;
#[cfg(feature = "surrealdb")]
pub mod surrealdb_impl;
#[async_trait]
pub trait AccountStorage: Send + Sync {
async fn create(&self, account: &Account) -> Result<(), Error>;
async fn get_by_id(&self, id: &str) -> Result<Option<Account>, Error>;
async fn get_by_email(&self, email: &str) -> Result<Option<Account>, Error>;
async fn get_by_username(&self, username: &str) -> Result<Option<Account>, Error>;
async fn update(&self, account: &Account) -> Result<(), Error>;
async fn update_status(
&self,
id: &str,
status: AccountStatus,
reason: Option<&str>,
) -> Result<(), Error>;
async fn list(
&self,
status_filter: Option<AccountStatus>,
limit: usize,
offset: usize,
) -> Result<Vec<Account>, Error>;
async fn count(&self, status_filter: Option<AccountStatus>) -> Result<u64, Error>;
async fn delete(&self, id: &str) -> Result<bool, Error>;
async fn record_login(&self, id: &str) -> Result<(), Error>;
async fn find_expired(&self, limit: usize) -> Result<Vec<Account>, Error>;
async fn find_inactive(
&self,
cutoff: DateTime<Utc>,
limit: usize,
) -> Result<Vec<Account>, Error>;
}