use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FlowDirectiveValue {
Enumerated(FlowDirectiveType),
Custom(String),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum FlowDirectiveType {
#[serde(rename = "continue")]
Continue,
#[serde(rename = "exit")]
Exit,
#[serde(rename = "end")]
End,
}
impl FlowDirectiveValue {
pub fn is_enumerated(&self) -> bool {
matches!(self, FlowDirectiveValue::Enumerated(_))
}
pub fn is_termination(&self) -> bool {
matches!(
self,
FlowDirectiveValue::Enumerated(FlowDirectiveType::Exit | FlowDirectiveType::End)
)
}
}
impl Default for FlowDirectiveValue {
fn default() -> Self {
FlowDirectiveValue::Enumerated(FlowDirectiveType::Continue)
}
}