use async_trait::async_trait;
use chrono::{DateTime, Utc};
use crate::chain::{ChainEntry, ProvenanceEvent};
use crate::error::ProvenanceError;
#[async_trait]
pub trait ProvenanceRepository: Send + Sync {
async fn append(
&self,
scope: &str,
event: ProvenanceEvent,
) -> Result<ChainEntry, ProvenanceError>;
async fn head(&self, scope: &str) -> Result<Option<ChainEntry>, ProvenanceError>;
async fn list_range(
&self,
scope: &str,
from_sequence: u64,
to_sequence: u64,
) -> Result<Vec<ChainEntry>, ProvenanceError>;
async fn list_by_time(
&self,
scope: &str,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Result<Vec<ChainEntry>, ProvenanceError>;
}