use std::path::Path;
use anyhow::{Result, Context};
use crate::core::registry::RecipeRegistry;
use crate::utils::terminal;
pub fn execute(recipe_names: &[String], path: &Path) -> Result<()> {
let registry = RecipeRegistry::new();
let spinner = terminal::spinner("Simulating migration impact...");
let mut total_files = 0;
let mut total_safe = 0;
let mut total_risky = 0;
let mut total_skipped = 0;
let mut impacts = Vec::new();
for name in recipe_names {
let recipe = registry.find(name)
.with_context(|| format!("Recipe not found: {}", name))?;
let report = recipe.detect(path, &spinner)?;
let safe = report.safe_transforms();
let risky = report.risky_transforms();
let skipped = report.skipped_files.len();
total_files += report.total_files;
total_safe += safe;
total_risky += risky;
total_skipped += skipped;
impacts.push((name, safe, risky, skipped));
}
spinner.finish_and_clear();
println!();
println!("{}", terminal::label("Migration Simulation Report"));
println!("{}", terminal::label("═".repeat(50).as_str()));
println!(" Total Files Scanned: {}", total_files);
println!(" Estimated Impact:");
println!(" {} {} Safe Modifications", terminal::success_prefix(), total_safe);
println!(" {} {} Risky Transforms", terminal::warning_prefix(), total_risky);
println!(" {} Files Skipped", total_skipped);
println!("{}", terminal::label("─".repeat(50).as_str()));
println!();
for (name, safe, risky, skipped) in impacts {
println!(" Recipe: {}", terminal::label(name));
println!(" Safe: {}, Risky: {}, Skipped: {}", safe, risky, skipped);
}
println!();
println!("Note: This is a simulation based on static detection metadata. Actual results may differ depending on execution context.");
Ok(())
}