import VisibleNodePropertyRecord from "./VisibleNodePropertyRecord.js";
import WarpError from "../errors/WarpError.js";
export const GRAPH_NODE_PROPERTY_SET_OP = 'GraphNodePropertySet';
/** Runtime-backed graph operation for a node property compatibility fact. */
export default class GraphNodePropertySetOp {
    type = GRAPH_NODE_PROPERTY_SET_OP;
    record;
    constructor(fields) {
        const checkedFields = requireFields(fields);
        this.record = requireNodePropertyRecord(checkedFields.record);
        Object.freeze(this);
    }
}
/** Validates the graph-node-property operation constructor envelope. */
function requireFields(fields) {
    if (fields === null || fields === undefined) {
        throw new WarpError('GraphNodePropertySetOp fields must be provided', 'E_VALIDATION');
    }
    return fields;
}
/** Requires a runtime-backed visible node property record. */
function requireNodePropertyRecord(record) {
    if (!(record instanceof VisibleNodePropertyRecord)) {
        throw new WarpError('GraphNodePropertySetOp record must be a VisibleNodePropertyRecord', 'E_VALIDATION');
    }
    return record;
}
