use std::time::Duration;
use smos_domain::{FactId, MemoryKey, SessionId, SessionState};
use crate::errors::RepoError;
pub trait SessionRepository {
async fn get_or_create(
&self,
id: &SessionId,
memory_key: &MemoryKey,
) -> Result<SessionState, RepoError>;
async fn collect_expired(
&self,
timeout: Duration,
) -> Result<Vec<(SessionId, SessionState)>, RepoError>;
async fn snapshot_all(&self) -> Result<Vec<(SessionId, SessionState)>, RepoError>;
async fn add_pending(&self, id: &SessionId, fact_ids: &[FactId]) -> Result<(), RepoError>;
async fn remove_pending_owned(&self, id: &SessionId, owned: &[FactId])
-> Result<(), RepoError>;
async fn clear_session(&self, id: &SessionId) -> Result<(), RepoError>;
async fn dedup_and_mark(
&self,
id: &SessionId,
memory_key: &MemoryKey,
candidate_ids: &[FactId],
) -> Result<Vec<FactId>, RepoError>;
async fn save(&self, id: &SessionId, state: &SessionState) -> Result<(), RepoError>;
}