"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ThreadServiceClient = exports.ThreadServiceService = exports.ListThreadsResponse = exports.ListThreadsRequest = exports.DeleteThreadResponse = exports.DeleteThreadRequest = exports.UpdateThreadRequest_LabelsEntry = exports.UpdateThreadRequest = exports.GetThreadRequest = exports.CreateThreadRequest_LabelsEntry = exports.CreateThreadRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const common_1 = require("../../../../../../yandex/cloud/ai/common/common");
const field_mask_1 = require("../../../../../../google/protobuf/field_mask");
const message_1 = require("../../../../../../yandex/cloud/ai/assistants/v1/threads/message");
const common_2 = require("../../../../../../yandex/cloud/ai/assistants/v1/common");
const thread_1 = require("../../../../../../yandex/cloud/ai/assistants/v1/threads/thread");
exports.protobufPackage = 'yandex.cloud.ai.assistants.v1.threads';
const baseCreateThreadRequest = {
    folderId: '',
    name: '',
    description: '',
    defaultMessageAuthorId: '',
};
exports.CreateThreadRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        for (const v of message.messages) {
            message_1.MessageData.encode(v, writer.uint32(18).fork()).ldelim();
        }
        if (message.name !== '') {
            writer.uint32(26).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(34).string(message.description);
        }
        if (message.defaultMessageAuthorId !== '') {
            writer.uint32(42).string(message.defaultMessageAuthorId);
        }
        if (message.expirationConfig !== undefined) {
            common_1.ExpirationConfig.encode(message.expirationConfig, writer.uint32(50).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreateThreadRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(58).fork()).ldelim();
        });
        for (const v of message.tools) {
            common_2.Tool.encode(v, writer.uint32(66).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({}, baseCreateThreadRequest);
        message.messages = [];
        message.labels = {};
        message.tools = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    message.messages.push(message_1.MessageData.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.name = reader.string();
                    break;
                case 4:
                    message.description = reader.string();
                    break;
                case 5:
                    message.defaultMessageAuthorId = reader.string();
                    break;
                case 6:
                    message.expirationConfig = common_1.ExpirationConfig.decode(reader, reader.uint32());
                    break;
                case 7:
                    const entry7 = exports.CreateThreadRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry7.value !== undefined) {
                        message.labels[entry7.key] = entry7.value;
                    }
                    break;
                case 8:
                    message.tools.push(common_2.Tool.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseCreateThreadRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.messages = ((_a = object.messages) !== null && _a !== void 0 ? _a : []).map((e) => message_1.MessageData.fromJSON(e));
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.defaultMessageAuthorId =
            object.defaultMessageAuthorId !== undefined && object.defaultMessageAuthorId !== null
                ? String(object.defaultMessageAuthorId)
                : '';
        message.expirationConfig =
            object.expirationConfig !== undefined && object.expirationConfig !== null
                ? common_1.ExpirationConfig.fromJSON(object.expirationConfig)
                : undefined;
        message.labels = Object.entries((_b = object.labels) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.tools = ((_c = object.tools) !== null && _c !== void 0 ? _c : []).map((e) => common_2.Tool.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        if (message.messages) {
            obj.messages = message.messages.map((e) => (e ? message_1.MessageData.toJSON(e) : undefined));
        }
        else {
            obj.messages = [];
        }
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.defaultMessageAuthorId !== undefined &&
            (obj.defaultMessageAuthorId = message.defaultMessageAuthorId);
        message.expirationConfig !== undefined &&
            (obj.expirationConfig = message.expirationConfig
                ? common_1.ExpirationConfig.toJSON(message.expirationConfig)
                : undefined);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        if (message.tools) {
            obj.tools = message.tools.map((e) => (e ? common_2.Tool.toJSON(e) : undefined));
        }
        else {
            obj.tools = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g;
        const message = Object.assign({}, baseCreateThreadRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.messages = ((_b = object.messages) === null || _b === void 0 ? void 0 : _b.map((e) => message_1.MessageData.fromPartial(e))) || [];
        message.name = (_c = object.name) !== null && _c !== void 0 ? _c : '';
        message.description = (_d = object.description) !== null && _d !== void 0 ? _d : '';
        message.defaultMessageAuthorId = (_e = object.defaultMessageAuthorId) !== null && _e !== void 0 ? _e : '';
        message.expirationConfig =
            object.expirationConfig !== undefined && object.expirationConfig !== null
                ? common_1.ExpirationConfig.fromPartial(object.expirationConfig)
                : undefined;
        message.labels = Object.entries((_f = object.labels) !== null && _f !== void 0 ? _f : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.tools = ((_g = object.tools) === null || _g === void 0 ? void 0 : _g.map((e) => common_2.Tool.fromPartial(e))) || [];
        return message;
    },
};
const baseCreateThreadRequest_LabelsEntry = { key: '', value: '' };
exports.CreateThreadRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        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({}, baseCreateThreadRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreateThreadRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseCreateThreadRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseGetThreadRequest = { threadId: '' };
exports.GetThreadRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.threadId !== '') {
            writer.uint32(10).string(message.threadId);
        }
        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({}, baseGetThreadRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.threadId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetThreadRequest);
        message.threadId =
            object.threadId !== undefined && object.threadId !== null
                ? String(object.threadId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.threadId !== undefined && (obj.threadId = message.threadId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetThreadRequest);
        message.threadId = (_a = object.threadId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpdateThreadRequest = { threadId: '', name: '', description: '' };
exports.UpdateThreadRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.threadId !== '') {
            writer.uint32(10).string(message.threadId);
        }
        if (message.updateMask !== undefined) {
            field_mask_1.FieldMask.encode(message.updateMask, writer.uint32(18).fork()).ldelim();
        }
        if (message.name !== '') {
            writer.uint32(26).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(34).string(message.description);
        }
        if (message.expirationConfig !== undefined) {
            common_1.ExpirationConfig.encode(message.expirationConfig, writer.uint32(42).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdateThreadRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(50).fork()).ldelim();
        });
        for (const v of message.tools) {
            common_2.Tool.encode(v, writer.uint32(58).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({}, baseUpdateThreadRequest);
        message.labels = {};
        message.tools = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.threadId = reader.string();
                    break;
                case 2:
                    message.updateMask = field_mask_1.FieldMask.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.name = reader.string();
                    break;
                case 4:
                    message.description = reader.string();
                    break;
                case 5:
                    message.expirationConfig = common_1.ExpirationConfig.decode(reader, reader.uint32());
                    break;
                case 6:
                    const entry6 = exports.UpdateThreadRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry6.value !== undefined) {
                        message.labels[entry6.key] = entry6.value;
                    }
                    break;
                case 7:
                    message.tools.push(common_2.Tool.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpdateThreadRequest);
        message.threadId =
            object.threadId !== undefined && object.threadId !== null
                ? String(object.threadId)
                : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromJSON(object.updateMask)
                : undefined;
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.expirationConfig =
            object.expirationConfig !== undefined && object.expirationConfig !== null
                ? common_1.ExpirationConfig.fromJSON(object.expirationConfig)
                : undefined;
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.tools = ((_b = object.tools) !== null && _b !== void 0 ? _b : []).map((e) => common_2.Tool.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.threadId !== undefined && (obj.threadId = message.threadId);
        message.updateMask !== undefined &&
            (obj.updateMask = message.updateMask
                ? field_mask_1.FieldMask.toJSON(message.updateMask)
                : undefined);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.expirationConfig !== undefined &&
            (obj.expirationConfig = message.expirationConfig
                ? common_1.ExpirationConfig.toJSON(message.expirationConfig)
                : undefined);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        if (message.tools) {
            obj.tools = message.tools.map((e) => (e ? common_2.Tool.toJSON(e) : undefined));
        }
        else {
            obj.tools = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e;
        const message = Object.assign({}, baseUpdateThreadRequest);
        message.threadId = (_a = object.threadId) !== null && _a !== void 0 ? _a : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromPartial(object.updateMask)
                : undefined;
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.expirationConfig =
            object.expirationConfig !== undefined && object.expirationConfig !== null
                ? common_1.ExpirationConfig.fromPartial(object.expirationConfig)
                : undefined;
        message.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.tools = ((_e = object.tools) === null || _e === void 0 ? void 0 : _e.map((e) => common_2.Tool.fromPartial(e))) || [];
        return message;
    },
};
const baseUpdateThreadRequest_LabelsEntry = { key: '', value: '' };
exports.UpdateThreadRequest_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        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({}, baseUpdateThreadRequest_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdateThreadRequest_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseUpdateThreadRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseDeleteThreadRequest = { threadId: '' };
exports.DeleteThreadRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.threadId !== '') {
            writer.uint32(10).string(message.threadId);
        }
        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({}, baseDeleteThreadRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.threadId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteThreadRequest);
        message.threadId =
            object.threadId !== undefined && object.threadId !== null
                ? String(object.threadId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.threadId !== undefined && (obj.threadId = message.threadId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteThreadRequest);
        message.threadId = (_a = object.threadId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteThreadResponse = {};
exports.DeleteThreadResponse = {
    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({}, baseDeleteThreadResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, baseDeleteThreadResponse);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, baseDeleteThreadResponse);
        return message;
    },
};
const baseListThreadsRequest = { folderId: '', pageSize: 0, pageToken: '' };
exports.ListThreadsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        if (message.pageSize !== 0) {
            writer.uint32(16).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(26).string(message.pageToken);
        }
        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({}, baseListThreadsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 3:
                    message.pageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListThreadsRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.pageSize =
            object.pageSize !== undefined && object.pageSize !== null ? Number(object.pageSize) : 0;
        message.pageToken =
            object.pageToken !== undefined && object.pageToken !== null
                ? String(object.pageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
        message.pageToken !== undefined && (obj.pageToken = message.pageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseListThreadsRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.pageSize = (_b = object.pageSize) !== null && _b !== void 0 ? _b : 0;
        message.pageToken = (_c = object.pageToken) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
const baseListThreadsResponse = { nextPageToken: '' };
exports.ListThreadsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.threads) {
            thread_1.Thread.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.nextPageToken !== '') {
            writer.uint32(18).string(message.nextPageToken);
        }
        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({}, baseListThreadsResponse);
        message.threads = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.threads.push(thread_1.Thread.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.nextPageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListThreadsResponse);
        message.threads = ((_a = object.threads) !== null && _a !== void 0 ? _a : []).map((e) => thread_1.Thread.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.threads) {
            obj.threads = message.threads.map((e) => (e ? thread_1.Thread.toJSON(e) : undefined));
        }
        else {
            obj.threads = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListThreadsResponse);
        message.threads = ((_a = object.threads) === null || _a === void 0 ? void 0 : _a.map((e) => thread_1.Thread.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
/** ThreadService provides operations for managing threads. */
exports.ThreadServiceService = {
    /** Create a new thread. */
    create: {
        path: '/yandex.cloud.ai.assistants.v1.threads.ThreadService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreateThreadRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreateThreadRequest.decode(value),
        responseSerialize: (value) => Buffer.from(thread_1.Thread.encode(value).finish()),
        responseDeserialize: (value) => thread_1.Thread.decode(value),
    },
    /** Retrieve details of a specific thread by its ID. */
    get: {
        path: '/yandex.cloud.ai.assistants.v1.threads.ThreadService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetThreadRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetThreadRequest.decode(value),
        responseSerialize: (value) => Buffer.from(thread_1.Thread.encode(value).finish()),
        responseDeserialize: (value) => thread_1.Thread.decode(value),
    },
    /** Update an existing thread. */
    update: {
        path: '/yandex.cloud.ai.assistants.v1.threads.ThreadService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdateThreadRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdateThreadRequest.decode(value),
        responseSerialize: (value) => Buffer.from(thread_1.Thread.encode(value).finish()),
        responseDeserialize: (value) => thread_1.Thread.decode(value),
    },
    /** Delete a thread by its ID. */
    delete: {
        path: '/yandex.cloud.ai.assistants.v1.threads.ThreadService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeleteThreadRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeleteThreadRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.DeleteThreadResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.DeleteThreadResponse.decode(value),
    },
    /** List threads in a specific folder. */
    list: {
        path: '/yandex.cloud.ai.assistants.v1.threads.ThreadService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListThreadsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListThreadsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListThreadsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListThreadsResponse.decode(value),
    },
};
exports.ThreadServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.ThreadServiceService, 'yandex.cloud.ai.assistants.v1.threads.ThreadService');
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();
}
