use crate::error::{HyperAgentError, Result};
use hyper_strategy::strategy_config::{load_strategy_groups_from_disk_pub, StrategyGroup};
use hyper_strategy::strategy_templates::build_template;
pub fn resolve_strategy(id: &str, symbol: Option<&str>) -> Result<StrategyGroup> {
let groups = load_strategy_groups_from_disk_pub();
if let Some(sg) = groups.iter().find(|g| g.id == id) {
return Ok(sg.clone());
}
let sym = symbol.ok_or_else(|| {
HyperAgentError::StrategyNotFound(format!(
"Strategy '{}' not found. Provide --symbol for template.",
id
))
})?;
build_template(id, sym)
.ok_or_else(|| HyperAgentError::StrategyNotFound(format!("Unknown strategy '{}'", id)))
}