"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MainContractGen = void 0;
const constructorGen_1 = require("./generators/constructorGen");
const contractEndGen_1 = require("./generators/contractEndGen");
const contractStartGen_1 = require("./generators/contractStartGen");
const dynamicRefFuncGen_1 = require("./generators/dynamicRefFuncGen");
const fieldFuncGen_1 = require("./generators/fieldFuncGen");
const generalFuncGen_1 = require("./generators/generalFuncGen");
const headerGen_1 = require("./generators/headerGen");
const memberVars_1 = require("./generators/memberVars");
const metadataStructGen_1 = require("./generators/metadataStructGen");
const mintFuncGen_1 = require("./generators/mintFuncGen");
const overrideFuncGen_1 = require("./generators/overrideFuncGen");
const packFuncGen_1 = require("./generators/packFuncGen");
const patchFuncGen_1 = require("./generators/patchFuncGen");
const schemaFuncGen_1 = require("./generators/schemaFuncGen");
const staticRefFuncGen_1 = require("./generators/staticRefFuncGen");
class MainContractGen {
    constructor() {
        this.gens = new Map();
        this.gens.set("header", new headerGen_1.HeaderGen());
        this.gens.set("contractStart", new contractStartGen_1.ContractStartGen());
        this.gens.set("constructor", new constructorGen_1.ConstructorGen());
        this.gens.set("metadataStruct", new metadataStructGen_1.MetadataStructGen());
        this.gens.set("memberVars", new memberVars_1.MemberVarsGen());
        this.gens.set("generalFuncs", new generalFuncGen_1.GeneralFuncGen());
        this.gens.set("schemaFuncs", new schemaFuncGen_1.SchemaFuncGen());
        this.gens.set("packFuncs", new packFuncGen_1.PackFuncGen());
        this.gens.set("mintFuncs", new mintFuncGen_1.MintFuncGen());
        this.gens.set("fieldFuncs", new fieldFuncGen_1.FieldFuncGen());
        this.gens.set("staticRefFuncs", new staticRefFuncGen_1.StaticRefFuncGen());
        this.gens.set("dynamicRefFuncs", new dynamicRefFuncGen_1.DynamicRefFuncGen());
        this.gens.set("overrides", new overrideFuncGen_1.OverrideFuncGen());
        this.gens.set("contractEnd", new contractEndGen_1.ContractEndGen());
        this.gens.set("patchFuncs", new patchFuncGen_1.PatchFuncGen());
        this.gens.set("nl", { gen: (schema) => '\n' });
    }
    gen(schema) {
        return this.appendGens([
            "header",
            "nl",
            "contractStart",
            "nl",
            "metadataStruct",
            "nl",
            "memberVars",
            "constructor",
            "nl",
            "generalFuncs",
            "schemaFuncs",
            "nl",
            "patchFuncs",
            "packFuncs",
            "mintFuncs",
            "fieldFuncs",
            "staticRefFuncs",
            "dynamicRefFuncs",
            "overrides",
            "contractEnd"
        ], schema);
    }
    appendGens(names, schema) {
        let output = "";
        for (let name of names) {
            output = this.appendGen(name, schema, output);
        }
        return output;
    }
    appendGen(name, schema, output) {
        return output + this.gens.get(name)?.gen(schema);
    }
}
exports.MainContractGen = MainContractGen;
