// src/actions/deplint/reporters.ts
import chalk from "chalk";
function pluralize(word, count) {
  return `${word}${count === 1 ? "" : "s"}`;
}
var humanDeplintReporter = {
  render(result) {
    for (const fix of result.appliedFixes) {
      console.log(`[${chalk.blue(fix.workspace.name)}] Fixed: ${fix.detail} ${chalk.green(fix.dependency)}`);
    }
    for (const diagnostic of result.diagnostics) {
      console.log(`[${chalk.blue(diagnostic.workspace.name)}] ${diagnostic.message}`);
      if (diagnostic.fixable) {
        console.log(`  ${chalk.dim("fixable with `--fix`")}`);
      }
      for (const line of diagnostic.evidence ?? []) {
        console.log(`  ${line}`);
      }
      console.log(`  ${chalk.yellow(diagnostic.file)}
`);
    }
    if (result.summary.problemCount > 0) {
      const summaryColor = result.summary.errorCount > 0 ? chalk.red : chalk.yellow;
      const summaryMessage = [
        `\u2716 ${result.summary.problemCount} ${pluralize("problem", result.summary.problemCount)}`,
        `(${result.summary.errorCount} ${pluralize("error", result.summary.errorCount)},`,
        `${result.summary.warningCount} ${pluralize("warning", result.summary.warningCount)})`
      ].join(" ");
      console.warn(summaryColor(
        summaryMessage
      ));
      if (result.summary.fixableErrorCount > 0 || result.summary.fixableWarningCount > 0) {
        const fixableMessage = [
          `  ${result.summary.fixableErrorCount} ${pluralize("error", result.summary.fixableErrorCount)}`,
          `and ${result.summary.fixableWarningCount} ${pluralize("warning", result.summary.fixableWarningCount)}`,
          "potentially fixable with the `--fix` option."
        ].join(" ");
        console.warn(summaryColor(
          fixableMessage
        ));
      }
      return;
    }
    console.info(`Deplint: Found no dependency problems. ${chalk.green("\u2714")}`);
  }
};
var jsonDeplintReporter = {
  render(result) {
    console.log(JSON.stringify(result, null, 2));
  }
};
function getDeplintReporter(format) {
  return format === "json" ? jsonDeplintReporter : humanDeplintReporter;
}
export {
  getDeplintReporter,
  humanDeplintReporter,
  jsonDeplintReporter
};
//# sourceMappingURL=reporters.mjs.map