Skip to main content

made_core/value_objects/ceremony/
guard_condition.rs

1use serde::{Deserialize, Serialize};
2
3use super::{StepId, StepStatus};
4
5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6#[serde(tag = "kind", rename_all = "snake_case")]
7pub enum GuardCondition {
8    Always,
9    AllStepsCompleted,
10    StepStatus { step_id: StepId, status: StepStatus },
11    HumanApproval,
12}
13
14impl GuardCondition {
15    #[must_use]
16    pub fn referenced_step_id(&self) -> Option<&StepId> {
17        match self {
18            Self::StepStatus { step_id, .. } => Some(step_id),
19            Self::Always | Self::AllStepsCompleted | Self::HumanApproval => None,
20        }
21    }
22}