"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.incompatibleAddonsMsg = exports.missingAddonMsg = exports.clientAppPrompts = exports.DEFAULT_FETCHWITH = exports.DEFAULT_APPNAME = exports.FetchWith = void 0;
const chalk_1 = __importDefault(require("chalk"));
var FetchWith;
(function (FetchWith) {
    FetchWith["GraphQL"] = "GraphQL";
    FetchWith["REST"] = "REST";
})(FetchWith || (exports.FetchWith = FetchWith = {}));
/**
 * Default app name for the new app
 */
exports.DEFAULT_APPNAME = 'sitecore-jss-app';
exports.DEFAULT_FETCHWITH = FetchWith.GraphQL;
/**
 * Set of CLI prompts for the client-side app
 */
exports.clientAppPrompts = [
    {
        type: 'input',
        name: 'appName',
        message: 'What is the name of your app?',
        default: exports.DEFAULT_APPNAME,
        validate: (input) => {
            if (!/^[a-z\-_.]+$/.test(input)) {
                console.error(chalk_1.default.red(`${input} is not a valid name; you may use lowercase letters, hyphens, and underscores only.`));
                return false;
            }
            return true;
        },
        when: (answers) => {
            if (answers.yes && !answers.appName) {
                answers.appName = exports.DEFAULT_APPNAME;
            }
            return !answers.appName;
        },
    },
];
const missingAddonMsg = (source, missingAddon) => chalk_1.default.yellow(`Warning: ${source} add-on cannot be used without the ${missingAddon} add-on. This may cause unexpected results.`);
exports.missingAddonMsg = missingAddonMsg;
const incompatibleAddonsMsg = (source, incompatibleAddon) => chalk_1.default.yellow(`Warning: ${source} add-on is not compatible with ${incompatibleAddon} add-on. This may cause unexpected results.`);
exports.incompatibleAddonsMsg = incompatibleAddonsMsg;
