use super::StoreError;
use crate::agents::session::SessionSnapshot;
use async_trait::async_trait;
use std::fmt::Debug;
#[async_trait]
pub trait SessionStore: Send + Sync + Debug {
async fn load(
&self,
app_name: &str,
user_id: &str,
session_id: &str,
) -> Result<Option<SessionSnapshot>, StoreError>;
async fn save(
&self,
app_name: &str,
user_id: &str,
session_id: &str,
snapshot: &SessionSnapshot,
) -> Result<(), StoreError>;
async fn delete(
&self,
app_name: &str,
user_id: &str,
session_id: &str,
) -> Result<(), StoreError>;
async fn exists(
&self,
app_name: &str,
user_id: &str,
session_id: &str,
) -> Result<bool, StoreError> {
Ok(self.load(app_name, user_id, session_id).await?.is_some())
}
}