/**
 * Nexus Prime -- Proof Builder
 *
 * Factory functions that construct strongly-typed proof payloads
 * and wrap them in auditable envelopes.
 */
import { randomUUID } from 'node:crypto';
/* ------------------------------------------------------------------ */
/*  Builders                                                           */
/* ------------------------------------------------------------------ */
export function buildSelectionProof(params) {
    return {
        selectedFiles: params.selectedFiles,
        rejectedFiles: params.rejectedFiles,
        selectedArtifacts: params.selectedArtifacts,
        rejectedArtifacts: params.rejectedArtifacts,
        selectorPrecedenceUsed: params.selectorPrecedenceUsed,
        dominantReason: params.dominantReason,
        confidence: params.confidence,
    };
}
export function buildWorkerProof(params) {
    return {
        topology: params.topology,
        lanes: params.lanes,
        whyThisTopology: params.whyThisTopology,
        alternativesRejected: params.alternativesRejected,
    };
}
export function buildVerificationProof(params) {
    return {
        checks: params.checks,
        contradictions: params.contradictions,
        verdict: params.verdict,
    };
}
export function buildMemoryPromotionProof(params) {
    return {
        sourceRunIds: params.sourceRunIds,
        evidence: params.evidence,
        conflicts: params.conflicts,
        promotionClass: params.promotionClass,
        verdict: params.verdict,
    };
}
export function buildApplyProof(params) {
    return {
        mergeDecision: params.mergeDecision,
        rollbackConsidered: params.rollbackConsidered,
        verifierGate: params.verifierGate,
        finalVerdict: params.finalVerdict,
    };
}
/* ------------------------------------------------------------------ */
/*  Envelope                                                           */
/* ------------------------------------------------------------------ */
export function wrapInEnvelope(runId, type, proof) {
    return {
        id: randomUUID(),
        runId,
        type,
        createdAt: Date.now(),
        proof,
    };
}
