"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SfgeEnginePlugin = void 0;
const code_analyzer_engine_api_1 = require("@salesforce/code-analyzer-engine-api");
const config_1 = require("./config");
const messages_1 = require("./messages");
const engine_1 = require("./engine");
const java_version_identifier_1 = require("./java-version-identifier");
class SfgeEnginePlugin extends code_analyzer_engine_api_1.EnginePluginV1 {
    javaVersionIdentifier;
    constructor(javaVersionIdentifier = new java_version_identifier_1.RuntimeJavaVersionIdentifier()) {
        super();
        this.javaVersionIdentifier = javaVersionIdentifier;
    }
    getAvailableEngineNames() {
        return [engine_1.SfgeEngine.NAME];
    }
    describeEngineConfig(engineName) {
        validateEngineName(engineName);
        return config_1.SFGE_ENGINE_CONFIG_DESCRIPTION;
    }
    async createEngineConfig(engineName, configValueExtractor) {
        validateEngineName(engineName);
        return await (0, config_1.validateAndNormalizeConfig)(configValueExtractor, this.javaVersionIdentifier);
    }
    async createEngine(engineName, resolvedConfig) {
        validateEngineName(engineName);
        return new engine_1.SfgeEngine(resolvedConfig);
    }
}
exports.SfgeEnginePlugin = SfgeEnginePlugin;
function validateEngineName(engineName) {
    if (engineName !== engine_1.SfgeEngine.NAME) {
        throw new Error((0, messages_1.getMessage)('UnsupportedEngineName', engineName));
    }
}
//# sourceMappingURL=plugin.js.map