"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenerateReport = void 0;
const feature_collector_1 = require("../feature-collector/feature-collector");
const collect_jsons_1 = require("../collect-jsons/collect-jsons");
const GenerateHtml_1 = require("./helpers/GenerateHtml");
const mongoose_helper_1 = require("../mongoose-report-manager/mongoose-helper");
const SuiteFormatter_1 = require("./ReportObjectsFormatters/SuiteFormatter");
const UserPropertiesValidation_1 = require("./helpers/UserPropertiesValidation");
class GenerateReport {
    constructor() {
    }
    async generate(userProperties) {
        userProperties = await UserPropertiesValidation_1.userPropertiesValidation.checkParameters(userProperties);
        const features = await new feature_collector_1.CollectFeatureFiles(userProperties).collectFeatures();
        const jsonFiles = await new collect_jsons_1.CollectJsons(userProperties).createJoinedJson();
        const jsonReport = await new SuiteFormatter_1.SuiteFactory(userProperties).parseJsons(jsonFiles, features);
        let reportId = null;
        if (userProperties.saveReportInMongoDb) {
            reportId = await new mongoose_helper_1.MongooseHelper(userProperties).insertReport(jsonReport);
        }
        await new GenerateHtml_1.GenerateHtml(jsonReport, userProperties).createHtmlPages();
        return reportId;
    }
    async generateHtmlReport(userProperties, jsonReport) {
        userProperties = await UserPropertiesValidation_1.userPropertiesValidation.checkParameters(userProperties);
        await new GenerateHtml_1.GenerateHtml(jsonReport, userProperties).createHtmlPages();
    }
}
exports.GenerateReport = GenerateReport;
//# sourceMappingURL=GenerateReport.js.map