"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.interactive = void 0;
const inquirer_1 = __importDefault(require("inquirer"));
exports.interactive = (services, message, logger) => __awaiter(void 0, void 0, void 0, function* () {
    let chosenServices = [];
    logger.log('interactive').debug('Interactive option chosen, prompting user');
    logger.log('interactive').info(services.map((service) => service.getName()));
    const choices = yield inquirer_1.default.prompt({
        type: 'checkbox',
        name: 'microservices',
        message: message,
        choices: services.map((service) => service.getName()),
    });
    if (choices.microservices.length !== 0) {
        chosenServices = services.filter((s) => choices.microservices.includes(s.getName()));
    }
    else {
        logger.log('interactive').info('No services found, exiting...');
        process.exit(0);
    }
    return chosenServices;
});
//# sourceMappingURL=interactive.js.map