"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.humanizeEchoStep = humanizeEchoStep;
exports.echoStepToAIString = echoStepToAIString;
const mablscriptFind_1 = require("@mablhq/test-model/mablscriptFind");
const BaseStep_1 = __importDefault(require("./BaseStep"));
const variable_names_util_1 = require("../../variable-names-util");
const type_utils_1 = require("../../type-utils");
const mablscript_step_types_1 = require("../../mablscript-step-types");
const yaml_utils_1 = require("../yaml-utils");
class EchoStep extends BaseStep_1.default {
    static getStepType() {
        return mablscript_step_types_1.StepType.ECHO;
    }
    constructor(message) {
        super(EchoStep.getStepType());
        this.message = message;
        this.options = {
            editable: true,
        };
    }
    generateMablscript() {
        return `echo("${(0, mablscriptFind_1.escapeMablscriptString)(this.message)}")`;
    }
    inputVariables() {
        return (0, type_utils_1.distinct)((0, variable_names_util_1.extractVariableNamesFromPattern)(this.message));
    }
    static generateStepFromMablStep(mablEchoStep) {
        return new EchoStep(mablEchoStep.echoValue);
    }
    static create(descriptor) {
        const step = new EchoStep(descriptor.value);
        step.generateStepId();
        return step;
    }
}
exports.default = EchoStep;
function humanizeEchoStep(step) {
    return `Echo: "${step.message}"`;
}
function echoStepToAIString(step) {
    return (0, yaml_utils_1.toYaml)({
        stepType: step.stepType,
        message: step.message,
    });
}
