/* eslint-disable @typescript-eslint/unified-signatures */
import { HttpStep } from '../../HttpStep.js';
export const SetVariableStepKind = 'HttpAction#SetVariable';
export class SetVariableStep extends HttpStep {
    kind = SetVariableStepKind;
    /**
     * The name of the variable to set
     */
    name = '';
    constructor(nameOrInit) {
        super();
        if (!nameOrInit) {
            return;
        }
        if (typeof nameOrInit === 'object') {
            const typed = nameOrInit;
            this.new(typed);
        }
        else if (typeof nameOrInit === 'string') {
            this.new({
                kind: SetVariableStepKind,
                name: nameOrInit,
                enabled: true,
            });
        }
    }
    new(init) {
        super.new(init);
        this.kind = SetVariableStepKind;
        this.name = init.name;
    }
    checkValidity() {
        const { name } = this;
        return !!name;
    }
    toJSON() {
        const result = {
            ...super.toJSON(),
            kind: SetVariableStepKind,
            name: this.name,
        };
        return result;
    }
}
//# sourceMappingURL=SetVariableStep.js.map