"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSpecsPerBots = void 0;
const currencies_1 = require("../../currencies");
const specs_1 = __importDefault(require("../../generated/specs"));
function getSpecsPerBots(seeds, filters = {}) {
    const filterFamilies = filters.families
        ?.split(",")
        .map(f => f.trim())
        .filter(Boolean) || [];
    const filterCurrencies = filters.currencies
        ?.split(",")
        .map(f => f.trim())
        .filter(Boolean) || [];
    // allSpecs allows to know and infer what are the coins to sync
    const specs = [];
    for (const family in specs_1.default) {
        if (filterFamilies.length > 0 && !filterFamilies.includes(family))
            continue;
        const familySpecs = specs_1.default[family];
        for (const key in familySpecs) {
            const spec = familySpecs[key];
            if (!(0, currencies_1.isCurrencySupported)(spec.currency) || spec.disabled) {
                continue;
            }
            if (filterCurrencies.length > 0 && !filterCurrencies.includes(spec.currency.id)) {
                continue;
            }
            specs.push({ spec, family, key });
        }
    }
    // prepare the jobs
    const specsPerBots = Object.keys(seeds).flatMap((seed, i) => {
        return specs.map(({ spec, family, key }, j) => {
            return {
                seed,
                env: {
                    SEED: seeds[seed],
                    SPECULOS_PID_OFFSET: String(i * specs.length + j),
                },
                spec,
                family,
                key,
            };
        });
    });
    return specsPerBots;
}
exports.getSpecsPerBots = getSpecsPerBots;
//# sourceMappingURL=logic.js.map