pub mod events;
pub mod store;
use crate::error::Error;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use serde::Serialize;
use std::time::Duration;
pub use events::ConfirmationExpired;
pub use store::InMemoryConfirmationStore;
#[derive(Debug, Clone, Serialize)]
pub struct PendingActionInfo {
pub key: String,
pub created_at: DateTime<Utc>,
}
#[async_trait]
pub trait ConfirmationStore: Send + Sync {
async fn request_confirmation(
&self,
key: &str,
payload: serde_json::Value,
ttl: Duration,
) -> Result<(), Error>;
async fn confirm(&self, key: &str) -> Result<Option<serde_json::Value>, Error>;
async fn reject(&self, key: &str) -> Result<bool, Error>;
async fn get(&self, key: &str) -> Result<Option<serde_json::Value>, Error>;
async fn list_pending(&self) -> Result<Vec<PendingActionInfo>, Error>;
}