/**
 * Returns a map of environment variables known to CLI.
 * The keys of the map are names of environment variables,
 * and values are objects that include description and default value.
 *
 * @param {{name: string, version: string, description: string, bin: string}} cli - CLI metadata
 * @returns {Object} known environment variables map
 */
export const knownEnv = (cli) => {
    const prefix = cli.bin.toUpperCase() + '_';
    return {
        [prefix + 'ACTIVATE']: {
            default: undefined,
            description: 'Explicitly define, whether to activate new application version during deployment.'
        },
        [prefix + 'COLORS']: {
            default: 'true',
            description: 'Print colorized messages to TTY streams (stderr, stdout)'
        },
        [prefix + 'CONFIG']: {
            default: `$HOME/.${cli.bin}/config.yaml`,
            description: 'Path to CLI configuration file.'
        },
        [prefix + 'LOG_LEVEL']: {
            default: '3',
            description: 'CLI log level. 0 - no logs, 1 - error, 2 - warning, 3 - info, 5 - verbose.'
        },
        [prefix + 'MANIFEST_TEMPLATE']: {
            default: undefined,
            description: 'Path to JSON file that is used as base manifest.json ' +
                'during new application initialisation.'
        },
        [prefix + 'POLLING_DELAY']: {
            default: '2000',
            description: 'Delay (in milliseconds) between get deployment status API calls.'
        },
        [prefix + 'POLLING_MAX_ATTEMPTS']: {
            default: '120',
            description: 'Miximum number of attempts to poll deployment status, ' +
                'before considering deployment as failed.'
        },
        [prefix + 'SAVE_ZIP']: {
            default: 'false',
            description: 'Save the apps.zip (with content passed to upload API) to current working directory.'
        },
        [prefix + 'TRACE']: {
            default: undefined,
            description: 'Path to JSONL file to which CLI should dump trace logs.'
        },
        [prefix + 'XSAPP_TEMPLATE']: {
            default: undefined,
            description: 'Path to JSON file that is used as base xs-app.json ' +
                'during new application initialisation.'
        },
    };
};
