use std::error::Error;
use crate::command::{ApplyKeepsake, RevokeKeepsake};
use crate::model::{FulfillmentSnapshot, Keepsake, KeepsakeId, SubjectRef};
pub trait FulfillmentProvider: Send + Sync {
type Error: Error + Send + Sync + 'static;
fn snapshot(
&self,
keepsake: &Keepsake,
) -> std::result::Result<Option<FulfillmentSnapshot>, Self::Error>;
}
pub trait KeepsakeStore: Send + Sync {
type Error: Error + Send + Sync + 'static;
fn apply(&self, command: &ApplyKeepsake) -> std::result::Result<Keepsake, Self::Error>;
fn revoke(&self, command: &RevokeKeepsake) -> std::result::Result<Keepsake, Self::Error>;
fn active_for_subject(
&self,
subject: &SubjectRef,
) -> std::result::Result<Vec<Keepsake>, Self::Error>;
fn get(&self, id: KeepsakeId) -> std::result::Result<Option<Keepsake>, Self::Error>;
}