"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TapStep = void 0;
const MablStepV2_1 = require("../../MablStepV2");
const TapStepDescriptor_1 = require("../../types/mobile/TapStepDescriptor");
const MobileFindAction_1 = require("./actions/MobileFindAction");
const stepUtil_1 = require("./stepUtil");
const MablAction_1 = require("../../MablAction");
class TapStep extends MablStepV2_1.MablStepV2 {
    static stepName = 'Tap';
    static yamlMablScriptNames = [TapStep.stepName];
    findAction;
    static stepVersion = 2;
    constructor(descriptor) {
        super(TapStep.stepName, descriptor, 'tap');
        this.findAction = MobileFindAction_1.MobileFindAction.fromDescriptor(this.descriptor.find);
        this.actions = [this.findAction];
    }
    getInputVariables() {
        const { find } = this.descriptor;
        return MablAction_1.MablAction.findUniqueVariableReferencesInValue(find);
    }
    stepDescription() {
        let prependedText;
        switch (this.descriptor.type) {
            case TapStepDescriptor_1.TapType.long:
                prependedText = `Perform long press on `;
                break;
            default:
                prependedText = `Tap on`;
        }
        return (0, stepUtil_1.getDescriptionForMobileStepDescriptor)(prependedText, this.descriptor);
    }
    static fromYaml(_stepName, stepDescriptor) {
        return new TapStep(stepDescriptor);
    }
    static create(descriptor) {
        descriptor.id = descriptor.id ?? MablStepV2_1.MablStepV2.generateStepId();
        return new TapStep(descriptor);
    }
}
exports.TapStep = TapStep;
