"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SummarizationField = exports.SummarizationStatement = exports.Summarization = exports.summarizationFieldTypeToJSON = exports.summarizationFieldTypeFromJSON = exports.SummarizationFieldType = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = 'yandex.cloud.speechsense.v1.analysis';
var SummarizationFieldType;
(function (SummarizationFieldType) {
    SummarizationFieldType[SummarizationFieldType["SUMMARIZATION_FIELD_TYPE_UNSPECIFIED"] = 0] = "SUMMARIZATION_FIELD_TYPE_UNSPECIFIED";
    SummarizationFieldType[SummarizationFieldType["TEXT"] = 1] = "TEXT";
    SummarizationFieldType[SummarizationFieldType["TEXT_ARRAY"] = 2] = "TEXT_ARRAY";
    SummarizationFieldType[SummarizationFieldType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(SummarizationFieldType = exports.SummarizationFieldType || (exports.SummarizationFieldType = {}));
function summarizationFieldTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'SUMMARIZATION_FIELD_TYPE_UNSPECIFIED':
            return SummarizationFieldType.SUMMARIZATION_FIELD_TYPE_UNSPECIFIED;
        case 1:
        case 'TEXT':
            return SummarizationFieldType.TEXT;
        case 2:
        case 'TEXT_ARRAY':
            return SummarizationFieldType.TEXT_ARRAY;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return SummarizationFieldType.UNRECOGNIZED;
    }
}
exports.summarizationFieldTypeFromJSON = summarizationFieldTypeFromJSON;
function summarizationFieldTypeToJSON(object) {
    switch (object) {
        case SummarizationFieldType.SUMMARIZATION_FIELD_TYPE_UNSPECIFIED:
            return 'SUMMARIZATION_FIELD_TYPE_UNSPECIFIED';
        case SummarizationFieldType.TEXT:
            return 'TEXT';
        case SummarizationFieldType.TEXT_ARRAY:
            return 'TEXT_ARRAY';
        default:
            return 'UNKNOWN';
    }
}
exports.summarizationFieldTypeToJSON = summarizationFieldTypeToJSON;
const baseSummarization = {};
exports.Summarization = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.statements) {
            exports.SummarizationStatement.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({}, baseSummarization);
        message.statements = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.statements.push(exports.SummarizationStatement.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseSummarization);
        message.statements = ((_a = object.statements) !== null && _a !== void 0 ? _a : []).map((e) => exports.SummarizationStatement.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.statements) {
            obj.statements = message.statements.map((e) => e ? exports.SummarizationStatement.toJSON(e) : undefined);
        }
        else {
            obj.statements = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseSummarization);
        message.statements =
            ((_a = object.statements) === null || _a === void 0 ? void 0 : _a.map((e) => exports.SummarizationStatement.fromPartial(e))) || [];
        return message;
    },
};
const baseSummarizationStatement = { response: '' };
exports.SummarizationStatement = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.field !== undefined) {
            exports.SummarizationField.encode(message.field, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.response) {
            writer.uint32(18).string(v);
        }
        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({}, baseSummarizationStatement);
        message.response = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.field = exports.SummarizationField.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.response.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseSummarizationStatement);
        message.field =
            object.field !== undefined && object.field !== null
                ? exports.SummarizationField.fromJSON(object.field)
                : undefined;
        message.response = ((_a = object.response) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.field !== undefined &&
            (obj.field = message.field ? exports.SummarizationField.toJSON(message.field) : undefined);
        if (message.response) {
            obj.response = message.response.map((e) => e);
        }
        else {
            obj.response = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseSummarizationStatement);
        message.field =
            object.field !== undefined && object.field !== null
                ? exports.SummarizationField.fromPartial(object.field)
                : undefined;
        message.response = ((_a = object.response) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
const baseSummarizationField = { id: '', name: '', type: 0 };
exports.SummarizationField = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(26).string(message.id);
        }
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.type !== 0) {
            writer.uint32(16).int32(message.type);
        }
        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({}, baseSummarizationField);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 3:
                    message.id = reader.string();
                    break;
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.type = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseSummarizationField);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.type =
            object.type !== undefined && object.type !== null
                ? summarizationFieldTypeFromJSON(object.type)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.name !== undefined && (obj.name = message.name);
        message.type !== undefined && (obj.type = summarizationFieldTypeToJSON(message.type));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseSummarizationField);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.type = (_c = object.type) !== null && _c !== void 0 ? _c : 0;
        return message;
    },
};
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
