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