// Planu — Deployment Guide generator
import { buildDeploymentInstructions, buildMobileInstallGuide } from './builders.js';
import { generateDeploymentDiagram } from './diagrams.js';
export function generateDeploymentGuide(knowledge, _language) {
    const sections = [];
    const deploymentUnits = knowledge.architecture.deploymentUnits;
    sections.push({
        title: 'Deployment Overview',
        level: 2,
        content: `Deployment targets: ${deploymentUnits.join(', ')}.`,
    });
    for (const unit of deploymentUnits) {
        sections.push({
            title: `Deploying to ${unit}`,
            level: 2,
            content: buildDeploymentInstructions(unit, knowledge),
        });
    }
    // SPEC-013: Mobile app installation guide sections
    const mobileApps = knowledge.apps.filter((app) => app.mobilePlatform === 'ios' ||
        app.mobilePlatform === 'android' ||
        app.mobilePlatform === 'cross-platform');
    if (mobileApps.length > 0) {
        sections.push({
            title: 'Mobile App Installation',
            level: 2,
            content: 'Instructions for distributing and installing the mobile app.',
        });
        for (const app of mobileApps) {
            sections.push({
                title: `${app.name} — ${app.mobilePlatform === 'ios' ? 'iOS' : 'Android'} Installation`,
                level: 3,
                content: buildMobileInstallGuide(app.mobilePlatform ?? 'ios'),
            });
        }
    }
    sections.push({
        title: 'Environment Configuration',
        level: 2,
        content: 'Ensure all required environment variables are configured in the deployment environment. See the Setup Guide.',
    });
    sections.push({
        title: 'Rollback Procedure',
        level: 2,
        content: 'Document your rollback procedure here. Include steps to revert to a previous version safely.',
    });
    const content = `# Deployment Guide\n\n` +
        sections.map((s) => `${'#'.repeat(s.level)} ${s.title}\n\n${s.content}`).join('\n\n');
    return {
        type: 'deployment-guide',
        title: 'Deployment Guide',
        path: 'docs/deployment.md',
        content,
        audience: 'ops',
        sections,
        diagrams: [generateDeploymentDiagram(knowledge)],
        relatedSpecs: [],
    };
}
//# sourceMappingURL=deployment-generator.js.map