import GraphModelMigrationScratchRef from "./GraphModelMigrationScratchRef.js";
import { requireGraphModelMigrationNonEmptyString } from "./GraphModelMigrationRequiredString.js";
import WarpError from "../errors/WarpError.js";
/** Request to replay scratch migration output through normal graph runtime. */
export default class GraphModelMigrationRuntimeReplayRequest {
    graphId;
    writerId;
    scratchRef;
    scratchHead;
    constructor(fields) {
        const checkedFields = requireFields(fields);
        this.graphId = requireGraphModelMigrationNonEmptyString(checkedFields.graphId, 'graphId');
        this.writerId = requireGraphModelMigrationNonEmptyString(checkedFields.writerId, 'writerId');
        this.scratchRef = requireScratchRef(checkedFields.scratchRef);
        this.scratchHead = requireGraphModelMigrationNonEmptyString(checkedFields.scratchHead, 'scratchHead');
        Object.freeze(this);
    }
}
function requireFields(fields) {
    if (fields === null || fields === undefined) {
        throw new WarpError('GraphModelMigrationRuntimeReplayRequest fields must be provided', 'E_VALIDATION');
    }
    return fields;
}
function requireScratchRef(scratchRef) {
    if (!(scratchRef instanceof GraphModelMigrationScratchRef)) {
        throw new WarpError('scratchRef must be a GraphModelMigrationScratchRef', 'E_VALIDATION');
    }
    return scratchRef;
}
