/**
 * MergeClassification — result label emitted by MergeClassifier.
 *
 * @module domain/services/merge/MergeClassification
 */
import WarpError from "../../errors/WarpError.js";
const KINDS = Object.freeze(['projection', 'semantic', 'governance']);
const CONFIDENCES = Object.freeze(['high', 'medium']);
function validateKind(kind) {
    if (!KINDS.includes(kind)) {
        throw new WarpError('merge classification kind is invalid', 'E_MERGE_CLASSIFIER_INVALID_KIND');
    }
    return kind;
}
function validateConfidence(confidence) {
    if (!CONFIDENCES.includes(confidence)) {
        throw new WarpError('merge classification confidence is invalid', 'E_MERGE_CLASSIFIER_INVALID_CONFIDENCE');
    }
    return confidence;
}
function validateReasonCodes(reasonCodes) {
    if (reasonCodes.length === 0 || reasonCodes.some((code) => code.length === 0)) {
        throw new WarpError('merge classification requires non-empty reason codes', 'E_MERGE_CLASSIFIER_INVALID_REASON');
    }
    return Object.freeze([...reasonCodes]);
}
export default class MergeClassification {
    kind;
    confidence;
    reasonCodes;
    constructor(fields) {
        this.kind = validateKind(fields.kind);
        this.confidence = validateConfidence(fields.confidence);
        this.reasonCodes = validateReasonCodes(fields.reasonCodes);
        Object.freeze(this);
    }
}
