import ContentAttachmentRecord from "./ContentAttachmentRecord.js";
import WarpError from "../errors/WarpError.js";
export const GRAPH_CONTENT_ATTACHMENT_SET_OP = 'GraphContentAttachmentSet';
/** Runtime-backed graph operation that records a typed content attachment. */
export default class GraphContentAttachmentSetOp {
    type = GRAPH_CONTENT_ATTACHMENT_SET_OP;
    record;
    constructor(fields) {
        const checkedFields = requireFields(fields);
        this.record = requireContentAttachmentRecord(checkedFields.record);
        Object.freeze(this);
    }
}
/** Validates the graph-content operation constructor envelope. */
function requireFields(fields) {
    if (fields === null || fields === undefined) {
        throw new WarpError('GraphContentAttachmentSetOp fields must be provided', 'E_VALIDATION');
    }
    return fields;
}
/** Requires a runtime-backed content attachment record. */
function requireContentAttachmentRecord(record) {
    if (!(record instanceof ContentAttachmentRecord)) {
        throw new WarpError('GraphContentAttachmentSetOp record must be a ContentAttachmentRecord', 'E_VALIDATION');
    }
    return record;
}
