import WarpError from "../errors/WarpError.js";
export const GRAPH_MODEL_MIGRATION_FINALIZATION_CONFIRMATION = 'CONFIRM_GRAPH_MODEL_MIGRATION_FINALIZATION';
/** Explicit operator confirmation for graph-model migration finalization. */
export default class GraphModelMigrationFinalizationConfirmation {
    token;
    constructor(fields) {
        const checkedFields = requireFields(fields);
        this.token = requireFinalizationToken(checkedFields.token);
        Object.freeze(this);
    }
}
function requireFields(fields) {
    if (fields === null || fields === undefined) {
        throw new WarpError('GraphModelMigrationFinalizationConfirmation fields must be provided', 'E_VALIDATION');
    }
    return fields;
}
function requireFinalizationToken(token) {
    if (token !== GRAPH_MODEL_MIGRATION_FINALIZATION_CONFIRMATION) {
        throw new WarpError('finalization confirmation token is invalid', 'E_VALIDATION');
    }
    return token;
}
