"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AUTOGENERATED_WHOLEFILE_MCFUNCTION_SEPARATOR = void 0;
const Action_1 = require("../actions/Action");
const ActionGroup_1 = require("../actions/ActionGroup");
exports.AUTOGENERATED_WHOLEFILE_MCFUNCTION_SEPARATOR = "# ===== AUTOGENERATED FILE ===== CONTENT WITHIN THIS FILE WILL BE WIPED AND UPDATED WHEN USED IN TOOLING";
class ActionSetCommandGenerator {
    static generateMCFunction(actionSet) {
        const lines = ActionSetCommandGenerator.generateCommandLines(actionSet);
        return exports.AUTOGENERATED_WHOLEFILE_MCFUNCTION_SEPARATOR + "\n" + lines.join("\n");
    }
    static generateCommandLines(actionSet) {
        const lines = [];
        ActionSetCommandGenerator.addCommandLines(actionSet, lines);
        return lines;
    }
    static addCommandLines(actionSet, lines) {
        this.addCommandGroupLines(actionSet, lines, 0, {});
    }
    static addCommandGroupLines(actionGroup, lines, indent, options) {
        const req = {};
        for (const action of actionGroup.actions) {
            if (action instanceof Action_1.default) {
                ActionGroup_1.default.mergeCommandRequirements(req, action.getCommandRequirements(options));
            }
        }
        for (const action of actionGroup.actions) {
            if (action instanceof Action_1.default) {
                action.addCommandLines(lines, indent, options);
            }
        }
    }
}
exports.default = ActionSetCommandGenerator;

//# sourceMappingURL=../maps/script/ActionSetCommandGenerator.js.map
