use crate::ReplyScope;
use crate::error::SessionResult;
use greentic_types::{SessionData, SessionKey, TenantCtx, UserId};
use std::time::Duration;
pub trait SessionStore: Send + Sync + 'static {
fn create_session(&self, ctx: &TenantCtx, data: SessionData) -> SessionResult<SessionKey>;
fn get_session(&self, key: &SessionKey) -> SessionResult<Option<SessionData>>;
fn update_session(&self, key: &SessionKey, data: SessionData) -> SessionResult<()>;
fn remove_session(&self, key: &SessionKey) -> SessionResult<()>;
fn register_wait(
&self,
ctx: &TenantCtx,
user_id: &UserId,
scope: &ReplyScope,
session_key: &SessionKey,
data: SessionData,
ttl: Option<Duration>,
) -> SessionResult<()>;
fn find_wait_by_scope(
&self,
ctx: &TenantCtx,
user_id: &UserId,
scope: &ReplyScope,
) -> SessionResult<Option<SessionKey>>;
fn list_waits_for_user(
&self,
ctx: &TenantCtx,
user_id: &UserId,
) -> SessionResult<Vec<SessionKey>>;
fn clear_wait(
&self,
ctx: &TenantCtx,
user_id: &UserId,
scope: &ReplyScope,
) -> SessionResult<()>;
#[deprecated(note = "use find_wait_by_scope or list_waits_for_user instead")]
fn find_by_user(
&self,
ctx: &TenantCtx,
user: &UserId,
) -> SessionResult<Option<(SessionKey, SessionData)>>;
}