"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyBrowserAndEnvOptions = applyBrowserAndEnvOptions;
const constants_1 = require("../constants");
const constants_2 = require("@mablhq-internal/runtime/core/constants");
const browserTypes_1 = require("@mablhq-internal/runtime/core/browserTypes");
const mablApi_1 = require("@mablhq-internal/runtime/mablApi");
function applyBrowserAndEnvOptions(yargs) {
    return yargs
        .option(constants_2.CommandArgEnvironmentId, {
        alias: constants_1.CommandArgAliases.EnvironmentId,
        describe: 'Mabl environment ID to load environment variables from. Setting the environment does not override the default URL — use --url for that.',
        nargs: 1,
        type: 'string',
    })
        .option(constants_2.CommandArgUrl, {
        alias: constants_1.CommandArgAliases.Url,
        describe: 'URL to run the test against',
        nargs: 1,
        type: 'string',
    })
        .option(constants_2.CommandArgCredentials, {
        alias: constants_1.CommandArgAliases.Credentials,
        describe: 'Credentials ID to run the test with',
        nargs: 1,
        type: 'string',
    })
        .option(constants_2.CommandArgBasicAuthCredentials, {
        alias: constants_1.CommandArgAliases.BasicAuthCredentials,
        describe: 'Basic Authentication credentials ID for adding basic auth headers to the test run',
        nargs: 1,
        type: 'string',
    })
        .option(constants_1.CommandArgBrowser, {
        describe: `Target browser for the test run. One of ${constants_1.ValidBrowserTypesForLocalRuns.join(', ')}. Defaults to ${browserTypes_1.DefaultBrowserType}.`,
        type: 'string',
        nargs: 1,
        choices: constants_1.ValidBrowserTypesForLocalRuns,
    })
        .option(constants_1.CommandArgWidth, {
        describe: 'Browser viewport width in pixels',
        default: constants_1.DEFAULT_BROWSER_WIDTH,
        nargs: 1,
        type: 'number',
    })
        .option(constants_1.CommandArgHeight, {
        describe: 'Browser viewport height in pixels',
        default: constants_1.DEFAULT_BROWSER_HEIGHT,
        nargs: 1,
        type: 'number',
    })
        .option(constants_1.CommandArgLocale, {
        describe: 'Locale to emulate, e.g. en-US',
        nargs: 1,
        type: 'string',
    })
        .option(constants_1.CommandArgTimezoneID, {
        describe: 'Timezone identifier to emulate, e.g. America/New_York',
        nargs: 1,
        type: 'string',
    })
        .option(constants_1.CommandArgUserAgent, {
        describe: 'Emulate a custom User-Agent string (e.g. "Mozilla/5.0 …")',
        type: 'string',
    })
        .option(constants_1.CommandArgTestInteractionSpeed, {
        describe: 'Speed at which mabl interacts with web pages. Overrides test run settings if specified.',
        type: 'string',
        choices: Object.keys(mablApi_1.TestParameters.PageLoadWaitEnum).map((s) => s.toLowerCase()),
    })
        .option(constants_2.CommandArgMablBranch, {
        describe: 'Mabl branch to load test and flows from',
        nargs: 1,
        type: 'string',
    })
        .option(constants_1.CommandArgHeadless, {
        describe: 'Run the browser in headless mode',
        default: false,
        type: 'boolean',
    });
}
