"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRiskCategorySeverityMap = getRiskCategorySeverityMap;
exports.getUnifiedConfig = getUnifiedConfig;
const constants_1 = require("./constants");
function getRiskCategorySeverityMap(plugins) {
    const overrides = plugins?.reduce((acc, plugin) => {
        if (plugin.severity) {
            acc[plugin.id] = plugin.severity;
        }
        return acc;
    }, {}) || {};
    return {
        ...constants_1.riskCategorySeverityMap,
        ...overrides,
    };
}
function getUnifiedConfig(config) {
    return {
        description: config.description,
        targets: [config.target],
        prompts: config.prompts,
        redteam: {
            purpose: config.purpose,
            numTests: config.numTests,
            plugins: config.plugins.map((plugin) => {
                if (typeof plugin === 'string') {
                    return { id: plugin };
                }
                return {
                    id: plugin.id,
                    ...(plugin.config && Object.keys(plugin.config).length > 0 && { config: plugin.config }),
                };
            }),
            strategies: config.strategies.map((strategy) => {
                if (typeof strategy === 'string') {
                    return { id: strategy };
                }
                return {
                    id: strategy.id,
                    ...(strategy.config &&
                        Object.keys(strategy.config).length > 0 && { config: strategy.config }),
                };
            }),
        },
    };
}
//# sourceMappingURL=sharedFrontend.js.map