"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const xplat_1 = require("@nstudio/xplat");
const xplat_utils_1 = require("@nstudio/xplat-utils");
const schematics_1 = require("@angular-devkit/schematics");
const imports_1 = require("./imports");
const supportedHelpers = {
    imports: imports_1.config,
};
function default_1(options) {
    if (!options.name) {
        throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', 'Provide the name of the helper to generate.', 'nx g @nstudio/nativescript:helpers imports'));
    }
    const helperChain = [];
    const helpers = options.name.split(',');
    for (const helper of helpers) {
        if (supportedHelpers[helper]) {
            xplat_1.buildHelperChain(helper, options, supportedHelpers[helper], helperChain);
        }
        else {
            helperChain.push(schematics_1.noop());
        }
    }
    return schematics_1.chain([xplat_utils_1.prerun(), ...helperChain]);
}
exports.default = default_1;
