"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContractStartGen = void 0;
const contractSchema_1 = require("../contractSchema");
const utils_1 = require("../utils");
class ContractStartGen {
    gen(schema) {
        let inheritance = this.getBaseInheritance(schema.features);
        if (schema.hasLiteRef()) {
            inheritance.push("PatchworkLiteRef");
        }
        return `contract ${(0, utils_1.capitalizeFirstLetter)(schema.name)} is ${inheritance.join(", ")} {\n`;
    }
    getBaseInheritance(features) {
        let inheritance = [];
        if (features.some((feature) => feature === contractSchema_1.Feature.PATCH)) {
            inheritance.push(`PatchworkPatch`);
        }
        if (features.some((feature) => feature === contractSchema_1.Feature.PATCH1155)) {
            inheritance.push(`Patchwork1155Patch`);
        }
        if (features.some((feature) => feature === contractSchema_1.Feature.PATCHACCOUNT)) {
            inheritance.push(`PatchworkAccountPatch`);
        }
        if (features.some((feature) => feature === contractSchema_1.Feature.FRAGMENTMULTI)) {
            inheritance.push(`PatchworkFragmentMulti`);
        }
        if (features.some((feature) => feature === contractSchema_1.Feature.FRAGMENTSINGLE)) {
            inheritance.push(`PatchworkFragmentSingle`);
        }
        // If no specific feature is found, default to Patchwork721
        if (inheritance.length === 0) {
            inheritance.push(`Patchwork721`);
        }
        return inheritance;
    }
}
exports.ContractStartGen = ContractStartGen;
