"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordEnterAuthCodeExecutor = void 0;
const toolExecutor_types_1 = require("../toolExecutor-types");
const stepCapture_1 = require("../../background/capture/stepCapture");
const ENTER_AUTH_CODE_STEP_WAIT_TIME_MS = 2_000;
exports.recordEnterAuthCodeExecutor = {
    needsFind: () => true,
    getStepType: () => 'enter_auth_code',
    execute: async (payload, stateProvider, eventHandler, logger) => {
        if (!payload.find ||
            !payload.contextInfo ||
            !(0, toolExecutor_types_1.isFindOneEventMessage)(payload.find)) {
            logger.error('Record Enter Auth Code executor requires find and contextInfo');
            return {
                success: false,
            };
        }
        const findEvent = payload.find;
        findEvent.listener = 'enter-auth-code';
        return (0, toolExecutor_types_1.recordStepAndTrackResult)(() => (0, stepCapture_1.recordTrainedStep)(findEvent, payload.contextInfo, true, undefined, stateProvider, eventHandler), ENTER_AUTH_CODE_STEP_WAIT_TIME_MS, stateProvider, eventHandler, logger);
    },
};
