use std::collections::HashSet;
use anyhow::Result;
use crate::models::flows::FlowsModel;
use crate::validate::ValidateTrait;
impl ValidateTrait for FlowsModel {
fn validate(&self) -> Result<()> {
let mut names: HashSet<&str> = HashSet::new();
for flow in &self.flows {
if !names.insert(flow.name.as_str()) {
anyhow::bail!("Duplicate action name '{}' across flows", flow.name);
}
}
Ok(())
}
}