"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const LocalDevTelemetryOptions_1 = __importDefault(require("./LocalDevTelemetryOptions"));
const telemetryReporter_1 = require("@salesforce/telemetry/lib/telemetryReporter");
class LocalDevTelemetryReporter {
    constructor(reporter) {
        this.reporter = reporter;
    }
    trackApplicationStart(duration, fromVSCode, apiVersion) {
        this.reporter.sendTelemetryEvent('application_start', {
            duration,
            fromVSCode: fromVSCode.toString(),
            apiVersion
        });
    }
    trackApplicationStartException(exception) {
        this.reporter.sendTelemetryEvent('application_start_exception', {
            exception: exception.toString()
        });
    }
    trackApplicationStartNoAuth() {
        this.reporter.sendTelemetryEvent('application_start_noauth');
    }
    trackApplicationEnd(runtimeDuration) {
        this.reporter.sendTelemetryEvent('application_end', {
            runtimeDuration
        });
    }
    trackComponentPreview(container, duration, apiVersion, browser, liveReload) {
        this.reporter.sendTelemetryEvent('component_preview', {
            container,
            duration,
            apiVersion,
            browser,
            liveReload: liveReload.toString()
        });
    }
    trackComponentPreviewException(exception, apiVersion) {
        this.reporter.sendTelemetryEvent('component_preview_exception', {
            exception: exception.toString(),
            apiVersion
        });
    }
    trackComponentCompileException(exception) {
        this.reporter.sendTelemetryEvent('component_compile_exception', {
            exception: exception.toString()
        });
    }
    static async getInstance(userId, sessionId) {
        const reporter = await telemetryReporter_1.TelemetryReporter.create(new LocalDevTelemetryOptions_1.default(userId, sessionId));
        return new LocalDevTelemetryReporter(reporter);
    }
}
exports.default = LocalDevTelemetryReporter;
LocalDevTelemetryReporter._instance = null;
//# sourceMappingURL=LocalDevTelemetryReporter.js.map