use uuid::Uuid;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MailboxTaskState {
Submitted,
Working,
InputRequired,
Completed,
Failed,
Cancelled,
}
pub trait MailboxStore: Send + Sync {
type Msg;
type Task;
type Error: std::error::Error + Send + Sync + 'static;
fn post(&self, msg: &Self::Msg) -> Result<(), Self::Error>;
fn inbox(&self, team_id: &str, to: &str) -> Result<Vec<Self::Msg>, Self::Error>;
fn claim(&self, message_id: Uuid) -> Result<bool, Self::Error>;
fn consume(&self, message_id: Uuid) -> Result<(), Self::Error>;
fn unclaim(&self, message_id: Uuid) -> Result<(), Self::Error>;
fn task_create(&self, task: &Self::Task) -> Result<(), Self::Error>;
fn task_update(
&self,
id: Uuid,
state: MailboxTaskState,
note: Option<&str>,
) -> Result<(), Self::Error>;
fn task_list(&self, team_id: &str) -> Result<Vec<Self::Task>, Self::Error>;
}