/**
 * ConsoleLogger — the default human-readable logger adapter.
 *
 * Matches the existing emoji-prefix console output style used throughout
 * the pipeline. This is a drop-in replacement for the scattered
 * console.log calls — same visual output, structured interface.
 */
export class ConsoleLogger {
    verbose;
    constructor(options = {}) {
        this.verbose = options.verbose ?? false;
    }
    debug(msg, ctx) {
        if (!this.verbose)
            return;
        console.log(`  🔍 ${msg}${ctx ? ` ${JSON.stringify(ctx)}` : ""}`);
    }
    info(msg) {
        console.log(`  ${msg}`);
    }
    warn(msg) {
        console.warn(`  ⚠️  ${msg}`);
    }
    error(msg) {
        console.error(`  ❌ ${msg}`);
    }
    step(name, result) {
        const icon = result.status === "success"
            ? "✅"
            : result.status === "skipped"
                ? "⏭️"
                : "❌";
        const detail = result.status === "success"
            ? `(${result.durationMs}ms) ${result.summary}`
            : result.status === "skipped"
                ? result.reason
                : result.error;
        console.log(`  ${icon} ${name}: ${detail}`);
    }
    section(title) {
        const line = "═".repeat(65);
        console.log(`\n${line}\n ${title}\n${line}\n`);
    }
    table(headers, rows) {
        const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
        const pad = (s, w) => s.padEnd(w);
        const sep = widths.map((w) => "─".repeat(w)).join("─┼─");
        console.log(headers.map((h, i) => pad(h, widths[i])).join(" │ "));
        console.log(sep);
        for (const row of rows) {
            console.log(row.map((c, i) => pad(c ?? "", widths[i])).join(" │ "));
        }
    }
}
