"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const addresses_mainnet_json_1 = __importDefault(require("../data/addresses.mainnet.json"));
const addresses_testnet_json_1 = __importDefault(require("../data/addresses.testnet.json"));
// Ensure that mainnet and testnet are typed as arrays
const mainnetData = addresses_mainnet_json_1.default;
const testnetData = addresses_testnet_json_1.default;
const extractUniqueValues = (data, key) => {
    const allValues = data.filter((item) => item[key] !== undefined).map((item) => item[key].toString());
    return [...new Set(allValues)];
};
const generateTypesForKeys = (keys) => {
    const networks = [...mainnetData, ...testnetData];
    let typeDefs = "";
    keys.forEach((key) => {
        const uniqueValues = extractUniqueValues(networks, key);
        if (uniqueValues.length > 0) {
            const isNumeric = uniqueValues.every((value) => !isNaN(Number(value)));
            const formattedValues = isNumeric ? uniqueValues.join(" | ") : `"${uniqueValues.join('" | "')}"`;
            typeDefs += `export type Param${toCamelCase(key, true)} = ${formattedValues};\n`;
        }
    });
    console.log(typeDefs);
};
// Modify this function to handle underscores and capitalize each word
const toCamelCase = (string, capitalizeFirst = false) => {
    return string
        .split("_")
        .map((word, index) => {
        if (index === 0) {
            return capitalizeFirst ? word.charAt(0).toUpperCase() + word.slice(1) : word;
        }
        return word.charAt(0).toUpperCase() + word.slice(1);
    })
        .join("");
};
const keysToGenerate = ["symbol", "chain_name", "type"];
generateTypesForKeys(keysToGenerate);
