"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TitleWidget = exports.TextWidget = exports.ChartWidget = exports.Widget_LayoutPosition = exports.Widget = exports.titleWidget_TitleSizeToJSON = exports.titleWidget_TitleSizeFromJSON = exports.TitleWidget_TitleSize = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const kpi_1 = require("../../../../../../yandex/cloud/loadtesting/api/v1/report/kpi");
exports.protobufPackage = 'yandex.cloud.loadtesting.api.v1.regression';
/** Title size. */
var TitleWidget_TitleSize;
(function (TitleWidget_TitleSize) {
    /** TITLE_SIZE_UNSPECIFIED - Unspecified. */
    TitleWidget_TitleSize[TitleWidget_TitleSize["TITLE_SIZE_UNSPECIFIED"] = 0] = "TITLE_SIZE_UNSPECIFIED";
    /** TITLE_SIZE_XS - Extra small. */
    TitleWidget_TitleSize[TitleWidget_TitleSize["TITLE_SIZE_XS"] = 1] = "TITLE_SIZE_XS";
    /** TITLE_SIZE_S - Small. */
    TitleWidget_TitleSize[TitleWidget_TitleSize["TITLE_SIZE_S"] = 2] = "TITLE_SIZE_S";
    /** TITLE_SIZE_M - Medium. */
    TitleWidget_TitleSize[TitleWidget_TitleSize["TITLE_SIZE_M"] = 3] = "TITLE_SIZE_M";
    /** TITLE_SIZE_L - Large. */
    TitleWidget_TitleSize[TitleWidget_TitleSize["TITLE_SIZE_L"] = 4] = "TITLE_SIZE_L";
    TitleWidget_TitleSize[TitleWidget_TitleSize["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(TitleWidget_TitleSize = exports.TitleWidget_TitleSize || (exports.TitleWidget_TitleSize = {}));
function titleWidget_TitleSizeFromJSON(object) {
    switch (object) {
        case 0:
        case 'TITLE_SIZE_UNSPECIFIED':
            return TitleWidget_TitleSize.TITLE_SIZE_UNSPECIFIED;
        case 1:
        case 'TITLE_SIZE_XS':
            return TitleWidget_TitleSize.TITLE_SIZE_XS;
        case 2:
        case 'TITLE_SIZE_S':
            return TitleWidget_TitleSize.TITLE_SIZE_S;
        case 3:
        case 'TITLE_SIZE_M':
            return TitleWidget_TitleSize.TITLE_SIZE_M;
        case 4:
        case 'TITLE_SIZE_L':
            return TitleWidget_TitleSize.TITLE_SIZE_L;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return TitleWidget_TitleSize.UNRECOGNIZED;
    }
}
exports.titleWidget_TitleSizeFromJSON = titleWidget_TitleSizeFromJSON;
function titleWidget_TitleSizeToJSON(object) {
    switch (object) {
        case TitleWidget_TitleSize.TITLE_SIZE_UNSPECIFIED:
            return 'TITLE_SIZE_UNSPECIFIED';
        case TitleWidget_TitleSize.TITLE_SIZE_XS:
            return 'TITLE_SIZE_XS';
        case TitleWidget_TitleSize.TITLE_SIZE_S:
            return 'TITLE_SIZE_S';
        case TitleWidget_TitleSize.TITLE_SIZE_M:
            return 'TITLE_SIZE_M';
        case TitleWidget_TitleSize.TITLE_SIZE_L:
            return 'TITLE_SIZE_L';
        default:
            return 'UNKNOWN';
    }
}
exports.titleWidget_TitleSizeToJSON = titleWidget_TitleSizeToJSON;
const baseWidget = {};
exports.Widget = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.position !== undefined) {
            exports.Widget_LayoutPosition.encode(message.position, writer.uint32(10).fork()).ldelim();
        }
        if (message.chart !== undefined) {
            exports.ChartWidget.encode(message.chart, writer.uint32(18).fork()).ldelim();
        }
        if (message.text !== undefined) {
            exports.TextWidget.encode(message.text, writer.uint32(26).fork()).ldelim();
        }
        if (message.title !== undefined) {
            exports.TitleWidget.encode(message.title, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseWidget);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.position = exports.Widget_LayoutPosition.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.chart = exports.ChartWidget.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.text = exports.TextWidget.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.title = exports.TitleWidget.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseWidget);
        message.position =
            object.position !== undefined && object.position !== null
                ? exports.Widget_LayoutPosition.fromJSON(object.position)
                : undefined;
        message.chart =
            object.chart !== undefined && object.chart !== null
                ? exports.ChartWidget.fromJSON(object.chart)
                : undefined;
        message.text =
            object.text !== undefined && object.text !== null
                ? exports.TextWidget.fromJSON(object.text)
                : undefined;
        message.title =
            object.title !== undefined && object.title !== null
                ? exports.TitleWidget.fromJSON(object.title)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.position !== undefined &&
            (obj.position = message.position
                ? exports.Widget_LayoutPosition.toJSON(message.position)
                : undefined);
        message.chart !== undefined &&
            (obj.chart = message.chart ? exports.ChartWidget.toJSON(message.chart) : undefined);
        message.text !== undefined &&
            (obj.text = message.text ? exports.TextWidget.toJSON(message.text) : undefined);
        message.title !== undefined &&
            (obj.title = message.title ? exports.TitleWidget.toJSON(message.title) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseWidget);
        message.position =
            object.position !== undefined && object.position !== null
                ? exports.Widget_LayoutPosition.fromPartial(object.position)
                : undefined;
        message.chart =
            object.chart !== undefined && object.chart !== null
                ? exports.ChartWidget.fromPartial(object.chart)
                : undefined;
        message.text =
            object.text !== undefined && object.text !== null
                ? exports.TextWidget.fromPartial(object.text)
                : undefined;
        message.title =
            object.title !== undefined && object.title !== null
                ? exports.TitleWidget.fromPartial(object.title)
                : undefined;
        return message;
    },
};
const baseWidget_LayoutPosition = { x: 0, y: 0, width: 0, height: 0 };
exports.Widget_LayoutPosition = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.x !== 0) {
            writer.uint32(8).int64(message.x);
        }
        if (message.y !== 0) {
            writer.uint32(16).int64(message.y);
        }
        if (message.width !== 0) {
            writer.uint32(24).int64(message.width);
        }
        if (message.height !== 0) {
            writer.uint32(32).int64(message.height);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseWidget_LayoutPosition);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.x = longToNumber(reader.int64());
                    break;
                case 2:
                    message.y = longToNumber(reader.int64());
                    break;
                case 3:
                    message.width = longToNumber(reader.int64());
                    break;
                case 4:
                    message.height = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseWidget_LayoutPosition);
        message.x = object.x !== undefined && object.x !== null ? Number(object.x) : 0;
        message.y = object.y !== undefined && object.y !== null ? Number(object.y) : 0;
        message.width =
            object.width !== undefined && object.width !== null ? Number(object.width) : 0;
        message.height =
            object.height !== undefined && object.height !== null ? Number(object.height) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.x !== undefined && (obj.x = Math.round(message.x));
        message.y !== undefined && (obj.y = Math.round(message.y));
        message.width !== undefined && (obj.width = Math.round(message.width));
        message.height !== undefined && (obj.height = Math.round(message.height));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseWidget_LayoutPosition);
        message.x = (_a = object.x) !== null && _a !== void 0 ? _a : 0;
        message.y = (_b = object.y) !== null && _b !== void 0 ? _b : 0;
        message.width = (_c = object.width) !== null && _c !== void 0 ? _c : 0;
        message.height = (_d = object.height) !== null && _d !== void 0 ? _d : 0;
        return message;
    },
};
const baseChartWidget = { id: '', name: '', description: '', filterStr: '', testCase: '' };
exports.ChartWidget = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.filterStr !== '') {
            writer.uint32(34).string(message.filterStr);
        }
        if (message.testCase !== '') {
            writer.uint32(42).string(message.testCase);
        }
        for (const v of message.kpis) {
            kpi_1.Kpi.encode(v, writer.uint32(50).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseChartWidget);
        message.kpis = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    message.filterStr = reader.string();
                    break;
                case 5:
                    message.testCase = reader.string();
                    break;
                case 6:
                    message.kpis.push(kpi_1.Kpi.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseChartWidget);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.filterStr =
            object.filterStr !== undefined && object.filterStr !== null
                ? String(object.filterStr)
                : '';
        message.testCase =
            object.testCase !== undefined && object.testCase !== null
                ? String(object.testCase)
                : '';
        message.kpis = ((_a = object.kpis) !== null && _a !== void 0 ? _a : []).map((e) => kpi_1.Kpi.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.filterStr !== undefined && (obj.filterStr = message.filterStr);
        message.testCase !== undefined && (obj.testCase = message.testCase);
        if (message.kpis) {
            obj.kpis = message.kpis.map((e) => (e ? kpi_1.Kpi.toJSON(e) : undefined));
        }
        else {
            obj.kpis = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f;
        const message = Object.assign({}, baseChartWidget);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.filterStr = (_d = object.filterStr) !== null && _d !== void 0 ? _d : '';
        message.testCase = (_e = object.testCase) !== null && _e !== void 0 ? _e : '';
        message.kpis = ((_f = object.kpis) === null || _f === void 0 ? void 0 : _f.map((e) => kpi_1.Kpi.fromPartial(e))) || [];
        return message;
    },
};
const baseTextWidget = { text: '' };
exports.TextWidget = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.text !== '') {
            writer.uint32(10).string(message.text);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTextWidget);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.text = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTextWidget);
        message.text = object.text !== undefined && object.text !== null ? String(object.text) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.text !== undefined && (obj.text = message.text);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseTextWidget);
        message.text = (_a = object.text) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseTitleWidget = { text: '', size: 0 };
exports.TitleWidget = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.text !== '') {
            writer.uint32(10).string(message.text);
        }
        if (message.size !== 0) {
            writer.uint32(16).int32(message.size);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTitleWidget);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.text = reader.string();
                    break;
                case 2:
                    message.size = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTitleWidget);
        message.text = object.text !== undefined && object.text !== null ? String(object.text) : '';
        message.size =
            object.size !== undefined && object.size !== null
                ? titleWidget_TitleSizeFromJSON(object.size)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.text !== undefined && (obj.text = message.text);
        message.size !== undefined && (obj.size = titleWidget_TitleSizeToJSON(message.size));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTitleWidget);
        message.text = (_a = object.text) !== null && _a !== void 0 ? _a : '';
        message.size = (_b = object.size) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
var globalThis = (() => {
    if (typeof globalThis !== 'undefined')
        return globalThis;
    if (typeof self !== 'undefined')
        return self;
    if (typeof window !== 'undefined')
        return window;
    if (typeof global !== 'undefined')
        return global;
    throw 'Unable to locate global object';
})();
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
    }
    return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
