"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatasetServiceClient = exports.DatasetServiceService = exports.ListOperationsIdsResponse_DatasetIdToOperationIdEntry = exports.ListOperationsIdsResponse = exports.ListOperationsIdsRequest = exports.GetDownloadUrlsResponse = exports.GetDownloadUrlsRequest = exports.GetDatasetPreviewResponse = exports.GetDatasetPreviewRequest = exports.ListTypesResponse = exports.ListTypesRequest = exports.ListUploadSchemasResponse = exports.ListUploadSchemasRequest = exports.ListUploadFormatsResponse = exports.ListUploadFormatsRequest = exports.ListDatasetsResponse = exports.ListDatasetsRequest = exports.FinishMultipartUploadDraftResponse = exports.FinishMultipartUploadDraftRequest = exports.UploadedPartInfo = exports.StartMultipartUploadDraftResponse = exports.StartMultipartUploadDraftRequest = exports.GetUploadDraftUrlResponse = exports.GetUploadDraftUrlRequest = exports.UpdateDatasetResponse = exports.UpdateDatasetRequest_LabelsEntry = exports.UpdateDatasetRequest = exports.CreateDatasetResponse = exports.CreateDatasetRequest_LabelsEntry = exports.CreateDatasetRequest = exports.DeleteDatasetResponse = exports.DeleteDatasetRequest = exports.ValidateDatasetResponse = exports.ValidateDatasetMetadata = exports.ValidateDatasetRequest = exports.DescribeDatasetResponse = exports.DescribeDatasetRequest = 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 dataset_1 = require("../../../../../yandex/cloud/ai/dataset/v1/dataset");
const field_mask_1 = require("../../../../../google/protobuf/field_mask");
const operation_1 = require("../../../../../yandex/cloud/operation/operation");
exports.protobufPackage = 'yandex.cloud.ai.dataset.v1';
const baseDescribeDatasetRequest = { datasetId: '' };
exports.DescribeDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseDescribeDatasetRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDescribeDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDescribeDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDescribeDatasetResponse = {};
exports.DescribeDatasetResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.dataset !== undefined) {
            dataset_1.DatasetInfo.encode(message.dataset, 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({}, baseDescribeDatasetResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.dataset = dataset_1.DatasetInfo.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDescribeDatasetResponse);
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromJSON(object.dataset)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.dataset !== undefined &&
            (obj.dataset = message.dataset ? dataset_1.DatasetInfo.toJSON(message.dataset) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseDescribeDatasetResponse);
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromPartial(object.dataset)
                : undefined;
        return message;
    },
};
const baseValidateDatasetRequest = { datasetId: '' };
exports.ValidateDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseValidateDatasetRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseValidateDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseValidateDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseValidateDatasetMetadata = {
    datasetId: '',
    validRows: 0,
    processedRows: 0,
    totalRows: 0,
};
exports.ValidateDatasetMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.validRows !== 0) {
            writer.uint32(16).int64(message.validRows);
        }
        if (message.processedRows !== 0) {
            writer.uint32(24).int64(message.processedRows);
        }
        if (message.totalRows !== 0) {
            writer.uint32(32).int64(message.totalRows);
        }
        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({}, baseValidateDatasetMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.validRows = longToNumber(reader.int64());
                    break;
                case 3:
                    message.processedRows = longToNumber(reader.int64());
                    break;
                case 4:
                    message.totalRows = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseValidateDatasetMetadata);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.validRows =
            object.validRows !== undefined && object.validRows !== null
                ? Number(object.validRows)
                : 0;
        message.processedRows =
            object.processedRows !== undefined && object.processedRows !== null
                ? Number(object.processedRows)
                : 0;
        message.totalRows =
            object.totalRows !== undefined && object.totalRows !== null
                ? Number(object.totalRows)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.validRows !== undefined && (obj.validRows = Math.round(message.validRows));
        message.processedRows !== undefined &&
            (obj.processedRows = Math.round(message.processedRows));
        message.totalRows !== undefined && (obj.totalRows = Math.round(message.totalRows));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseValidateDatasetMetadata);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.validRows = (_b = object.validRows) !== null && _b !== void 0 ? _b : 0;
        message.processedRows = (_c = object.processedRows) !== null && _c !== void 0 ? _c : 0;
        message.totalRows = (_d = object.totalRows) !== null && _d !== void 0 ? _d : 0;
        return message;
    },
};
const baseValidateDatasetResponse = { datasetId: '', isValid: false };
exports.ValidateDatasetResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.isValid === true) {
            writer.uint32(16).bool(message.isValid);
        }
        for (const v of message.errors) {
            dataset_1.ValidationError.encode(v, 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({}, baseValidateDatasetResponse);
        message.errors = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.isValid = reader.bool();
                    break;
                case 3:
                    message.errors.push(dataset_1.ValidationError.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseValidateDatasetResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.isValid =
            object.isValid !== undefined && object.isValid !== null
                ? Boolean(object.isValid)
                : false;
        message.errors = ((_a = object.errors) !== null && _a !== void 0 ? _a : []).map((e) => dataset_1.ValidationError.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.isValid !== undefined && (obj.isValid = message.isValid);
        if (message.errors) {
            obj.errors = message.errors.map((e) => (e ? dataset_1.ValidationError.toJSON(e) : undefined));
        }
        else {
            obj.errors = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseValidateDatasetResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.isValid = (_b = object.isValid) !== null && _b !== void 0 ? _b : false;
        message.errors = ((_c = object.errors) === null || _c === void 0 ? void 0 : _c.map((e) => dataset_1.ValidationError.fromPartial(e))) || [];
        return message;
    },
};
const baseDeleteDatasetRequest = { datasetId: '' };
exports.DeleteDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseDeleteDatasetRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteDatasetResponse = {};
exports.DeleteDatasetResponse = {
    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({}, baseDeleteDatasetResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        const message = Object.assign({}, baseDeleteDatasetResponse);
        return message;
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = Object.assign({}, baseDeleteDatasetResponse);
        return message;
    },
};
const baseCreateDatasetRequest = {
    name: '',
    folderId: '',
    description: '',
    metadata: '',
    taskType: '',
    uploadFormat: '',
    allowDataLog: false,
};
exports.CreateDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.folderId !== '') {
            writer.uint32(18).string(message.folderId);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.metadata !== '') {
            writer.uint32(34).string(message.metadata);
        }
        if (message.taskType !== '') {
            writer.uint32(42).string(message.taskType);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreateDatasetRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(50).fork()).ldelim();
        });
        if (message.uploadFormat !== '') {
            writer.uint32(58).string(message.uploadFormat);
        }
        if (message.allowDataLog === true) {
            writer.uint32(64).bool(message.allowDataLog);
        }
        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({}, baseCreateDatasetRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.folderId = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    message.metadata = reader.string();
                    break;
                case 5:
                    message.taskType = reader.string();
                    break;
                case 6:
                    const entry6 = exports.CreateDatasetRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry6.value !== undefined) {
                        message.labels[entry6.key] = entry6.value;
                    }
                    break;
                case 7:
                    message.uploadFormat = reader.string();
                    break;
                case 8:
                    message.allowDataLog = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseCreateDatasetRequest);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.metadata =
            object.metadata !== undefined && object.metadata !== null
                ? String(object.metadata)
                : '';
        message.taskType =
            object.taskType !== undefined && object.taskType !== null
                ? String(object.taskType)
                : '';
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.uploadFormat =
            object.uploadFormat !== undefined && object.uploadFormat !== null
                ? String(object.uploadFormat)
                : '';
        message.allowDataLog =
            object.allowDataLog !== undefined && object.allowDataLog !== null
                ? Boolean(object.allowDataLog)
                : false;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.description !== undefined && (obj.description = message.description);
        message.metadata !== undefined && (obj.metadata = message.metadata);
        message.taskType !== undefined && (obj.taskType = message.taskType);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.uploadFormat !== undefined && (obj.uploadFormat = message.uploadFormat);
        message.allowDataLog !== undefined && (obj.allowDataLog = message.allowDataLog);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h;
        const message = Object.assign({}, baseCreateDatasetRequest);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.folderId = (_b = object.folderId) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.metadata = (_d = object.metadata) !== null && _d !== void 0 ? _d : '';
        message.taskType = (_e = object.taskType) !== null && _e !== void 0 ? _e : '';
        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.uploadFormat = (_g = object.uploadFormat) !== null && _g !== void 0 ? _g : '';
        message.allowDataLog = (_h = object.allowDataLog) !== null && _h !== void 0 ? _h : false;
        return message;
    },
};
const baseCreateDatasetRequest_LabelsEntry = { key: '', value: '' };
exports.CreateDatasetRequest_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({}, baseCreateDatasetRequest_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({}, baseCreateDatasetRequest_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({}, baseCreateDatasetRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreateDatasetResponse = { datasetId: '' };
exports.CreateDatasetResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.dataset !== undefined) {
            dataset_1.DatasetInfo.encode(message.dataset, 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({}, baseCreateDatasetResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.dataset = dataset_1.DatasetInfo.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreateDatasetResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromJSON(object.dataset)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.dataset !== undefined &&
            (obj.dataset = message.dataset ? dataset_1.DatasetInfo.toJSON(message.dataset) : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCreateDatasetResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromPartial(object.dataset)
                : undefined;
        return message;
    },
};
const baseUpdateDatasetRequest = { datasetId: '', name: '', description: '' };
exports.UpdateDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdateDatasetRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(42).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({}, baseUpdateDatasetRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = 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:
                    const entry5 = exports.UpdateDatasetRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry5.value !== undefined) {
                        message.labels[entry5.key] = entry5.value;
                    }
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseUpdateDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        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.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        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);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseUpdateDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== 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.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseUpdateDatasetRequest_LabelsEntry = { key: '', value: '' };
exports.UpdateDatasetRequest_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({}, baseUpdateDatasetRequest_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({}, baseUpdateDatasetRequest_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({}, baseUpdateDatasetRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseUpdateDatasetResponse = {};
exports.UpdateDatasetResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.dataset !== undefined) {
            dataset_1.DatasetInfo.encode(message.dataset, 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({}, baseUpdateDatasetResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.dataset = dataset_1.DatasetInfo.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdateDatasetResponse);
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromJSON(object.dataset)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.dataset !== undefined &&
            (obj.dataset = message.dataset ? dataset_1.DatasetInfo.toJSON(message.dataset) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseUpdateDatasetResponse);
        message.dataset =
            object.dataset !== undefined && object.dataset !== null
                ? dataset_1.DatasetInfo.fromPartial(object.dataset)
                : undefined;
        return message;
    },
};
const baseGetUploadDraftUrlRequest = { datasetId: '', sizeBytes: 0 };
exports.GetUploadDraftUrlRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.sizeBytes !== 0) {
            writer.uint32(16).int64(message.sizeBytes);
        }
        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({}, baseGetUploadDraftUrlRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.sizeBytes = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetUploadDraftUrlRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.sizeBytes =
            object.sizeBytes !== undefined && object.sizeBytes !== null
                ? Number(object.sizeBytes)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.sizeBytes !== undefined && (obj.sizeBytes = Math.round(message.sizeBytes));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseGetUploadDraftUrlRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.sizeBytes = (_b = object.sizeBytes) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseGetUploadDraftUrlResponse = { datasetId: '', uploadUrl: '' };
exports.GetUploadDraftUrlResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.uploadUrl !== '') {
            writer.uint32(18).string(message.uploadUrl);
        }
        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({}, baseGetUploadDraftUrlResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.uploadUrl = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetUploadDraftUrlResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.uploadUrl =
            object.uploadUrl !== undefined && object.uploadUrl !== null
                ? String(object.uploadUrl)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.uploadUrl !== undefined && (obj.uploadUrl = message.uploadUrl);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseGetUploadDraftUrlResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.uploadUrl = (_b = object.uploadUrl) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseStartMultipartUploadDraftRequest = { datasetId: '', sizeBytes: 0, parts: 0 };
exports.StartMultipartUploadDraftRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.sizeBytes !== 0) {
            writer.uint32(16).int64(message.sizeBytes);
        }
        if (message.parts !== 0) {
            writer.uint32(24).int64(message.parts);
        }
        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({}, baseStartMultipartUploadDraftRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.sizeBytes = longToNumber(reader.int64());
                    break;
                case 3:
                    message.parts = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseStartMultipartUploadDraftRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.sizeBytes =
            object.sizeBytes !== undefined && object.sizeBytes !== null
                ? Number(object.sizeBytes)
                : 0;
        message.parts =
            object.parts !== undefined && object.parts !== null ? Number(object.parts) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.sizeBytes !== undefined && (obj.sizeBytes = Math.round(message.sizeBytes));
        message.parts !== undefined && (obj.parts = Math.round(message.parts));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseStartMultipartUploadDraftRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.sizeBytes = (_b = object.sizeBytes) !== null && _b !== void 0 ? _b : 0;
        message.parts = (_c = object.parts) !== null && _c !== void 0 ? _c : 0;
        return message;
    },
};
const baseStartMultipartUploadDraftResponse = { datasetId: '', multipartUploadUrls: '' };
exports.StartMultipartUploadDraftResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        for (const v of message.multipartUploadUrls) {
            writer.uint32(18).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseStartMultipartUploadDraftResponse);
        message.multipartUploadUrls = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.multipartUploadUrls.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseStartMultipartUploadDraftResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.multipartUploadUrls = ((_a = object.multipartUploadUrls) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        if (message.multipartUploadUrls) {
            obj.multipartUploadUrls = message.multipartUploadUrls.map((e) => e);
        }
        else {
            obj.multipartUploadUrls = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseStartMultipartUploadDraftResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.multipartUploadUrls = ((_b = object.multipartUploadUrls) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
const baseUploadedPartInfo = { partNum: 0, etag: '' };
exports.UploadedPartInfo = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.partNum !== 0) {
            writer.uint32(8).int64(message.partNum);
        }
        if (message.etag !== '') {
            writer.uint32(18).string(message.etag);
        }
        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({}, baseUploadedPartInfo);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.partNum = longToNumber(reader.int64());
                    break;
                case 2:
                    message.etag = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUploadedPartInfo);
        message.partNum =
            object.partNum !== undefined && object.partNum !== null ? Number(object.partNum) : 0;
        message.etag = object.etag !== undefined && object.etag !== null ? String(object.etag) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.partNum !== undefined && (obj.partNum = Math.round(message.partNum));
        message.etag !== undefined && (obj.etag = message.etag);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseUploadedPartInfo);
        message.partNum = (_a = object.partNum) !== null && _a !== void 0 ? _a : 0;
        message.etag = (_b = object.etag) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseFinishMultipartUploadDraftRequest = { datasetId: '' };
exports.FinishMultipartUploadDraftRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        for (const v of message.uploadedParts) {
            exports.UploadedPartInfo.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({}, baseFinishMultipartUploadDraftRequest);
        message.uploadedParts = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.uploadedParts.push(exports.UploadedPartInfo.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseFinishMultipartUploadDraftRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.uploadedParts = ((_a = object.uploadedParts) !== null && _a !== void 0 ? _a : []).map((e) => exports.UploadedPartInfo.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        if (message.uploadedParts) {
            obj.uploadedParts = message.uploadedParts.map((e) => e ? exports.UploadedPartInfo.toJSON(e) : undefined);
        }
        else {
            obj.uploadedParts = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseFinishMultipartUploadDraftRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.uploadedParts =
            ((_b = object.uploadedParts) === null || _b === void 0 ? void 0 : _b.map((e) => exports.UploadedPartInfo.fromPartial(e))) || [];
        return message;
    },
};
const baseFinishMultipartUploadDraftResponse = { datasetId: '' };
exports.FinishMultipartUploadDraftResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseFinishMultipartUploadDraftResponse);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFinishMultipartUploadDraftResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseFinishMultipartUploadDraftResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListDatasetsRequest = {
    folderId: '',
    status: 0,
    datasetNamePattern: '',
    taskTypeFilter: '',
    pageSize: 0,
    pageToken: '',
};
exports.ListDatasetsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        writer.uint32(18).fork();
        for (const v of message.status) {
            writer.int32(v);
        }
        writer.ldelim();
        if (message.datasetNamePattern !== '') {
            writer.uint32(26).string(message.datasetNamePattern);
        }
        for (const v of message.taskTypeFilter) {
            writer.uint32(34).string(v);
        }
        if (message.pageSize !== 0) {
            writer.uint32(40).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(50).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({}, baseListDatasetsRequest);
        message.status = [];
        message.taskTypeFilter = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                case 2:
                    if ((tag & 7) === 2) {
                        const end2 = reader.uint32() + reader.pos;
                        while (reader.pos < end2) {
                            message.status.push(reader.int32());
                        }
                    }
                    else {
                        message.status.push(reader.int32());
                    }
                    break;
                case 3:
                    message.datasetNamePattern = reader.string();
                    break;
                case 4:
                    message.taskTypeFilter.push(reader.string());
                    break;
                case 5:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 6:
                    message.pageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseListDatasetsRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.status = ((_a = object.status) !== null && _a !== void 0 ? _a : []).map((e) => (0, dataset_1.datasetInfo_StatusFromJSON)(e));
        message.datasetNamePattern =
            object.datasetNamePattern !== undefined && object.datasetNamePattern !== null
                ? String(object.datasetNamePattern)
                : '';
        message.taskTypeFilter = ((_b = object.taskTypeFilter) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
        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);
        if (message.status) {
            obj.status = message.status.map((e) => (0, dataset_1.datasetInfo_StatusToJSON)(e));
        }
        else {
            obj.status = [];
        }
        message.datasetNamePattern !== undefined &&
            (obj.datasetNamePattern = message.datasetNamePattern);
        if (message.taskTypeFilter) {
            obj.taskTypeFilter = message.taskTypeFilter.map((e) => e);
        }
        else {
            obj.taskTypeFilter = [];
        }
        message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
        message.pageToken !== undefined && (obj.pageToken = message.pageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f;
        const message = Object.assign({}, baseListDatasetsRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.status = ((_b = object.status) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        message.datasetNamePattern = (_c = object.datasetNamePattern) !== null && _c !== void 0 ? _c : '';
        message.taskTypeFilter = ((_d = object.taskTypeFilter) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
        message.pageSize = (_e = object.pageSize) !== null && _e !== void 0 ? _e : 0;
        message.pageToken = (_f = object.pageToken) !== null && _f !== void 0 ? _f : '';
        return message;
    },
};
const baseListDatasetsResponse = { nextPageToken: '' };
exports.ListDatasetsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.datasets) {
            dataset_1.DatasetInfo.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({}, baseListDatasetsResponse);
        message.datasets = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasets.push(dataset_1.DatasetInfo.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({}, baseListDatasetsResponse);
        message.datasets = ((_a = object.datasets) !== null && _a !== void 0 ? _a : []).map((e) => dataset_1.DatasetInfo.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.datasets) {
            obj.datasets = message.datasets.map((e) => (e ? dataset_1.DatasetInfo.toJSON(e) : undefined));
        }
        else {
            obj.datasets = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListDatasetsResponse);
        message.datasets = ((_a = object.datasets) === null || _a === void 0 ? void 0 : _a.map((e) => dataset_1.DatasetInfo.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseListUploadFormatsRequest = { taskType: '' };
exports.ListUploadFormatsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.taskType !== '') {
            writer.uint32(10).string(message.taskType);
        }
        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({}, baseListUploadFormatsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.taskType = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListUploadFormatsRequest);
        message.taskType =
            object.taskType !== undefined && object.taskType !== null
                ? String(object.taskType)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.taskType !== undefined && (obj.taskType = message.taskType);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListUploadFormatsRequest);
        message.taskType = (_a = object.taskType) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListUploadFormatsResponse = { formats: '' };
exports.ListUploadFormatsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.formats) {
            writer.uint32(10).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListUploadFormatsResponse);
        message.formats = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.formats.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListUploadFormatsResponse);
        message.formats = ((_a = object.formats) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.formats) {
            obj.formats = message.formats.map((e) => e);
        }
        else {
            obj.formats = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListUploadFormatsResponse);
        message.formats = ((_a = object.formats) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
const baseListUploadSchemasRequest = { taskType: '', folderId: '' };
exports.ListUploadSchemasRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.taskType !== '') {
            writer.uint32(10).string(message.taskType);
        }
        if (message.folderId !== '') {
            writer.uint32(18).string(message.folderId);
        }
        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({}, baseListUploadSchemasRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.taskType = reader.string();
                    break;
                case 2:
                    message.folderId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListUploadSchemasRequest);
        message.taskType =
            object.taskType !== undefined && object.taskType !== null
                ? String(object.taskType)
                : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.taskType !== undefined && (obj.taskType = message.taskType);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListUploadSchemasRequest);
        message.taskType = (_a = object.taskType) !== null && _a !== void 0 ? _a : '';
        message.folderId = (_b = object.folderId) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseListUploadSchemasResponse = {};
exports.ListUploadSchemasResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.schemas) {
            dataset_1.DatasetUploadSchema.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({}, baseListUploadSchemasResponse);
        message.schemas = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.schemas.push(dataset_1.DatasetUploadSchema.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListUploadSchemasResponse);
        message.schemas = ((_a = object.schemas) !== null && _a !== void 0 ? _a : []).map((e) => dataset_1.DatasetUploadSchema.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.schemas) {
            obj.schemas = message.schemas.map((e) => e ? dataset_1.DatasetUploadSchema.toJSON(e) : undefined);
        }
        else {
            obj.schemas = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListUploadSchemasResponse);
        message.schemas = ((_a = object.schemas) === null || _a === void 0 ? void 0 : _a.map((e) => dataset_1.DatasetUploadSchema.fromPartial(e))) || [];
        return message;
    },
};
const baseListTypesRequest = { folderId: '' };
exports.ListTypesRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(10).string(message.folderId);
        }
        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({}, baseListTypesRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.folderId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListTypesRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListTypesRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListTypesResponse = { types: '' };
exports.ListTypesResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.types) {
            writer.uint32(10).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListTypesResponse);
        message.types = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.types.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListTypesResponse);
        message.types = ((_a = object.types) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.types) {
            obj.types = message.types.map((e) => e);
        }
        else {
            obj.types = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListTypesResponse);
        message.types = ((_a = object.types) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
const baseGetDatasetPreviewRequest = { datasetId: '' };
exports.GetDatasetPreviewRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseGetDatasetPreviewRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetDatasetPreviewRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetDatasetPreviewRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseGetDatasetPreviewResponse = { datasetId: '', previewLines: '' };
exports.GetDatasetPreviewResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        for (const v of message.previewLines) {
            writer.uint32(18).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseGetDatasetPreviewResponse);
        message.previewLines = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.previewLines.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseGetDatasetPreviewResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.previewLines = ((_a = object.previewLines) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        if (message.previewLines) {
            obj.previewLines = message.previewLines.map((e) => e);
        }
        else {
            obj.previewLines = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseGetDatasetPreviewResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.previewLines = ((_b = object.previewLines) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
const baseGetDownloadUrlsRequest = { datasetId: '' };
exports.GetDownloadUrlsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        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({}, baseGetDownloadUrlsRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetDownloadUrlsRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetDownloadUrlsRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseGetDownloadUrlsResponse = { datasetId: '' };
exports.GetDownloadUrlsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        for (const v of message.downloadUrls) {
            dataset_1.DatasetFileDownloadUrl.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({}, baseGetDownloadUrlsResponse);
        message.downloadUrls = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.downloadUrls.push(dataset_1.DatasetFileDownloadUrl.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseGetDownloadUrlsResponse);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.downloadUrls = ((_a = object.downloadUrls) !== null && _a !== void 0 ? _a : []).map((e) => dataset_1.DatasetFileDownloadUrl.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        if (message.downloadUrls) {
            obj.downloadUrls = message.downloadUrls.map((e) => e ? dataset_1.DatasetFileDownloadUrl.toJSON(e) : undefined);
        }
        else {
            obj.downloadUrls = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseGetDownloadUrlsResponse);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.downloadUrls =
            ((_b = object.downloadUrls) === null || _b === void 0 ? void 0 : _b.map((e) => dataset_1.DatasetFileDownloadUrl.fromPartial(e))) || [];
        return message;
    },
};
const baseListOperationsIdsRequest = { datasetId: '' };
exports.ListOperationsIdsRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.datasetId) {
            writer.uint32(10).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListOperationsIdsRequest);
        message.datasetId = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListOperationsIdsRequest);
        message.datasetId = ((_a = object.datasetId) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.datasetId) {
            obj.datasetId = message.datasetId.map((e) => e);
        }
        else {
            obj.datasetId = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListOperationsIdsRequest);
        message.datasetId = ((_a = object.datasetId) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
const baseListOperationsIdsResponse = {};
exports.ListOperationsIdsResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        Object.entries(message.datasetIdToOperationId).forEach(([key, value]) => {
            exports.ListOperationsIdsResponse_DatasetIdToOperationIdEntry.encode({ key: key, value }, 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({}, baseListOperationsIdsResponse);
        message.datasetIdToOperationId = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    const entry1 = exports.ListOperationsIdsResponse_DatasetIdToOperationIdEntry.decode(reader, reader.uint32());
                    if (entry1.value !== undefined) {
                        message.datasetIdToOperationId[entry1.key] = entry1.value;
                    }
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListOperationsIdsResponse);
        message.datasetIdToOperationId = Object.entries((_a = object.datasetIdToOperationId) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        return message;
    },
    toJSON(message) {
        const obj = {};
        obj.datasetIdToOperationId = {};
        if (message.datasetIdToOperationId) {
            Object.entries(message.datasetIdToOperationId).forEach(([k, v]) => {
                obj.datasetIdToOperationId[k] = v;
            });
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListOperationsIdsResponse);
        message.datasetIdToOperationId = Object.entries((_a = object.datasetIdToOperationId) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        return message;
    },
};
const baseListOperationsIdsResponse_DatasetIdToOperationIdEntry = { key: '', value: '' };
exports.ListOperationsIdsResponse_DatasetIdToOperationIdEntry = {
    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({}, baseListOperationsIdsResponse_DatasetIdToOperationIdEntry);
        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({}, baseListOperationsIdsResponse_DatasetIdToOperationIdEntry);
        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({}, baseListOperationsIdsResponse_DatasetIdToOperationIdEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
/** A set of methods for managing datasets. */
exports.DatasetServiceService = {
    /** Returns dataset information by dataset id. */
    describe: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/Describe',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DescribeDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DescribeDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.DescribeDatasetResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.DescribeDatasetResponse.decode(value),
    },
    /** Starts dataset validation process. */
    validate: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/Validate',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ValidateDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ValidateDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Creates dataset. */
    create: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreateDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreateDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.CreateDatasetResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.CreateDatasetResponse.decode(value),
    },
    /** Updates dataset. */
    update: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdateDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdateDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.UpdateDatasetResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.UpdateDatasetResponse.decode(value),
    },
    /** Deletes dataset. */
    delete: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeleteDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeleteDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.DeleteDatasetResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.DeleteDatasetResponse.decode(value),
    },
    /** Lists datasets in specified folder. */
    list: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListDatasetsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListDatasetsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListDatasetsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListDatasetsResponse.decode(value),
    },
    /**
     * Deprecated. Use ListUploadSchemas.
     *
     * @deprecated
     */
    listUploadFormats: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/ListUploadFormats',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListUploadFormatsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListUploadFormatsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListUploadFormatsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListUploadFormatsResponse.decode(value),
    },
    /** Lists supported dataset upload formats types and schemas for the specified dataset task type. */
    listUploadSchemas: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/ListUploadSchemas',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListUploadSchemasRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListUploadSchemasRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListUploadSchemasResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListUploadSchemasResponse.decode(value),
    },
    /**
     * Returns an S3 presigned URL for dataset upload.
     * This method only applicable if the dataset size does not exceed 5GB.
     */
    getUploadDraftUrl: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/GetUploadDraftUrl',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetUploadDraftUrlRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetUploadDraftUrlRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.GetUploadDraftUrlResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.GetUploadDraftUrlResponse.decode(value),
    },
    /** Get urls to download dataset */
    getDownloadUrls: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/GetDownloadUrls',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetDownloadUrlsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetDownloadUrlsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.GetDownloadUrlsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.GetDownloadUrlsResponse.decode(value),
    },
    /** Returns a list of S3 presigned URLs for multipart upload of dataset. */
    startMultipartUploadDraft: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/StartMultipartUploadDraft',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.StartMultipartUploadDraftRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.StartMultipartUploadDraftRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.StartMultipartUploadDraftResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.StartMultipartUploadDraftResponse.decode(value),
    },
    /** Finishes multipart upload of the dataset. */
    finishMultipartUploadDraft: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/FinishMultipartUploadDraft',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.FinishMultipartUploadDraftRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.FinishMultipartUploadDraftRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.FinishMultipartUploadDraftResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.FinishMultipartUploadDraftResponse.decode(value),
    },
    /** Returns a list of dataset types */
    listTypes: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/ListTypes',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListTypesRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListTypesRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListTypesResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListTypesResponse.decode(value),
    },
    /** Returns a preview of dataset types */
    getPreview: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/GetPreview',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetDatasetPreviewRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetDatasetPreviewRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.GetDatasetPreviewResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.GetDatasetPreviewResponse.decode(value),
    },
    listOperationsIds: {
        path: '/yandex.cloud.ai.dataset.v1.DatasetService/ListOperationsIds',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListOperationsIdsRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListOperationsIdsRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListOperationsIdsResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListOperationsIdsResponse.decode(value),
    },
};
exports.DatasetServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.DatasetServiceService, 'yandex.cloud.ai.dataset.v1.DatasetService');
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();
}
