import { isEntityEvidenceGapDiagnostic } from './evidence.js';
/**
 * Classify exactly what an entity diff's emitted evidence proves.
 *
 * Counts intentionally come from `structuralChange`, not change names or flags.
 * A proved logic change remains proved under partial coverage, while a semantic
 * no-op requires complete evidence across every observed axis.
 */
export function classifyEntityDiffSemantics(result) {
    const counts = { logic: 0, cosmetic: 0, unknown: 0 };
    for (const change of result.changes) {
        if (change.structuralChange === true)
            counts.logic++;
        else if (change.structuralChange === false)
            counts.cosmetic++;
        else
            counts.unknown++;
    }
    const evidenceDiagnostics = result.diagnostics.filter(isEntityEvidenceGapDiagnostic);
    const evidenceGaps = {
        truncated: result.truncated,
        omitted: result.omitted,
        unknownStructuralChanges: counts.unknown,
        diagnostics: evidenceDiagnostics,
    };
    if (result.status === 'error') {
        return { scope: 'entity-records', verdict: 'unknown', coverage: 'unavailable', counts, evidenceGaps };
    }
    const complete = !result.truncated && result.omitted === 0 && counts.unknown === 0 && evidenceDiagnostics.length === 0;
    const coverage = complete ? 'complete' : 'partial';
    const verdict = counts.logic > 0 ? 'logic-change' : complete ? 'semantic-no-op' : 'unknown';
    return { scope: 'entity-records', verdict, coverage, counts, evidenceGaps };
}
//# sourceMappingURL=semantic.js.map