"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderArchitectureDriftTimelineConsole = renderArchitectureDriftTimelineConsole;
exports.renderArchitectureDriftTimelineJson = renderArchitectureDriftTimelineJson;
function formatSnapshotDate(timestampIso) {
    return timestampIso.slice(0, 10);
}
function padColumn(value, width) {
    if (value.length >= width) {
        return value;
    }
    return `${value}${' '.repeat(width - value.length)}`;
}
function renderArchitectureDriftTimelineConsole(input) {
    const lines = [];
    lines.push('Architecture Drift Timeline');
    lines.push('----------------------------------------');
    lines.push(`${padColumn('Date', 19)} ${padColumn('Score', 7)} ${padColumn('Drift', 7)} ${padColumn('Errors', 8)} Warnings`);
    if (input.snapshots.length === 0) {
        lines.push('(no snapshots)');
    }
    else {
        for (const snapshot of input.snapshots) {
            lines.push(`${padColumn(formatSnapshotDate(snapshot.timestamp), 19)} ${padColumn(String(snapshot.architectureScore), 7)} ${padColumn(snapshot.driftDetected ? 'YES' : 'NO', 7)} ${padColumn(String(snapshot.errorCount), 8)} ${snapshot.warningCount}`);
        }
    }
    if (input.trendSummary) {
        lines.push('');
        lines.push('Trend Summary');
        lines.push(`Latest score: ${input.trendSummary.latestScore}`);
        lines.push(`Best score: ${input.trendSummary.bestScore}`);
        lines.push(`Worst score: ${input.trendSummary.worstScore}`);
        lines.push(`Trend: ${input.trendSummary.trend}`);
    }
    return `${lines.join('\n')}\n`;
}
function renderArchitectureDriftTimelineJson(input) {
    return `${JSON.stringify({
        snapshotCount: input.snapshots.length,
        snapshots: input.snapshots,
        ...(input.trendSummary ? { trendSummary: input.trendSummary } : {}),
    }, null, 2)}\n`;
}
//# sourceMappingURL=architectureDriftTimelineReporter.js.map