"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
    for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
        to[j] = from[i];
    return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.argMapping = exports.ignoredArguments = void 0;
var url = require("url");
var filesystem_1 = require("./filesystem");
exports.ignoredArguments = [
    'requestFilter',
    'stateHandlers',
    'messageProviders',
    'changeOrigin',
    'beforeEach',
    'afterEach',
    'validateSSL',
];
exports.argMapping = {
    providerBaseUrl: function (providerBaseUrl) {
        var u = url.parse(providerBaseUrl);
        return u && u.port && u.hostname
            ? ['--port', u.port, '--hostname', u.hostname]
            : [];
    },
    logLevel: function (logLevel) { return ['--loglevel', logLevel]; },
    provider: { arg: '--provider-name', mapper: 'string' },
    pactUrls: function (pactUrls) {
        return pactUrls.reduce(function (acc, uri) {
            switch (filesystem_1.getUriType(uri)) {
                case 'URL':
                    return __spreadArray(__spreadArray([], acc), ['--url', uri]);
                case 'DIRECTORY':
                    return __spreadArray(__spreadArray([], acc), ['--dir', uri]);
                case 'FILE':
                    return __spreadArray(__spreadArray([], acc), ['--file', uri]);
                default:
                    return acc;
            }
        }, []);
    },
    pactBrokerUrl: { arg: '--broker-url', mapper: 'string' },
    pactBrokerUsername: { arg: '--user', mapper: 'string' },
    pactBrokerPassword: { arg: '--password', mapper: 'string' },
    pactBrokerToken: { arg: '--broker-token', mapper: 'string' },
    consumerVersionTags: function (tags) { return [
        '--consumer-version-tags',
        Array.isArray(tags) ? tags.join(',') : tags,
    ]; },
    providerVersionTags: function (tags) { return [
        '--provider-tags',
        Array.isArray(tags) ? tags.join(',') : tags,
    ]; },
    providerStatesSetupUrl: { arg: '--state-change-url', mapper: 'string' },
    providerVersion: { arg: '--provider-version', mapper: 'string' },
    includeWipPactsSince: { arg: '--include-wip-pacts-since', mapper: 'string' },
    consumerVersionSelectors: function (selectors) {
        return selectors
            .map(function (s) { return [
            '--consumer-version-selectors',
            JSON.stringify(s),
        ]; })
            .reduce(function (acc, current) { return __spreadArray(__spreadArray([], acc), current); }, []);
    },
    publishVerificationResult: { arg: '--publish', mapper: 'flag' },
    enablePending: { arg: '--enable-pending', mapper: 'flag' },
    timeout: { arg: '--request-timeout', mapper: 'string' },
    format: {
        warningMessage: "All output is now on standard out, setting 'format' has no effect",
    },
    out: {
        warningMessage: "All output is now on standard out, setting 'out' has no effect",
    },
    logDir: {
        warningMessage: 'Setting logDir is deprecated as all logs are now on standard out',
    },
    verbose: {
        warningMessage: "Verbose mode is deprecated and has no effect, please use logLevel: 'DEBUG' instead",
    },
    monkeypatch: {
        warningMessage: 'The undocumented feature monkeypatch is no more, please file an issue if you were using it and need this functionality',
    },
    customProviderHeaders: {
        warningMessage: 'customProviderHeaders have been removed. This functionality is provided by request filters in a much more flexible way',
    },
};
//# sourceMappingURL=arguments.js.map