/**
 * T202: Deterministic heuristic confidence (heuristic_1) — no ML.
 * Callable from ingestion without coupling to file parsers.
 */
/** Admission threshold on score; inclusive. */
export const HEURISTIC_1_ADMISSION_THRESHOLD = 0.35;
export function computeHeuristicConfidence(kind, signals) {
    const reasons = [];
    const candidates = [];
    if (signals.transcriptFriction !== undefined) {
        candidates.push(signals.transcriptFriction);
        reasons.push(`transcriptFriction=${signals.transcriptFriction.toFixed(3)}`);
    }
    if (signals.diffImpact !== undefined) {
        candidates.push(signals.diffImpact);
        reasons.push(`diffImpact=${signals.diffImpact.toFixed(3)}`);
    }
    if (signals.policyDenial !== undefined) {
        candidates.push(signals.policyDenial);
        reasons.push(`policyDenial=${signals.policyDenial.toFixed(3)}`);
    }
    if (signals.mutationRejection !== undefined) {
        candidates.push(signals.mutationRejection);
        reasons.push(`mutationRejection=${signals.mutationRejection.toFixed(3)}`);
    }
    if (signals.taskFriction !== undefined) {
        candidates.push(signals.taskFriction);
        reasons.push(`taskFriction=${signals.taskFriction.toFixed(3)}`);
    }
    if (candidates.length === 0) {
        return { score: 0, tier: "low", reasons: [`no-signals:${kind}`] };
    }
    const score = Math.max(...candidates);
    let tier = "low";
    if (score >= 0.72)
        tier = "high";
    else if (score >= 0.5)
        tier = "medium";
    return { score, tier, reasons };
}
export function shouldAdmitRecommendation(result) {
    return result.score >= HEURISTIC_1_ADMISSION_THRESHOLD;
}
export function priorityForTier(tier) {
    if (tier === "high")
        return "P1";
    if (tier === "medium")
        return "P2";
    return "P3";
}
