"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionResult = exports.FunctionCall = exports.FunctionTool = exports.SearchIndexTool = exports.ToolResultList = exports.ToolResult = exports.ToolCallList = exports.ToolCall = exports.Tool = exports.CompletionOptions = exports.PromptTruncationOptions_LastMessagesStrategy = exports.PromptTruncationOptions_AutoStrategy = exports.PromptTruncationOptions = 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");
const struct_1 = require("../../../../../google/protobuf/struct");
exports.protobufPackage = 'yandex.cloud.ai.assistants.v1';
const basePromptTruncationOptions = {};
exports.PromptTruncationOptions = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.maxPromptTokens !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.maxPromptTokens }, writer.uint32(10).fork()).ldelim();
        }
        if (message.autoStrategy !== undefined) {
            exports.PromptTruncationOptions_AutoStrategy.encode(message.autoStrategy, writer.uint32(18).fork()).ldelim();
        }
        if (message.lastMessagesStrategy !== undefined) {
            exports.PromptTruncationOptions_LastMessagesStrategy.encode(message.lastMessagesStrategy, writer.uint32(26).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({}, basePromptTruncationOptions);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.maxPromptTokens = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                case 2:
                    message.autoStrategy = exports.PromptTruncationOptions_AutoStrategy.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.lastMessagesStrategy =
                        exports.PromptTruncationOptions_LastMessagesStrategy.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, basePromptTruncationOptions);
        message.maxPromptTokens =
            object.maxPromptTokens !== undefined && object.maxPromptTokens !== null
                ? Number(object.maxPromptTokens)
                : undefined;
        message.autoStrategy =
            object.autoStrategy !== undefined && object.autoStrategy !== null
                ? exports.PromptTruncationOptions_AutoStrategy.fromJSON(object.autoStrategy)
                : undefined;
        message.lastMessagesStrategy =
            object.lastMessagesStrategy !== undefined && object.lastMessagesStrategy !== null
                ? exports.PromptTruncationOptions_LastMessagesStrategy.fromJSON(object.lastMessagesStrategy)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.maxPromptTokens !== undefined && (obj.maxPromptTokens = message.maxPromptTokens);
        message.autoStrategy !== undefined &&
            (obj.autoStrategy = message.autoStrategy
                ? exports.PromptTruncationOptions_AutoStrategy.toJSON(message.autoStrategy)
                : undefined);
        message.lastMessagesStrategy !== undefined &&
            (obj.lastMessagesStrategy = message.lastMessagesStrategy
                ? exports.PromptTruncationOptions_LastMessagesStrategy.toJSON(message.lastMessagesStrategy)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, basePromptTruncationOptions);
        message.maxPromptTokens = (_a = object.maxPromptTokens) !== null && _a !== void 0 ? _a : undefined;
        message.autoStrategy =
            object.autoStrategy !== undefined && object.autoStrategy !== null
                ? exports.PromptTruncationOptions_AutoStrategy.fromPartial(object.autoStrategy)
                : undefined;
        message.lastMessagesStrategy =
            object.lastMessagesStrategy !== undefined && object.lastMessagesStrategy !== null
                ? exports.PromptTruncationOptions_LastMessagesStrategy.fromPartial(object.lastMessagesStrategy)
                : undefined;
        return message;
    },
};
const basePromptTruncationOptions_AutoStrategy = {};
exports.PromptTruncationOptions_AutoStrategy = {
    encode(_, writer = minimal_1.default.Writer.create()) {
        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({}, basePromptTruncationOptions_AutoStrategy);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, basePromptTruncationOptions_AutoStrategy);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, basePromptTruncationOptions_AutoStrategy);
        return message;
    },
};
const basePromptTruncationOptions_LastMessagesStrategy = { numMessages: 0 };
exports.PromptTruncationOptions_LastMessagesStrategy = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.numMessages !== 0) {
            writer.uint32(8).int64(message.numMessages);
        }
        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({}, basePromptTruncationOptions_LastMessagesStrategy);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.numMessages = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, basePromptTruncationOptions_LastMessagesStrategy);
        message.numMessages =
            object.numMessages !== undefined && object.numMessages !== null
                ? Number(object.numMessages)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.numMessages !== undefined && (obj.numMessages = Math.round(message.numMessages));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, basePromptTruncationOptions_LastMessagesStrategy);
        message.numMessages = (_a = object.numMessages) !== null && _a !== void 0 ? _a : 0;
        return message;
    },
};
const baseCompletionOptions = {};
exports.CompletionOptions = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.maxTokens !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.maxTokens }, writer.uint32(18).fork()).ldelim();
        }
        if (message.temperature !== undefined) {
            wrappers_1.DoubleValue.encode({ value: message.temperature }, writer.uint32(26).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({}, baseCompletionOptions);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 2:
                    message.maxTokens = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                case 3:
                    message.temperature = wrappers_1.DoubleValue.decode(reader, reader.uint32()).value;
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCompletionOptions);
        message.maxTokens =
            object.maxTokens !== undefined && object.maxTokens !== null
                ? Number(object.maxTokens)
                : undefined;
        message.temperature =
            object.temperature !== undefined && object.temperature !== null
                ? Number(object.temperature)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.maxTokens !== undefined && (obj.maxTokens = message.maxTokens);
        message.temperature !== undefined && (obj.temperature = message.temperature);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseCompletionOptions);
        message.maxTokens = (_a = object.maxTokens) !== null && _a !== void 0 ? _a : undefined;
        message.temperature = (_b = object.temperature) !== null && _b !== void 0 ? _b : undefined;
        return message;
    },
};
const baseTool = {};
exports.Tool = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.searchIndex !== undefined) {
            exports.SearchIndexTool.encode(message.searchIndex, writer.uint32(10).fork()).ldelim();
        }
        if (message.function !== undefined) {
            exports.FunctionTool.encode(message.function, 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({}, baseTool);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.searchIndex = exports.SearchIndexTool.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.function = exports.FunctionTool.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTool);
        message.searchIndex =
            object.searchIndex !== undefined && object.searchIndex !== null
                ? exports.SearchIndexTool.fromJSON(object.searchIndex)
                : undefined;
        message.function =
            object.function !== undefined && object.function !== null
                ? exports.FunctionTool.fromJSON(object.function)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.searchIndex !== undefined &&
            (obj.searchIndex = message.searchIndex
                ? exports.SearchIndexTool.toJSON(message.searchIndex)
                : undefined);
        message.function !== undefined &&
            (obj.function = message.function ? exports.FunctionTool.toJSON(message.function) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseTool);
        message.searchIndex =
            object.searchIndex !== undefined && object.searchIndex !== null
                ? exports.SearchIndexTool.fromPartial(object.searchIndex)
                : undefined;
        message.function =
            object.function !== undefined && object.function !== null
                ? exports.FunctionTool.fromPartial(object.function)
                : undefined;
        return message;
    },
};
const baseToolCall = {};
exports.ToolCall = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.functionCall !== undefined) {
            exports.FunctionCall.encode(message.functionCall, 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({}, baseToolCall);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.functionCall = exports.FunctionCall.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseToolCall);
        message.functionCall =
            object.functionCall !== undefined && object.functionCall !== null
                ? exports.FunctionCall.fromJSON(object.functionCall)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.functionCall !== undefined &&
            (obj.functionCall = message.functionCall
                ? exports.FunctionCall.toJSON(message.functionCall)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseToolCall);
        message.functionCall =
            object.functionCall !== undefined && object.functionCall !== null
                ? exports.FunctionCall.fromPartial(object.functionCall)
                : undefined;
        return message;
    },
};
const baseToolCallList = {};
exports.ToolCallList = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.toolCalls) {
            exports.ToolCall.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({}, baseToolCallList);
        message.toolCalls = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.toolCalls.push(exports.ToolCall.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseToolCallList);
        message.toolCalls = ((_a = object.toolCalls) !== null && _a !== void 0 ? _a : []).map((e) => exports.ToolCall.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.toolCalls) {
            obj.toolCalls = message.toolCalls.map((e) => (e ? exports.ToolCall.toJSON(e) : undefined));
        }
        else {
            obj.toolCalls = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseToolCallList);
        message.toolCalls = ((_a = object.toolCalls) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ToolCall.fromPartial(e))) || [];
        return message;
    },
};
const baseToolResult = {};
exports.ToolResult = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.functionResult !== undefined) {
            exports.FunctionResult.encode(message.functionResult, 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({}, baseToolResult);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.functionResult = exports.FunctionResult.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseToolResult);
        message.functionResult =
            object.functionResult !== undefined && object.functionResult !== null
                ? exports.FunctionResult.fromJSON(object.functionResult)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.functionResult !== undefined &&
            (obj.functionResult = message.functionResult
                ? exports.FunctionResult.toJSON(message.functionResult)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseToolResult);
        message.functionResult =
            object.functionResult !== undefined && object.functionResult !== null
                ? exports.FunctionResult.fromPartial(object.functionResult)
                : undefined;
        return message;
    },
};
const baseToolResultList = {};
exports.ToolResultList = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.toolResults) {
            exports.ToolResult.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({}, baseToolResultList);
        message.toolResults = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.toolResults.push(exports.ToolResult.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseToolResultList);
        message.toolResults = ((_a = object.toolResults) !== null && _a !== void 0 ? _a : []).map((e) => exports.ToolResult.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.toolResults) {
            obj.toolResults = message.toolResults.map((e) => e ? exports.ToolResult.toJSON(e) : undefined);
        }
        else {
            obj.toolResults = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseToolResultList);
        message.toolResults = ((_a = object.toolResults) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ToolResult.fromPartial(e))) || [];
        return message;
    },
};
const baseSearchIndexTool = { searchIndexIds: '' };
exports.SearchIndexTool = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.searchIndexIds) {
            writer.uint32(10).string(v);
        }
        if (message.maxNumResults !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.maxNumResults }, 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({}, baseSearchIndexTool);
        message.searchIndexIds = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.searchIndexIds.push(reader.string());
                    break;
                case 2:
                    message.maxNumResults = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseSearchIndexTool);
        message.searchIndexIds = ((_a = object.searchIndexIds) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.maxNumResults =
            object.maxNumResults !== undefined && object.maxNumResults !== null
                ? Number(object.maxNumResults)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.searchIndexIds) {
            obj.searchIndexIds = message.searchIndexIds.map((e) => e);
        }
        else {
            obj.searchIndexIds = [];
        }
        message.maxNumResults !== undefined && (obj.maxNumResults = message.maxNumResults);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseSearchIndexTool);
        message.searchIndexIds = ((_a = object.searchIndexIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        message.maxNumResults = (_b = object.maxNumResults) !== null && _b !== void 0 ? _b : undefined;
        return message;
    },
};
const baseFunctionTool = { name: '', description: '' };
exports.FunctionTool = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(18).string(message.description);
        }
        if (message.parameters !== undefined) {
            struct_1.Struct.encode(struct_1.Struct.wrap(message.parameters), writer.uint32(26).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({}, baseFunctionTool);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.description = reader.string();
                    break;
                case 3:
                    message.parameters = struct_1.Struct.unwrap(struct_1.Struct.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFunctionTool);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.parameters = typeof object.parameters === 'object' ? object.parameters : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.parameters !== undefined && (obj.parameters = message.parameters);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseFunctionTool);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
        message.parameters = (_c = object.parameters) !== null && _c !== void 0 ? _c : undefined;
        return message;
    },
};
const baseFunctionCall = { name: '' };
exports.FunctionCall = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.arguments !== undefined) {
            struct_1.Struct.encode(struct_1.Struct.wrap(message.arguments), 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({}, baseFunctionCall);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.arguments = struct_1.Struct.unwrap(struct_1.Struct.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFunctionCall);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.arguments = typeof object.arguments === 'object' ? object.arguments : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.arguments !== undefined && (obj.arguments = message.arguments);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseFunctionCall);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.arguments = (_b = object.arguments) !== null && _b !== void 0 ? _b : undefined;
        return message;
    },
};
const baseFunctionResult = { name: '' };
exports.FunctionResult = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.content !== undefined) {
            writer.uint32(18).string(message.content);
        }
        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({}, baseFunctionResult);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.content = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFunctionResult);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.content =
            object.content !== undefined && object.content !== null
                ? String(object.content)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.content !== undefined && (obj.content = message.content);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseFunctionResult);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.content = (_b = object.content) !== null && _b !== void 0 ? _b : undefined;
        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();
}
