"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Quiz = exports.Points = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const wrappers_1 = require("../../../../../google/protobuf/wrappers");
exports.protobufPackage = 'yandex.cloud.speechsense.v1.analysis';
const basePoints = {};
exports.Points = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.quiz) {
            exports.Quiz.encode(v, writer.uint32(10).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({}, basePoints);
        message.quiz = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.quiz.push(exports.Quiz.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, basePoints);
        message.quiz = ((_a = object.quiz) !== null && _a !== void 0 ? _a : []).map((e) => exports.Quiz.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.quiz) {
            obj.quiz = message.quiz.map((e) => (e ? exports.Quiz.toJSON(e) : undefined));
        }
        else {
            obj.quiz = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, basePoints);
        message.quiz = ((_a = object.quiz) === null || _a === void 0 ? void 0 : _a.map((e) => exports.Quiz.fromPartial(e))) || [];
        return message;
    },
};
const baseQuiz = { request: '', id: '' };
exports.Quiz = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.request !== '') {
            writer.uint32(10).string(message.request);
        }
        if (message.response !== undefined) {
            wrappers_1.StringValue.encode({ value: message.response }, writer.uint32(18).fork()).ldelim();
        }
        if (message.id !== '') {
            writer.uint32(26).string(message.id);
        }
        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({}, baseQuiz);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.request = reader.string();
                    break;
                case 2:
                    message.response = wrappers_1.StringValue.decode(reader, reader.uint32()).value;
                    break;
                case 3:
                    message.id = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseQuiz);
        message.request =
            object.request !== undefined && object.request !== null ? String(object.request) : '';
        message.response =
            object.response !== undefined && object.response !== null
                ? String(object.response)
                : undefined;
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.request !== undefined && (obj.request = message.request);
        message.response !== undefined && (obj.response = message.response);
        message.id !== undefined && (obj.id = message.id);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseQuiz);
        message.request = (_a = object.request) !== null && _a !== void 0 ? _a : '';
        message.response = (_b = object.response) !== null && _b !== void 0 ? _b : undefined;
        message.id = (_c = object.id) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
