"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimpleMethodValueResult = exports.MethodValueSimpleJsonResult = exports.ValueResult = void 0;
const lodash_1 = require("lodash");
class ValueResult {
    constructor(jsonResult, displayedResult) {
        this.jsonResult = jsonResult;
        if (undefined === displayedResult) {
            this.displayedResult = this.buildDisplayedValue(jsonResult);
        }
        else {
            this.displayedResult = displayedResult;
        }
    }
    buildDisplayedValue(jsonResult) {
        return JSON.stringify(jsonResult);
    }
    getDisplayedLine(text) {
        return `<div class="methodResultLine">${text}</div>
    `;
    }
    getDisplayedKeyValue(key, value) {
        const displayedValue = undefined === value
            ? 'undefined'
            : lodash_1.isString(value)
                ? value
                : JSON.stringify(value);
        return `<span class="methodParamLabel">${key}</span> : <span class="methodParamLabel">${displayedValue}</span>`;
    }
}
exports.ValueResult = ValueResult;
class MethodValueSimpleJsonResult {
}
exports.MethodValueSimpleJsonResult = MethodValueSimpleJsonResult;
class SimpleMethodValueResult extends ValueResult {
    constructor(jsonResult) {
        super(jsonResult);
        this.jsonResult = jsonResult;
    }
    buildDisplayedValue(jsonResult) {
        return Object.keys(jsonResult)
            .map((key) => this.getDisplayedLine(this.getDisplayedKeyValue(key, jsonResult[key])))
            .join('\n');
    }
}
exports.SimpleMethodValueResult = SimpleMethodValueResult;
//# sourceMappingURL=method-value-result.js.map