use async_trait::async_trait;
use crate::plan::{
CallerId, Cohort, DeliverableStatus, PlanGraph, PlanId, PlanStatus, PlannerError,
};
#[async_trait]
pub trait Planner: Send + Sync {
async fn submit_plan(&self, graph: PlanGraph) -> Result<PlanId, PlannerError>;
async fn acquire_cohort(
&self,
plan_id: &PlanId,
caller_id: &CallerId,
max_count: usize,
) -> Result<Cohort, PlannerError>;
async fn mark_status(
&self,
plan_id: &PlanId,
deliverable_id: &str,
caller_id: &CallerId,
status: DeliverableStatus,
) -> Result<(), PlannerError>;
async fn heartbeat(
&self,
plan_id: &PlanId,
deliverable_id: &str,
caller_id: &CallerId,
) -> Result<(), PlannerError>;
async fn status(&self, plan_id: &PlanId) -> Result<PlanStatus, PlannerError>;
async fn force_release(
&self,
plan_id: &PlanId,
deliverable_id: &str,
reason: &str,
) -> Result<(), PlannerError>;
}