use crate::entities::{CeremonyCommand, CeremonyDefinition, CeremonyEvent, CeremonyInstance};
use crate::error::DomainError;
mod guard_decisions;
mod interventions;
mod participant_bindings;
mod reasons;
mod start;
mod step_execution;
mod transitions;
impl CeremonyInstance {
pub fn decide(
&self,
command: &CeremonyCommand,
definition: &CeremonyDefinition,
) -> Result<Vec<CeremonyEvent>, DomainError> {
match command {
CeremonyCommand::BindParticipant(command) => {
self.decide_bind_participant(command, definition)
}
CeremonyCommand::StartStep(command) => self.decide_start_step(command, definition),
CeremonyCommand::ApplyStepResult(command) => {
self.decide_apply_step_result(command, definition)
}
CeremonyCommand::ApplyTransition(command) => {
self.decide_apply_transition(command, definition)
}
CeremonyCommand::ApproveGuard(command) => {
self.decide_approve_guard(command, definition)
}
CeremonyCommand::DeferGuard(command) => self.decide_defer_guard(command, definition),
CeremonyCommand::RequestIntervention(command) => {
self.decide_request_intervention(command, definition)
}
CeremonyCommand::RespondToIntervention(command) => {
self.decide_respond_to_intervention(command, definition)
}
CeremonyCommand::RespondToInterventionWithEvidence(command) => {
self.decide_respond_to_intervention_with_evidence(command, definition)
}
CeremonyCommand::AssertReason(command) => {
self.decide_assert_reason(command, definition)
}
CeremonyCommand::CloseIntervention(command) => {
self.decide_close_intervention(command, definition)
}
}
}
}