"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.humanizeNavigationStep = humanizeNavigationStep;
exports.navigationStepToAIString = navigationStepToAIString;
const mablscript_step_types_1 = require("../../mablscript-step-types");
const BaseStep_1 = __importDefault(require("./BaseStep"));
const yaml_utils_1 = require("../yaml-utils");
class NavigationStep extends BaseStep_1.default {
    static getStepType() {
        return mablscript_step_types_1.StepType.NAVIGATION;
    }
    constructor(navigationType) {
        super(NavigationStep.getStepType());
        this.navigationType = navigationType;
        this.options = {
            executionContext: 'background',
        };
    }
    generateMablscript() {
        return `navigate("${this.navigationType}")`;
    }
    inputVariables() {
        return [];
    }
    static generateStepFromMablStep(mablNavigateStep) {
        return new NavigationStep(mablNavigateStep.navigation);
    }
    static create(descriptor) {
        const step = new NavigationStep(descriptor.navigation);
        step.generateStepId();
        return step;
    }
}
exports.default = NavigationStep;
function humanizeNavigationStep(step) {
    switch (step.navigationType) {
        case 'reload':
            return `Page reload performed`;
    }
    throw new Error('Invalid step; humanized description cannot be generated.');
}
function navigationStepToAIString(step) {
    return (0, yaml_utils_1.toYaml)({
        stepType: step.stepType,
        type: step.navigationType,
    });
}
