/**
 * TtdMergeLoweringWitness — TTD-renderable merge surface summary.
 *
 * @module domain/services/merge/TtdMergeLoweringWitness
 */
import WarpError from "../../errors/WarpError.js";
import { TTD_MERGE_LOWERING_SURFACES, } from "./TtdMergeLoweringSurface.js";
import { freezeSortedTexts, requireNonNegativeInteger, } from "./TtdMergeValidation.js";
function requireSurface(surface) {
    if (!TTD_MERGE_LOWERING_SURFACES.includes(surface)) {
        throw new WarpError('merge lowering surface is invalid', 'E_TTD_MERGE_INSPECTION_INVALID');
    }
    return surface;
}
export default class TtdMergeLoweringWitness {
    surface;
    basisKeyCount;
    conflictKeyCount;
    keyOrder;
    constructor(fields) {
        this.surface = requireSurface(fields.surface);
        this.basisKeyCount = requireNonNegativeInteger(fields.basisKeyCount, 'basisKeyCount');
        this.conflictKeyCount = requireNonNegativeInteger(fields.conflictKeyCount, 'conflictKeyCount');
        this.keyOrder = freezeSortedTexts(fields.keyOrder, 'keyOrder');
        Object.freeze(this);
    }
}
