import NodeRecord from "./NodeRecord.js";
import WarpError from "../errors/WarpError.js";
export const GRAPH_NODE_RECORD_SET_OP = 'GraphNodeRecordSet';
/** Runtime-backed graph operation that records a node skeleton. */
export default class GraphNodeRecordSetOp {
    type = GRAPH_NODE_RECORD_SET_OP;
    record;
    constructor(fields) {
        const checkedFields = requireFields(fields);
        this.record = requireNodeRecord(checkedFields.record);
        Object.freeze(this);
    }
}
/** Validates the graph-node operation constructor envelope. */
function requireFields(fields) {
    if (fields === null || fields === undefined) {
        throw new WarpError('GraphNodeRecordSetOp fields must be provided', 'E_VALIDATION');
    }
    return fields;
}
/** Requires a runtime-backed node record. */
function requireNodeRecord(record) {
    if (!(record instanceof NodeRecord)) {
        throw new WarpError('GraphNodeRecordSetOp record must be a NodeRecord', 'E_VALIDATION');
    }
    return record;
}
