"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HtmlReporter = void 0;
const eventemitter2_1 = __importDefault(require("eventemitter2"));
const constants_1 = require("./constants");
const server_1 = require("./db-utils/server");
const local_image_file_saver_1 = require("./local-image-file-saver");
const package_json_1 = require("../package.json");
class HtmlReporter extends eventemitter2_1.default {
    static create(config, options) {
        return new this(config, options);
    }
    constructor(config, { toolName } = {}) {
        super();
        this._config = config;
        this._values = {
            toolName: toolName ?? constants_1.ToolName.Testplane,
            extraItems: {},
            metaInfoExtenders: {},
            imagesSaver: local_image_file_saver_1.LocalImageFileSaver,
            reportsSaver: null
        };
        this._version = package_json_1.version;
    }
    get config() {
        return this._config;
    }
    get version() {
        return this._version;
    }
    get events() {
        return constants_1.PluginEvents;
    }
    addExtraItem(key, value) {
        this._values.extraItems[key] = value;
    }
    get extraItems() {
        return this._values.extraItems;
    }
    addMetaInfoExtender(key, value) {
        this._values.metaInfoExtenders[key] = value;
    }
    get metaInfoExtenders() {
        return this._values.metaInfoExtenders;
    }
    set imagesSaver(imagesSaver) {
        this.emit(constants_1.PluginEvents.IMAGES_SAVER_UPDATED, imagesSaver);
        this._values.imagesSaver = imagesSaver;
    }
    get imagesSaver() {
        return this._values.imagesSaver;
    }
    set reportsSaver(reportsSaver) {
        this._values.reportsSaver = reportsSaver;
    }
    get reportsSaver() {
        return this._values.reportsSaver;
    }
    get values() {
        return this._values;
    }
    downloadDatabases(...args) {
        return (0, server_1.downloadDatabases)(...args);
    }
    mergeDatabases(...args) {
        return (0, server_1.mergeDatabases)(...args);
    }
    getTestsTreeFromDatabase(...args) {
        return (0, server_1.getTestsTreeFromDatabase)(this.values.toolName, ...args);
    }
}
exports.HtmlReporter = HtmlReporter;
//# sourceMappingURL=plugin-api.js.map