use async_trait::async_trait;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct HistoryEvent {
pub id: String,
pub instance_id: String,
pub event_type: String,
pub payload: serde_json::Value,
pub occurred_at: String,
}
#[async_trait]
pub trait HistoryRepo: Send + Sync {
async fn append(
&self,
instance_id: &str,
event_type: &str,
payload: &serde_json::Value,
occurred_at: &str,
) -> anyhow::Result<String>;
async fn list_by_instance(
&self,
instance_id: &str,
token_id_filter: Option<&str>,
event_type_filter: Option<&str>,
) -> anyhow::Result<Vec<HistoryEvent>>;
}