/**
 * BackupRetentionAdapter -- P4-RET-04 Backup retention interface (AC 15)
 *
 * Documented-only in this phase. This interface stubs the backup retention
 * integration for future phases. The retention matrix is exported as a
 * retention-schedule.json artefact at:
 *   GET /api/v1/retention/backup-schedule/:tenantId
 *
 * The operator feeds this JSON to their backup tool (e.g. Veeam, AWS Backup,
 * Azure Backup) to configure backup retention matching the compliance policy.
 * No direct integration is built in this phase.
 *
 * Spec: P4-RET-01 Section 2.4, AC 15
 *
 * @connexum/ai-governance
 */
import { DataClass } from './data-class.js';
// ---------------------------------------------------------------------------
// buildRetentionSchedule()
// ---------------------------------------------------------------------------
/**
 * Build a RetentionSchedule artefact for a tenant from PolicyMatrix output.
 * This is the artefact exported at GET /api/v1/retention/backup-schedule/:tenantId.
 *
 * @param tenantId    Tenant to build schedule for.
 * @param contractId  Contract ID for PolicyMatrix resolution.
 * @param packBinding Active packs.
 * @param matrix      Configured PolicyMatrix instance.
 * @returns           RetentionSchedule ready for JSON serialisation and export.
 */
export function buildRetentionSchedule(tenantId, contractId, packBinding, matrix) {
    const entries = [];
    const generatedAt = new Date().toISOString();
    for (const dataClass of Object.values(DataClass)) {
        let resolved;
        try {
            resolved = matrix.resolve({
                tenantId,
                contractId,
                dataClass,
                packBinding,
            });
        }
        catch {
            // No policy for this data class -- omit from schedule
            continue;
        }
        entries.push({
            dataClass,
            retentionDays: resolved.retentionDays,
            action: resolved.action,
            archiveZone: resolved.archiveZone,
            jurisdiction: resolved.jurisdiction,
            policySource: resolved.policySource,
            strictestBoundBy: resolved.strictestBoundBy,
        });
    }
    return {
        tenantId,
        contractId,
        packBinding,
        generatedAt,
        entries,
    };
}
//# sourceMappingURL=backup-retention-adapter.js.map