"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.COMMANDS = void 0;
const commands_1 = __importDefault(require("./constants/commands"));
const www_1 = require("./init/www");
const utils_1 = require("./utils");
const EInit = {
    CREATE: 0,
    PROJECT_NAME: 1,
    TEMPLATES: 2,
};
const COMMANDS = ({ cmd }) => __awaiter(void 0, void 0, void 0, function* () {
    // let type = cmd[cmd.findIndex((item) => item === CMDS.init)];
    let message = JSON.stringify({ command: cmd });
    utils_1.logger.info(message);
    switch (cmd[EInit.CREATE]) {
        case commands_1.default.init:
            if (!cmd[EInit.PROJECT_NAME]) {
                utils_1.logger.error(`App name should be required`);
            }
            else {
                yield (0, www_1.createServerFolders)({ appName: cmd[EInit.PROJECT_NAME] });
            }
            break;
        default:
            utils_1.logger.error(`${cmd[EInit.CREATE]} : Command Not Found!`);
    }
});
exports.COMMANDS = COMMANDS;
