use super::{StampError, StampedPlan};
use crate::kind::{Destination, Kind, Role};
use crate::plan::Plan;
pub fn planned<K: Kind>(plan: &Plan<K>, role: K::Role) -> Result<StampedPlan, StampError> {
let Some(member) = plan.membership().under(role) else {
return Err(StampError::SeatNotPlanned {
role_slot: role.slot(),
});
};
if role.destination() != Destination::PublicationArtifact {
return Err(StampError::DestinationNotArtifact {
role_slot: role.slot(),
});
}
Ok(StampedPlan::read(
member.output.semantic_key,
member.output.digest_contract,
))
}