"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestResultContainerData = void 0;
const TestResults_1 = require("./TestResults");
class TestResultContainerData {
    /** @internal */
    constructor(options) {
        this._container = options.container;
        this._core = options.core;
    }
    get testResults() {
        return this._container.result;
    }
    getTestResults() {
        return this.testResults && new TestResults_1.TestResultsData({ result: this.testResults, core: this._core });
    }
    get exception() {
        if (!this._container.error || this._container.error instanceof Error)
            return this._container.error;
        else
            return new Error(String(this._container.error));
    }
    getException() {
        return this.exception;
    }
    get browserInfo() {
        return this._container.environment.requested;
    }
    getBrowserInfo() {
        return this.browserInfo;
    }
    /** @internal */
    toObject() {
        return {
            testResults: this.testResults,
            exception: this.exception,
            browserInfo: this.browserInfo,
        };
    }
    /** @internal */
    toJSON() {
        return this._container;
    }
    /** @internal */
    toString() {
        return `${this.testResults ? this.testResults : ''} - ${this.exception ? this.exception : ''}`;
    }
}
exports.TestResultContainerData = TestResultContainerData;
