"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigateStep = void 0;
const MablStepV2_1 = require("../MablStepV2");
const MablAction_1 = require("../MablAction");
const MablSymbol_1 = require("../MablSymbol");
class NavigateStep extends MablStepV2_1.MablStepV2 {
    static stepName = 'Navigate';
    static actionCode = 'navigate';
    static mablScriptStepNames = [NavigateStep.actionCode];
    static yamlMablScriptNames = [NavigateStep.stepName];
    navigation;
    constructor(descriptor) {
        super(NavigateStep.stepName, descriptor, NavigateStep.actionCode);
        this.navigation = descriptor.navigation;
    }
    getStepName() {
        return NavigateStep.stepName;
    }
    static fromYaml(_stepName, stepArgs) {
        return new NavigateStep(stepArgs);
    }
    static fromLegacyMablscript(args, _actions) {
        const navigation = (0, MablSymbol_1.isMablSymbolObject)(args[0])
            ? (0, MablSymbol_1.formatSymbol)(args[0])
            : args[0];
        const stepDescriptor = {
            navigation,
            actionCode: NavigateStep.actionCode,
        };
        const step = new NavigateStep(stepDescriptor);
        step.actions = _actions;
        return step;
    }
    toMablscript() {
        return `navigate("${this.navigation}")`;
    }
    getInputVariables() {
        return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.navigation);
    }
    stepDescription() {
        return `Navigate to "${this.navigation}"`;
    }
    static create(descriptor) {
        descriptor.id = descriptor.id ?? MablStepV2_1.MablStepV2.generateStepId();
        return new NavigateStep(descriptor);
    }
}
exports.NavigateStep = NavigateStep;
