"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/*
 * Copyright (c) 2019, salesforce.com, inc.
 * All rights reserved.
 * Licensed under the BSD 3-Clause license.
 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
 */
const path = require("path");
const utils_1 = require("../utils");
const baseGenerator_1 = require("./baseGenerator");
class ApexTriggerGenerator extends baseGenerator_1.BaseGenerator {
    validateOptions() {
        utils_1.CreateUtil.checkInputs(this.options.triggername);
        utils_1.CreateUtil.checkInputs(this.options.template);
    }
    generate() {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const { template, triggername, triggerevents, sobject } = this.options;
            this.sourceRootWithPartialPath('apextrigger');
            yield this.render(this.templatePath(`${template}.trigger`), this.destinationPath(path.join(this.outputdir, `${triggername}.trigger`)), { triggername, sobject, triggerEvents: triggerevents });
            yield this.render(this.templatePath('_trigger.trigger-meta.xml'), this.destinationPath(path.join(this.outputdir, `${triggername}.trigger-meta.xml`)), { apiVersion: this.apiversion });
        });
    }
}
exports.default = ApexTriggerGenerator;
//# sourceMappingURL=apexTriggerGenerator.js.map