use crate::app::command::ScanCommand;
use crate::app::runtime_scan::{
    scan_aligned_runtime_rule_band, scan_candidate_table_headers, scan_candidate_table_named_runs,
    scan_post_special_conditions_scalars, scan_post_special_conditions_tail,
    scan_recipe_book_lines, scan_special_conditions,
};

pub(super) fn dispatch_scan(command: ScanCommand) -> Result<(), Box<dyn std::error::Error>> {
    match command {
        ScanCommand::ScanCandidateTableHeaders { root_path } => {
            scan_candidate_table_headers(&root_path)
        }
        ScanCommand::ScanCandidateTableNamedRuns { root_path } => {
            scan_candidate_table_named_runs(&root_path)
        }
        ScanCommand::ScanSpecialConditions { root_path } => scan_special_conditions(&root_path),
        ScanCommand::ScanAlignedRuntimeRuleBand { root_path } => {
            scan_aligned_runtime_rule_band(&root_path)
        }
        ScanCommand::ScanPostSpecialConditionsScalars { root_path } => {
            scan_post_special_conditions_scalars(&root_path)
        }
        ScanCommand::ScanPostSpecialConditionsTail { root_path } => {
            scan_post_special_conditions_tail(&root_path)
        }
        ScanCommand::ScanRecipeBookLines { root_path } => scan_recipe_book_lines(&root_path),
    }
}
