import { buildExecutiveSummaryData } from './data-extractors.js';
import { generateArchitectureSvg, generateTimelineSvg, generateRiskDistributionSvg, } from './svg-diagrams.js';
import { wrapInHtmlDocument } from './html-template.js';
import { buildHeaderSection, buildOverviewSection, buildSpecsTableSection, buildEstimationSection, buildRiskSection, buildArchitectureSection, buildTimelineSection, buildFooterSection, } from './section-builders.js';
/**
 * Generate a self-contained HTML executive summary document.
 * Returns a GeneratedDocument with type 'executive-summary'.
 */
export function generateExecutiveSummary(knowledge, specs, _language) {
    const data = buildExecutiveSummaryData(knowledge, specs);
    const archSvg = generateArchitectureSvg(data.architecture);
    const timelineSvg = generateTimelineSvg(data.specs);
    const riskSvg = generateRiskDistributionSvg(data.riskProfile);
    const hasActuals = data.specs.some((s) => s.actualDevHours !== undefined);
    const body = [
        buildHeaderSection(data.projectName, data.generatedAt, data.specs.length),
        buildOverviewSection(data.architecture),
        buildSpecsTableSection(data.specs),
        buildEstimationSection(data.estimation, hasActuals),
        buildRiskSection(data.riskProfile, riskSvg),
        buildArchitectureSection(data.architecture, archSvg),
        buildTimelineSection(timelineSvg),
        buildFooterSection(),
    ].join('\n');
    const title = `Executive Summary — ${data.projectName}`;
    const content = wrapInHtmlDocument(title, body);
    return {
        type: 'executive-summary',
        title,
        path: 'docs/executive-summary.html',
        content,
        audience: 'stakeholder',
        sections: [],
        diagrams: [],
        relatedSpecs: data.specs.map((s) => s.id),
    };
}
//# sourceMappingURL=executive-summary-generator.js.map