"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlgorithmProcessingInfo = exports.Field = exports.TalkState = exports.Talk = exports.algorithmToJSON = exports.algorithmFromJSON = exports.Algorithm = exports.processingStateToJSON = exports.processingStateFromJSON = exports.ProcessingState = exports.fieldTypeToJSON = exports.fieldTypeFromJSON = exports.FieldType = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const transcription_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/transcription");
const speech_statistics_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/speech_statistics");
const silence_statistics_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/silence_statistics");
const interrupts_statistics_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/interrupts_statistics");
const conversation_statistics_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/conversation_statistics");
const points_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/points");
const text_classifiers_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/text_classifiers");
const summarization_1 = require("../../../../yandex/cloud/speechsense/v1/analysis/summarization");
const timestamp_1 = require("../../../../google/protobuf/timestamp");
exports.protobufPackage = 'yandex.cloud.speechsense.v1';
/** connection field type */
var FieldType;
(function (FieldType) {
    FieldType[FieldType["FIELD_TYPE_UNSPECIFIED"] = 0] = "FIELD_TYPE_UNSPECIFIED";
    FieldType[FieldType["FIELD_TYPE_STRING"] = 1] = "FIELD_TYPE_STRING";
    FieldType[FieldType["FIELD_TYPE_NUMBER"] = 2] = "FIELD_TYPE_NUMBER";
    FieldType[FieldType["FIELD_TYPE_DECIMAL"] = 3] = "FIELD_TYPE_DECIMAL";
    FieldType[FieldType["FIELD_TYPE_BOOLEAN"] = 4] = "FIELD_TYPE_BOOLEAN";
    FieldType[FieldType["FIELD_TYPE_DATE"] = 5] = "FIELD_TYPE_DATE";
    FieldType[FieldType["FIELD_TYPE_JSON"] = 6] = "FIELD_TYPE_JSON";
    FieldType[FieldType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(FieldType = exports.FieldType || (exports.FieldType = {}));
function fieldTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'FIELD_TYPE_UNSPECIFIED':
            return FieldType.FIELD_TYPE_UNSPECIFIED;
        case 1:
        case 'FIELD_TYPE_STRING':
            return FieldType.FIELD_TYPE_STRING;
        case 2:
        case 'FIELD_TYPE_NUMBER':
            return FieldType.FIELD_TYPE_NUMBER;
        case 3:
        case 'FIELD_TYPE_DECIMAL':
            return FieldType.FIELD_TYPE_DECIMAL;
        case 4:
        case 'FIELD_TYPE_BOOLEAN':
            return FieldType.FIELD_TYPE_BOOLEAN;
        case 5:
        case 'FIELD_TYPE_DATE':
            return FieldType.FIELD_TYPE_DATE;
        case 6:
        case 'FIELD_TYPE_JSON':
            return FieldType.FIELD_TYPE_JSON;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return FieldType.UNRECOGNIZED;
    }
}
exports.fieldTypeFromJSON = fieldTypeFromJSON;
function fieldTypeToJSON(object) {
    switch (object) {
        case FieldType.FIELD_TYPE_UNSPECIFIED:
            return 'FIELD_TYPE_UNSPECIFIED';
        case FieldType.FIELD_TYPE_STRING:
            return 'FIELD_TYPE_STRING';
        case FieldType.FIELD_TYPE_NUMBER:
            return 'FIELD_TYPE_NUMBER';
        case FieldType.FIELD_TYPE_DECIMAL:
            return 'FIELD_TYPE_DECIMAL';
        case FieldType.FIELD_TYPE_BOOLEAN:
            return 'FIELD_TYPE_BOOLEAN';
        case FieldType.FIELD_TYPE_DATE:
            return 'FIELD_TYPE_DATE';
        case FieldType.FIELD_TYPE_JSON:
            return 'FIELD_TYPE_JSON';
        default:
            return 'UNKNOWN';
    }
}
exports.fieldTypeToJSON = fieldTypeToJSON;
var ProcessingState;
(function (ProcessingState) {
    ProcessingState[ProcessingState["PROCESSING_STATE_UNSPECIFIED"] = 0] = "PROCESSING_STATE_UNSPECIFIED";
    ProcessingState[ProcessingState["PROCESSING_STATE_NOT_STARTED"] = 1] = "PROCESSING_STATE_NOT_STARTED";
    ProcessingState[ProcessingState["PROCESSING_STATE_PROCESSING"] = 2] = "PROCESSING_STATE_PROCESSING";
    ProcessingState[ProcessingState["PROCESSING_STATE_SUCCESS"] = 3] = "PROCESSING_STATE_SUCCESS";
    ProcessingState[ProcessingState["PROCESSING_STATE_FAILED"] = 4] = "PROCESSING_STATE_FAILED";
    ProcessingState[ProcessingState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ProcessingState = exports.ProcessingState || (exports.ProcessingState = {}));
function processingStateFromJSON(object) {
    switch (object) {
        case 0:
        case 'PROCESSING_STATE_UNSPECIFIED':
            return ProcessingState.PROCESSING_STATE_UNSPECIFIED;
        case 1:
        case 'PROCESSING_STATE_NOT_STARTED':
            return ProcessingState.PROCESSING_STATE_NOT_STARTED;
        case 2:
        case 'PROCESSING_STATE_PROCESSING':
            return ProcessingState.PROCESSING_STATE_PROCESSING;
        case 3:
        case 'PROCESSING_STATE_SUCCESS':
            return ProcessingState.PROCESSING_STATE_SUCCESS;
        case 4:
        case 'PROCESSING_STATE_FAILED':
            return ProcessingState.PROCESSING_STATE_FAILED;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return ProcessingState.UNRECOGNIZED;
    }
}
exports.processingStateFromJSON = processingStateFromJSON;
function processingStateToJSON(object) {
    switch (object) {
        case ProcessingState.PROCESSING_STATE_UNSPECIFIED:
            return 'PROCESSING_STATE_UNSPECIFIED';
        case ProcessingState.PROCESSING_STATE_NOT_STARTED:
            return 'PROCESSING_STATE_NOT_STARTED';
        case ProcessingState.PROCESSING_STATE_PROCESSING:
            return 'PROCESSING_STATE_PROCESSING';
        case ProcessingState.PROCESSING_STATE_SUCCESS:
            return 'PROCESSING_STATE_SUCCESS';
        case ProcessingState.PROCESSING_STATE_FAILED:
            return 'PROCESSING_STATE_FAILED';
        default:
            return 'UNKNOWN';
    }
}
exports.processingStateToJSON = processingStateToJSON;
var Algorithm;
(function (Algorithm) {
    Algorithm[Algorithm["ALGORITHM_UNSPECIFIED"] = 0] = "ALGORITHM_UNSPECIFIED";
    Algorithm[Algorithm["ALGORITHM_SPEECHKIT"] = 1] = "ALGORITHM_SPEECHKIT";
    Algorithm[Algorithm["ALGORITHM_YGPT"] = 2] = "ALGORITHM_YGPT";
    Algorithm[Algorithm["ALGORITHM_CLASSIFIER"] = 3] = "ALGORITHM_CLASSIFIER";
    Algorithm[Algorithm["ALGORITHM_SUMMARIZATION"] = 4] = "ALGORITHM_SUMMARIZATION";
    Algorithm[Algorithm["ALGORITHM_EMBEDDING"] = 5] = "ALGORITHM_EMBEDDING";
    Algorithm[Algorithm["ALGORITHM_STATISTICS"] = 6] = "ALGORITHM_STATISTICS";
    Algorithm[Algorithm["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Algorithm = exports.Algorithm || (exports.Algorithm = {}));
function algorithmFromJSON(object) {
    switch (object) {
        case 0:
        case 'ALGORITHM_UNSPECIFIED':
            return Algorithm.ALGORITHM_UNSPECIFIED;
        case 1:
        case 'ALGORITHM_SPEECHKIT':
            return Algorithm.ALGORITHM_SPEECHKIT;
        case 2:
        case 'ALGORITHM_YGPT':
            return Algorithm.ALGORITHM_YGPT;
        case 3:
        case 'ALGORITHM_CLASSIFIER':
            return Algorithm.ALGORITHM_CLASSIFIER;
        case 4:
        case 'ALGORITHM_SUMMARIZATION':
            return Algorithm.ALGORITHM_SUMMARIZATION;
        case 5:
        case 'ALGORITHM_EMBEDDING':
            return Algorithm.ALGORITHM_EMBEDDING;
        case 6:
        case 'ALGORITHM_STATISTICS':
            return Algorithm.ALGORITHM_STATISTICS;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Algorithm.UNRECOGNIZED;
    }
}
exports.algorithmFromJSON = algorithmFromJSON;
function algorithmToJSON(object) {
    switch (object) {
        case Algorithm.ALGORITHM_UNSPECIFIED:
            return 'ALGORITHM_UNSPECIFIED';
        case Algorithm.ALGORITHM_SPEECHKIT:
            return 'ALGORITHM_SPEECHKIT';
        case Algorithm.ALGORITHM_YGPT:
            return 'ALGORITHM_YGPT';
        case Algorithm.ALGORITHM_CLASSIFIER:
            return 'ALGORITHM_CLASSIFIER';
        case Algorithm.ALGORITHM_SUMMARIZATION:
            return 'ALGORITHM_SUMMARIZATION';
        case Algorithm.ALGORITHM_EMBEDDING:
            return 'ALGORITHM_EMBEDDING';
        case Algorithm.ALGORITHM_STATISTICS:
            return 'ALGORITHM_STATISTICS';
        default:
            return 'UNKNOWN';
    }
}
exports.algorithmToJSON = algorithmToJSON;
const baseTalk = {
    id: '',
    organizationId: '',
    spaceId: '',
    connectionId: '',
    projectIds: '',
    createdBy: '',
    modifiedBy: '',
};
exports.Talk = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.organizationId !== '') {
            writer.uint32(18).string(message.organizationId);
        }
        if (message.spaceId !== '') {
            writer.uint32(26).string(message.spaceId);
        }
        if (message.connectionId !== '') {
            writer.uint32(34).string(message.connectionId);
        }
        for (const v of message.projectIds) {
            writer.uint32(42).string(v);
        }
        if (message.createdBy !== '') {
            writer.uint32(50).string(message.createdBy);
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim();
        }
        if (message.modifiedBy !== '') {
            writer.uint32(66).string(message.modifiedBy);
        }
        if (message.modifiedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.modifiedAt), writer.uint32(74).fork()).ldelim();
        }
        for (const v of message.talkFields) {
            exports.Field.encode(v, writer.uint32(82).fork()).ldelim();
        }
        if (message.transcription !== undefined) {
            transcription_1.Transcription.encode(message.transcription, writer.uint32(90).fork()).ldelim();
        }
        if (message.speechStatistics !== undefined) {
            speech_statistics_1.SpeechStatistics.encode(message.speechStatistics, writer.uint32(98).fork()).ldelim();
        }
        if (message.silenceStatistics !== undefined) {
            silence_statistics_1.SilenceStatistics.encode(message.silenceStatistics, writer.uint32(106).fork()).ldelim();
        }
        if (message.interruptsStatistics !== undefined) {
            interrupts_statistics_1.InterruptsStatistics.encode(message.interruptsStatistics, writer.uint32(114).fork()).ldelim();
        }
        if (message.conversationStatistics !== undefined) {
            conversation_statistics_1.ConversationStatistics.encode(message.conversationStatistics, writer.uint32(122).fork()).ldelim();
        }
        if (message.points !== undefined) {
            points_1.Points.encode(message.points, writer.uint32(130).fork()).ldelim();
        }
        if (message.textClassifiers !== undefined) {
            text_classifiers_1.TextClassifiers.encode(message.textClassifiers, writer.uint32(138).fork()).ldelim();
        }
        if (message.summarization !== undefined) {
            summarization_1.Summarization.encode(message.summarization, writer.uint32(146).fork()).ldelim();
        }
        if (message.talkState !== undefined) {
            exports.TalkState.encode(message.talkState, writer.uint32(154).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({}, baseTalk);
        message.projectIds = [];
        message.talkFields = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.organizationId = reader.string();
                    break;
                case 3:
                    message.spaceId = reader.string();
                    break;
                case 4:
                    message.connectionId = reader.string();
                    break;
                case 5:
                    message.projectIds.push(reader.string());
                    break;
                case 6:
                    message.createdBy = reader.string();
                    break;
                case 7:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 8:
                    message.modifiedBy = reader.string();
                    break;
                case 9:
                    message.modifiedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 10:
                    message.talkFields.push(exports.Field.decode(reader, reader.uint32()));
                    break;
                case 11:
                    message.transcription = transcription_1.Transcription.decode(reader, reader.uint32());
                    break;
                case 12:
                    message.speechStatistics = speech_statistics_1.SpeechStatistics.decode(reader, reader.uint32());
                    break;
                case 13:
                    message.silenceStatistics = silence_statistics_1.SilenceStatistics.decode(reader, reader.uint32());
                    break;
                case 14:
                    message.interruptsStatistics = interrupts_statistics_1.InterruptsStatistics.decode(reader, reader.uint32());
                    break;
                case 15:
                    message.conversationStatistics = conversation_statistics_1.ConversationStatistics.decode(reader, reader.uint32());
                    break;
                case 16:
                    message.points = points_1.Points.decode(reader, reader.uint32());
                    break;
                case 17:
                    message.textClassifiers = text_classifiers_1.TextClassifiers.decode(reader, reader.uint32());
                    break;
                case 18:
                    message.summarization = summarization_1.Summarization.decode(reader, reader.uint32());
                    break;
                case 19:
                    message.talkState = exports.TalkState.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseTalk);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.organizationId =
            object.organizationId !== undefined && object.organizationId !== null
                ? String(object.organizationId)
                : '';
        message.spaceId =
            object.spaceId !== undefined && object.spaceId !== null ? String(object.spaceId) : '';
        message.connectionId =
            object.connectionId !== undefined && object.connectionId !== null
                ? String(object.connectionId)
                : '';
        message.projectIds = ((_a = object.projectIds) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.createdBy =
            object.createdBy !== undefined && object.createdBy !== null
                ? String(object.createdBy)
                : '';
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.modifiedBy =
            object.modifiedBy !== undefined && object.modifiedBy !== null
                ? String(object.modifiedBy)
                : '';
        message.modifiedAt =
            object.modifiedAt !== undefined && object.modifiedAt !== null
                ? fromJsonTimestamp(object.modifiedAt)
                : undefined;
        message.talkFields = ((_b = object.talkFields) !== null && _b !== void 0 ? _b : []).map((e) => exports.Field.fromJSON(e));
        message.transcription =
            object.transcription !== undefined && object.transcription !== null
                ? transcription_1.Transcription.fromJSON(object.transcription)
                : undefined;
        message.speechStatistics =
            object.speechStatistics !== undefined && object.speechStatistics !== null
                ? speech_statistics_1.SpeechStatistics.fromJSON(object.speechStatistics)
                : undefined;
        message.silenceStatistics =
            object.silenceStatistics !== undefined && object.silenceStatistics !== null
                ? silence_statistics_1.SilenceStatistics.fromJSON(object.silenceStatistics)
                : undefined;
        message.interruptsStatistics =
            object.interruptsStatistics !== undefined && object.interruptsStatistics !== null
                ? interrupts_statistics_1.InterruptsStatistics.fromJSON(object.interruptsStatistics)
                : undefined;
        message.conversationStatistics =
            object.conversationStatistics !== undefined && object.conversationStatistics !== null
                ? conversation_statistics_1.ConversationStatistics.fromJSON(object.conversationStatistics)
                : undefined;
        message.points =
            object.points !== undefined && object.points !== null
                ? points_1.Points.fromJSON(object.points)
                : undefined;
        message.textClassifiers =
            object.textClassifiers !== undefined && object.textClassifiers !== null
                ? text_classifiers_1.TextClassifiers.fromJSON(object.textClassifiers)
                : undefined;
        message.summarization =
            object.summarization !== undefined && object.summarization !== null
                ? summarization_1.Summarization.fromJSON(object.summarization)
                : undefined;
        message.talkState =
            object.talkState !== undefined && object.talkState !== null
                ? exports.TalkState.fromJSON(object.talkState)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.organizationId !== undefined && (obj.organizationId = message.organizationId);
        message.spaceId !== undefined && (obj.spaceId = message.spaceId);
        message.connectionId !== undefined && (obj.connectionId = message.connectionId);
        if (message.projectIds) {
            obj.projectIds = message.projectIds.map((e) => e);
        }
        else {
            obj.projectIds = [];
        }
        message.createdBy !== undefined && (obj.createdBy = message.createdBy);
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.modifiedBy !== undefined && (obj.modifiedBy = message.modifiedBy);
        message.modifiedAt !== undefined && (obj.modifiedAt = message.modifiedAt.toISOString());
        if (message.talkFields) {
            obj.talkFields = message.talkFields.map((e) => (e ? exports.Field.toJSON(e) : undefined));
        }
        else {
            obj.talkFields = [];
        }
        message.transcription !== undefined &&
            (obj.transcription = message.transcription
                ? transcription_1.Transcription.toJSON(message.transcription)
                : undefined);
        message.speechStatistics !== undefined &&
            (obj.speechStatistics = message.speechStatistics
                ? speech_statistics_1.SpeechStatistics.toJSON(message.speechStatistics)
                : undefined);
        message.silenceStatistics !== undefined &&
            (obj.silenceStatistics = message.silenceStatistics
                ? silence_statistics_1.SilenceStatistics.toJSON(message.silenceStatistics)
                : undefined);
        message.interruptsStatistics !== undefined &&
            (obj.interruptsStatistics = message.interruptsStatistics
                ? interrupts_statistics_1.InterruptsStatistics.toJSON(message.interruptsStatistics)
                : undefined);
        message.conversationStatistics !== undefined &&
            (obj.conversationStatistics = message.conversationStatistics
                ? conversation_statistics_1.ConversationStatistics.toJSON(message.conversationStatistics)
                : undefined);
        message.points !== undefined &&
            (obj.points = message.points ? points_1.Points.toJSON(message.points) : undefined);
        message.textClassifiers !== undefined &&
            (obj.textClassifiers = message.textClassifiers
                ? text_classifiers_1.TextClassifiers.toJSON(message.textClassifiers)
                : undefined);
        message.summarization !== undefined &&
            (obj.summarization = message.summarization
                ? summarization_1.Summarization.toJSON(message.summarization)
                : undefined);
        message.talkState !== undefined &&
            (obj.talkState = message.talkState ? exports.TalkState.toJSON(message.talkState) : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
        const message = Object.assign({}, baseTalk);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.organizationId = (_b = object.organizationId) !== null && _b !== void 0 ? _b : '';
        message.spaceId = (_c = object.spaceId) !== null && _c !== void 0 ? _c : '';
        message.connectionId = (_d = object.connectionId) !== null && _d !== void 0 ? _d : '';
        message.projectIds = ((_e = object.projectIds) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || [];
        message.createdBy = (_f = object.createdBy) !== null && _f !== void 0 ? _f : '';
        message.createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
        message.modifiedBy = (_h = object.modifiedBy) !== null && _h !== void 0 ? _h : '';
        message.modifiedAt = (_j = object.modifiedAt) !== null && _j !== void 0 ? _j : undefined;
        message.talkFields = ((_k = object.talkFields) === null || _k === void 0 ? void 0 : _k.map((e) => exports.Field.fromPartial(e))) || [];
        message.transcription =
            object.transcription !== undefined && object.transcription !== null
                ? transcription_1.Transcription.fromPartial(object.transcription)
                : undefined;
        message.speechStatistics =
            object.speechStatistics !== undefined && object.speechStatistics !== null
                ? speech_statistics_1.SpeechStatistics.fromPartial(object.speechStatistics)
                : undefined;
        message.silenceStatistics =
            object.silenceStatistics !== undefined && object.silenceStatistics !== null
                ? silence_statistics_1.SilenceStatistics.fromPartial(object.silenceStatistics)
                : undefined;
        message.interruptsStatistics =
            object.interruptsStatistics !== undefined && object.interruptsStatistics !== null
                ? interrupts_statistics_1.InterruptsStatistics.fromPartial(object.interruptsStatistics)
                : undefined;
        message.conversationStatistics =
            object.conversationStatistics !== undefined && object.conversationStatistics !== null
                ? conversation_statistics_1.ConversationStatistics.fromPartial(object.conversationStatistics)
                : undefined;
        message.points =
            object.points !== undefined && object.points !== null
                ? points_1.Points.fromPartial(object.points)
                : undefined;
        message.textClassifiers =
            object.textClassifiers !== undefined && object.textClassifiers !== null
                ? text_classifiers_1.TextClassifiers.fromPartial(object.textClassifiers)
                : undefined;
        message.summarization =
            object.summarization !== undefined && object.summarization !== null
                ? summarization_1.Summarization.fromPartial(object.summarization)
                : undefined;
        message.talkState =
            object.talkState !== undefined && object.talkState !== null
                ? exports.TalkState.fromPartial(object.talkState)
                : undefined;
        return message;
    },
};
const baseTalkState = { processingState: 0 };
exports.TalkState = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.processingState !== 0) {
            writer.uint32(8).int32(message.processingState);
        }
        for (const v of message.algorithmProcessingInfos) {
            exports.AlgorithmProcessingInfo.encode(v, writer.uint32(18).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({}, baseTalkState);
        message.algorithmProcessingInfos = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.processingState = reader.int32();
                    break;
                case 2:
                    message.algorithmProcessingInfos.push(exports.AlgorithmProcessingInfo.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseTalkState);
        message.processingState =
            object.processingState !== undefined && object.processingState !== null
                ? processingStateFromJSON(object.processingState)
                : 0;
        message.algorithmProcessingInfos = ((_a = object.algorithmProcessingInfos) !== null && _a !== void 0 ? _a : []).map((e) => exports.AlgorithmProcessingInfo.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.processingState !== undefined &&
            (obj.processingState = processingStateToJSON(message.processingState));
        if (message.algorithmProcessingInfos) {
            obj.algorithmProcessingInfos = message.algorithmProcessingInfos.map((e) => e ? exports.AlgorithmProcessingInfo.toJSON(e) : undefined);
        }
        else {
            obj.algorithmProcessingInfos = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTalkState);
        message.processingState = (_a = object.processingState) !== null && _a !== void 0 ? _a : 0;
        message.algorithmProcessingInfos =
            ((_b = object.algorithmProcessingInfos) === null || _b === void 0 ? void 0 : _b.map((e) => exports.AlgorithmProcessingInfo.fromPartial(e))) ||
                [];
        return message;
    },
};
const baseField = { name: '', value: '', type: 0 };
exports.Field = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        if (message.type !== 0) {
            writer.uint32(24).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({}, baseField);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                case 3:
                    message.type = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseField);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        message.type =
            object.type !== undefined && object.type !== null ? fieldTypeFromJSON(object.type) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.value !== undefined && (obj.value = message.value);
        message.type !== undefined && (obj.type = fieldTypeToJSON(message.type));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseField);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        message.type = (_c = object.type) !== null && _c !== void 0 ? _c : 0;
        return message;
    },
};
const baseAlgorithmProcessingInfo = { algorithm: 0, processingState: 0 };
exports.AlgorithmProcessingInfo = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.algorithm !== 0) {
            writer.uint32(8).int32(message.algorithm);
        }
        if (message.processingState !== 0) {
            writer.uint32(16).int32(message.processingState);
        }
        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({}, baseAlgorithmProcessingInfo);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.algorithm = reader.int32();
                    break;
                case 2:
                    message.processingState = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseAlgorithmProcessingInfo);
        message.algorithm =
            object.algorithm !== undefined && object.algorithm !== null
                ? algorithmFromJSON(object.algorithm)
                : 0;
        message.processingState =
            object.processingState !== undefined && object.processingState !== null
                ? processingStateFromJSON(object.processingState)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.algorithm !== undefined && (obj.algorithm = algorithmToJSON(message.algorithm));
        message.processingState !== undefined &&
            (obj.processingState = processingStateToJSON(message.processingState));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseAlgorithmProcessingInfo);
        message.algorithm = (_a = object.algorithm) !== null && _a !== void 0 ? _a : 0;
        message.processingState = (_b = object.processingState) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
function toTimestamp(date) {
    const seconds = date.getTime() / 1000;
    const nanos = (date.getTime() % 1000) * 1000000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = t.seconds * 1000;
    millis += t.nanos / 1000000;
    return new Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof Date) {
        return o;
    }
    else if (typeof o === 'string') {
        return new Date(o);
    }
    else {
        return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
    }
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
