"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderArchitectureDriftReportMarkdown = renderArchitectureDriftReportMarkdown;
exports.renderArchitectureGovernanceReportMarkdown = renderArchitectureGovernanceReportMarkdown;
function toBulletList(values) {
    return values.length > 0 ? values.map((value) => `- ${value}`).join('\n') : '- (none)';
}
function renderArchitectureDriftReportMarkdown(input) {
    if (!input.driftReport) {
        return `# ArchPilot Drift Report

## Drift Status
- Drift detected: Not available
- Summary: No baseline drift report is available for this repository yet.

## What Changed
- Run \`archpilot baseline create\` to capture a baseline snapshot.
- Run \`archpilot baseline check\` after structural changes to generate .archpilot/reports/architecture-drift.json.

## Impact Summary
- Architecture Health Score: ${input.summary.healthScore} / 100
- Change Risk: ${input.summary.changeRisk.riskLevel.toUpperCase()}
- Architecture Review Level: ${input.summary.risk.level.toUpperCase()}

## Suggested Actions
- Create a baseline snapshot if this architecture state is accepted.
- Re-run drift checks after structural changes or before governance review.
`;
    }
    const report = input.driftReport;
    const changedLines = [];
    for (const moduleName of report.modulesAdded) {
        changedLines.push(`New module: ${moduleName}`);
    }
    for (const moduleName of report.modulesRemoved) {
        changedLines.push(`Removed module: ${moduleName}`);
    }
    for (const edge of report.dependenciesAdded) {
        changedLines.push(`New dependency: ${edge.source} -> ${edge.target}`);
    }
    for (const edge of report.dependenciesRemoved) {
        changedLines.push(`Removed dependency: ${edge.source} -> ${edge.target}`);
    }
    for (const cycle of report.cyclesAdded) {
        changedLines.push(`New cycle: ${cycle}`);
    }
    for (const cycle of report.cyclesRemoved) {
        changedLines.push(`Resolved cycle: ${cycle}`);
    }
    return `# ArchPilot Drift Report

## Drift Status
- Drift detected: ${report.summaryCounts.totalChanges > 0 ? 'YES' : 'NO'}
- Project: ${report.projectName}
- Baseline snapshot: ${report.baselineCreatedAtUtc}
- Current snapshot: ${report.generatedAtUtc}

## What Changed
${toBulletList(changedLines)}

## Impact Summary
- Total changes: ${report.summaryCounts.totalChanges}
- Modules added: ${report.summaryCounts.modulesAdded}
- Modules removed: ${report.summaryCounts.modulesRemoved}
- Dependencies added: ${report.summaryCounts.dependenciesAdded}
- Dependencies removed: ${report.summaryCounts.dependenciesRemoved}
- Cycles added: ${report.summaryCounts.cyclesAdded}
- Cycles removed: ${report.summaryCounts.cyclesRemoved}
- Change Risk: ${input.summary.changeRisk.riskLevel.toUpperCase()}

## Suggested Actions
${report.summaryCounts.totalChanges === 0
        ? '- No immediate drift remediation is required.'
        : toBulletList([
            'Review module boundary and dependency changes before accepting the new architecture state.',
            'Resolve any unexpected cycles or removed modules before updating the baseline.',
            'Run `archpilot baseline update` only after the drift changes are intentional and reviewed.',
        ])}
`;
}
function renderArchitectureGovernanceReportMarkdown(input) {
    const summary = input.summary;
    const exceptionCount = summary.counts.exceptions ?? 0;
    const enforcementDecision = summary.enforcement.enforcementDecision ?? summary.enforcement.action.toUpperCase();
    return `# ArchPilot Governance Report

## Policy Compliance Summary
- Project: ${summary.projectName}
- Generated at (UTC): ${summary.generatedAtUtc}
${input.commitSha ? `- Commit SHA: ${input.commitSha}` : ''}
- Architecture Score: ${summary.healthScore} / 100
- Architecture Review Level: ${summary.risk.level.toUpperCase()}
- Change Risk: ${summary.changeRisk.riskLevel.toUpperCase()}
- Enforcement Outcome: ${enforcementDecision}
- Policy Level: ${summary.enforcement.policyLevel?.toUpperCase() ?? 'N/A'}

## Violations
- Errors: ${summary.counts.errors}
- Warnings: ${summary.counts.warnings}
- Info: ${summary.counts.info}
- Architecture findings: ${summary.qualityFindings}
- Setup gaps: ${summary.setupGaps}
- Guidance findings: ${summary.guidanceFindings}
- Total active findings: ${summary.findings.length}

## Exceptions
- Approved exceptions: ${exceptionCount}
- Suppressed findings: ${summary.counts.suppressed}
- Ignored suppressions: ${summary.counts.ignoredSuppressions}
${input.suppressionSummary
        ? `- Active suppressions: ${input.suppressionSummary.activeSuppressions}
- Expired suppressions: ${input.suppressionSummary.expiredSuppressions}
- Unused suppressions: ${input.suppressionSummary.unusedSuppressions}`
        : ''}

## Enforcement Outcome
- Decision: ${enforcementDecision}
- Reasons:
${toBulletList(summary.enforcement.reasons)}
- Required actions:
${toBulletList(summary.enforcement.requiredActions ?? [])}
`;
}
//# sourceMappingURL=architectureSupplementalReporters.js.map