use async_trait::async_trait;
use chrono::{DateTime, Utc};
use super::event::AuditEvent;
use crate::error::Error;
#[cfg(feature = "database")]
pub mod pg;
#[cfg(feature = "turso")]
pub mod turso;
#[cfg(feature = "surrealdb")]
pub mod surrealdb_impl;
#[cfg(feature = "clickhouse")]
pub mod clickhouse_impl;
#[async_trait]
pub trait AuditStorage: Send + Sync {
async fn append(&self, event: &AuditEvent) -> Result<(), Error>;
async fn latest(&self) -> Result<Option<AuditEvent>, Error>;
async fn query_range(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
limit: usize,
) -> Result<Vec<AuditEvent>, Error>;
async fn verify_chain(&self, from_sequence: u64) -> Result<Option<u64>, Error>;
async fn query_before(
&self,
_cutoff: DateTime<Utc>,
_limit: usize,
) -> Result<Vec<AuditEvent>, Error> {
Err(Error::Internal("query_before not implemented".into()))
}
async fn purge_before(&self, _cutoff: DateTime<Utc>) -> Result<u64, Error> {
Err(Error::Internal("purge_before not implemented".into()))
}
}