/**
 * ConflictDiagnostic — runtime-backed analysis warning or error.
 *
 * @module domain/types/conflict/ConflictDiagnostic
 */
import { requireNonEmptyString, requireEnum, freezeOptionalDiagnosticData } from "./validation.js";
const CTX = 'ConflictDiagnostic';
const VALID_SEVERITIES = new Set(['warning', 'error']);
/**
 * A runtime-backed diagnostic emitted during conflict analysis.
 *
 * Instances are frozen on construction.
 */
export default class ConflictDiagnostic {
    code;
    severity;
    message;
    data;
    /**
     * Creates a frozen ConflictDiagnostic.
     */
    constructor({ code, severity, message, data }) {
        this.code = requireNonEmptyString(code, 'code', CTX);
        this.severity = requireEnum(severity, VALID_SEVERITIES, { name: 'severity', context: CTX });
        this.message = requireNonEmptyString(message, 'message', CTX);
        this.data = freezeOptionalDiagnosticData(data);
        Object.freeze(this);
    }
}
