"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 });
const doc_1 = __importDefault(require("./doc"));
function generate(type, options) {
    return __awaiter(this, void 0, void 0, function* () {
        const generateHandler = {
            doc: doc_1.default, // 处理文档生成
        };
        if (Object.prototype.hasOwnProperty.call(generateHandler, type)) {
            yield generateHandler[type](options);
        }
    });
}
function execGenerate(options) {
    return __awaiter(this, void 0, void 0, function* () {
        // 理论上这里的options永远只会有一个key。之所以用Object.keys加forEach的组合，是为了应对key为任何值的情况，便于扩展
        Object.keys(options).forEach((type) => __awaiter(this, void 0, void 0, function* () {
            yield generate(type, options);
        }));
    });
}
exports.default = execGenerate;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9jb21tYW5kcy9nZW5lcmF0ZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OztBQUFBLGdEQUErQjtBQU0vQixTQUFlLFFBQVEsQ0FBQyxJQUFZLEVBQUUsT0FBZTs7UUFDbkQsTUFBTSxlQUFlLEdBQW1CO1lBQ3RDLEdBQUcsRUFBRSxhQUFXLEVBQUUsU0FBUztTQUM1QixDQUFBO1FBQ0QsSUFBSSxNQUFNLENBQUMsU0FBUyxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsZUFBZSxFQUFFLElBQUksQ0FBQyxFQUFFO1lBQy9ELE1BQU0sZUFBZSxDQUFDLElBQWEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFBO1NBQzlDO0lBQ0gsQ0FBQztDQUFBO0FBRUQsU0FBZSxZQUFZLENBQUMsT0FBZTs7UUFDekMsMEVBQTBFO1FBQzFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQU8sSUFBSSxFQUFFLEVBQUU7WUFDMUMsTUFBTSxRQUFRLENBQUMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxDQUFBO1FBQy9CLENBQUMsQ0FBQSxDQUFDLENBQUE7SUFDSixDQUFDO0NBQUE7QUFFRCxrQkFBZSxZQUFZLENBQUEifQ==