"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransferServiceClient = exports.TransferServiceService = exports.ActivateTransferMetadata = exports.ActivateTransferRequest = exports.DeactivateTransferMetadata = exports.DeactivateTransferRequest = exports.GetTransferRequest = exports.ListTransfersResponse = exports.ListTransfersRequest = exports.DeleteTransferMetadata = exports.DeleteTransferRequest = exports.UpdateTransferMetadata = exports.UpdateTransferRequest_LabelsEntry = exports.UpdateTransferRequest = exports.CreateTransferMetadata = exports.CreateTransferRequest_LabelsEntry = exports.CreateTransferRequest = 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 transfer_1 = require("../../../../yandex/cloud/datatransfer/v1/transfer");
const field_mask_1 = require("../../../../google/protobuf/field_mask");
const operation_1 = require("../../../../yandex/cloud/operation/operation");
exports.protobufPackage = 'yandex.cloud.datatransfer.v1';
const baseCreateTransferRequest = {
    sourceId: '',
    targetId: '',
    description: '',
    folderId: '',
    type: 0,
    name: '',
};
exports.CreateTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.sourceId !== '') {
            writer.uint32(10).string(message.sourceId);
        }
        if (message.targetId !== '') {
            writer.uint32(18).string(message.targetId);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.folderId !== '') {
            writer.uint32(34).string(message.folderId);
        }
        if (message.runtime !== undefined) {
            transfer_1.Runtime.encode(message.runtime, writer.uint32(42).fork()).ldelim();
        }
        if (message.type !== 0) {
            writer.uint32(48).int32(message.type);
        }
        if (message.name !== '') {
            writer.uint32(58).string(message.name);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.CreateTransferRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(66).fork()).ldelim();
        });
        if (message.transformation !== undefined) {
            transfer_1.Transformation.encode(message.transformation, writer.uint32(82).fork()).ldelim();
        }
        if (message.dataObjects !== undefined) {
            transfer_1.DataObjects.encode(message.dataObjects, writer.uint32(98).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({}, baseCreateTransferRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.sourceId = reader.string();
                    break;
                case 2:
                    message.targetId = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    message.folderId = reader.string();
                    break;
                case 5:
                    message.runtime = transfer_1.Runtime.decode(reader, reader.uint32());
                    break;
                case 6:
                    message.type = reader.int32();
                    break;
                case 7:
                    message.name = reader.string();
                    break;
                case 8:
                    const entry8 = exports.CreateTransferRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry8.value !== undefined) {
                        message.labels[entry8.key] = entry8.value;
                    }
                    break;
                case 10:
                    message.transformation = transfer_1.Transformation.decode(reader, reader.uint32());
                    break;
                case 12:
                    message.dataObjects = transfer_1.DataObjects.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseCreateTransferRequest);
        message.sourceId =
            object.sourceId !== undefined && object.sourceId !== null
                ? String(object.sourceId)
                : '';
        message.targetId =
            object.targetId !== undefined && object.targetId !== null
                ? String(object.targetId)
                : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? transfer_1.Runtime.fromJSON(object.runtime)
                : undefined;
        message.type =
            object.type !== undefined && object.type !== null
                ? (0, transfer_1.transferTypeFromJSON)(object.type)
                : 0;
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? transfer_1.Transformation.fromJSON(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? transfer_1.DataObjects.fromJSON(object.dataObjects)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.sourceId !== undefined && (obj.sourceId = message.sourceId);
        message.targetId !== undefined && (obj.targetId = message.targetId);
        message.description !== undefined && (obj.description = message.description);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.runtime !== undefined &&
            (obj.runtime = message.runtime ? transfer_1.Runtime.toJSON(message.runtime) : undefined);
        message.type !== undefined && (obj.type = (0, transfer_1.transferTypeToJSON)(message.type));
        message.name !== undefined && (obj.name = message.name);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.transformation !== undefined &&
            (obj.transformation = message.transformation
                ? transfer_1.Transformation.toJSON(message.transformation)
                : undefined);
        message.dataObjects !== undefined &&
            (obj.dataObjects = message.dataObjects
                ? transfer_1.DataObjects.toJSON(message.dataObjects)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g;
        const message = Object.assign({}, baseCreateTransferRequest);
        message.sourceId = (_a = object.sourceId) !== null && _a !== void 0 ? _a : '';
        message.targetId = (_b = object.targetId) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.folderId = (_d = object.folderId) !== null && _d !== void 0 ? _d : '';
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? transfer_1.Runtime.fromPartial(object.runtime)
                : undefined;
        message.type = (_e = object.type) !== null && _e !== void 0 ? _e : 0;
        message.name = (_f = object.name) !== null && _f !== void 0 ? _f : '';
        message.labels = Object.entries((_g = object.labels) !== null && _g !== void 0 ? _g : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? transfer_1.Transformation.fromPartial(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? transfer_1.DataObjects.fromPartial(object.dataObjects)
                : undefined;
        return message;
    },
};
const baseCreateTransferRequest_LabelsEntry = { key: '', value: '' };
exports.CreateTransferRequest_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({}, baseCreateTransferRequest_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({}, baseCreateTransferRequest_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({}, baseCreateTransferRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseCreateTransferMetadata = { transferId: '' };
exports.CreateTransferMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseCreateTransferMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCreateTransferMetadata);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCreateTransferMetadata);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseUpdateTransferRequest = { transferId: '', description: '', name: '' };
exports.UpdateTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        if (message.description !== '') {
            writer.uint32(18).string(message.description);
        }
        if (message.runtime !== undefined) {
            transfer_1.Runtime.encode(message.runtime, writer.uint32(26).fork()).ldelim();
        }
        if (message.name !== '') {
            writer.uint32(34).string(message.name);
        }
        if (message.updateMask !== undefined) {
            field_mask_1.FieldMask.encode(message.updateMask, writer.uint32(42).fork()).ldelim();
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.UpdateTransferRequest_LabelsEntry.encode({ key: key, value }, writer.uint32(50).fork()).ldelim();
        });
        if (message.transformation !== undefined) {
            transfer_1.Transformation.encode(message.transformation, writer.uint32(66).fork()).ldelim();
        }
        if (message.dataObjects !== undefined) {
            transfer_1.DataObjects.encode(message.dataObjects, writer.uint32(82).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({}, baseUpdateTransferRequest);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                case 2:
                    message.description = reader.string();
                    break;
                case 3:
                    message.runtime = transfer_1.Runtime.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.name = reader.string();
                    break;
                case 5:
                    message.updateMask = field_mask_1.FieldMask.decode(reader, reader.uint32());
                    break;
                case 6:
                    const entry6 = exports.UpdateTransferRequest_LabelsEntry.decode(reader, reader.uint32());
                    if (entry6.value !== undefined) {
                        message.labels[entry6.key] = entry6.value;
                    }
                    break;
                case 8:
                    message.transformation = transfer_1.Transformation.decode(reader, reader.uint32());
                    break;
                case 10:
                    message.dataObjects = transfer_1.DataObjects.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseUpdateTransferRequest);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? transfer_1.Runtime.fromJSON(object.runtime)
                : undefined;
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromJSON(object.updateMask)
                : undefined;
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? transfer_1.Transformation.fromJSON(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? transfer_1.DataObjects.fromJSON(object.dataObjects)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        message.description !== undefined && (obj.description = message.description);
        message.runtime !== undefined &&
            (obj.runtime = message.runtime ? transfer_1.Runtime.toJSON(message.runtime) : undefined);
        message.name !== undefined && (obj.name = message.name);
        message.updateMask !== undefined &&
            (obj.updateMask = message.updateMask
                ? field_mask_1.FieldMask.toJSON(message.updateMask)
                : undefined);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.transformation !== undefined &&
            (obj.transformation = message.transformation
                ? transfer_1.Transformation.toJSON(message.transformation)
                : undefined);
        message.dataObjects !== undefined &&
            (obj.dataObjects = message.dataObjects
                ? transfer_1.DataObjects.toJSON(message.dataObjects)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseUpdateTransferRequest);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? transfer_1.Runtime.fromPartial(object.runtime)
                : undefined;
        message.name = (_c = object.name) !== null && _c !== void 0 ? _c : '';
        message.updateMask =
            object.updateMask !== undefined && object.updateMask !== null
                ? field_mask_1.FieldMask.fromPartial(object.updateMask)
                : undefined;
        message.labels = Object.entries((_d = object.labels) !== null && _d !== void 0 ? _d : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? transfer_1.Transformation.fromPartial(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? transfer_1.DataObjects.fromPartial(object.dataObjects)
                : undefined;
        return message;
    },
};
const baseUpdateTransferRequest_LabelsEntry = { key: '', value: '' };
exports.UpdateTransferRequest_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({}, baseUpdateTransferRequest_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({}, baseUpdateTransferRequest_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({}, baseUpdateTransferRequest_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseUpdateTransferMetadata = { transferId: '' };
exports.UpdateTransferMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseUpdateTransferMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseUpdateTransferMetadata);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseUpdateTransferMetadata);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteTransferRequest = { transferId: '' };
exports.DeleteTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseDeleteTransferRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteTransferRequest);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteTransferRequest);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeleteTransferMetadata = { transferId: '' };
exports.DeleteTransferMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseDeleteTransferMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeleteTransferMetadata);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeleteTransferMetadata);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListTransfersRequest = { folderId: '', pageSize: 0, pageToken: '' };
exports.ListTransfersRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.folderId !== '') {
            writer.uint32(18).string(message.folderId);
        }
        if (message.pageSize !== 0) {
            writer.uint32(24).int64(message.pageSize);
        }
        if (message.pageToken !== '') {
            writer.uint32(34).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({}, baseListTransfersRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 2:
                    message.folderId = reader.string();
                    break;
                case 3:
                    message.pageSize = longToNumber(reader.int64());
                    break;
                case 4:
                    message.pageToken = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListTransfersRequest);
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.pageSize =
            object.pageSize !== undefined && object.pageSize !== null ? Number(object.pageSize) : 0;
        message.pageToken =
            object.pageToken !== undefined && object.pageToken !== null
                ? String(object.pageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));
        message.pageToken !== undefined && (obj.pageToken = message.pageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseListTransfersRequest);
        message.folderId = (_a = object.folderId) !== null && _a !== void 0 ? _a : '';
        message.pageSize = (_b = object.pageSize) !== null && _b !== void 0 ? _b : 0;
        message.pageToken = (_c = object.pageToken) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
const baseListTransfersResponse = { nextPageToken: '' };
exports.ListTransfersResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.transfers) {
            transfer_1.Transfer.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({}, baseListTransfersResponse);
        message.transfers = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transfers.push(transfer_1.Transfer.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({}, baseListTransfersResponse);
        message.transfers = ((_a = object.transfers) !== null && _a !== void 0 ? _a : []).map((e) => transfer_1.Transfer.fromJSON(e));
        message.nextPageToken =
            object.nextPageToken !== undefined && object.nextPageToken !== null
                ? String(object.nextPageToken)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.transfers) {
            obj.transfers = message.transfers.map((e) => (e ? transfer_1.Transfer.toJSON(e) : undefined));
        }
        else {
            obj.transfers = [];
        }
        message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseListTransfersResponse);
        message.transfers = ((_a = object.transfers) === null || _a === void 0 ? void 0 : _a.map((e) => transfer_1.Transfer.fromPartial(e))) || [];
        message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseGetTransferRequest = { transferId: '' };
exports.GetTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseGetTransferRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetTransferRequest);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetTransferRequest);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeactivateTransferRequest = { transferId: '' };
exports.DeactivateTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseDeactivateTransferRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeactivateTransferRequest);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeactivateTransferRequest);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseDeactivateTransferMetadata = { transferId: '' };
exports.DeactivateTransferMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseDeactivateTransferMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeactivateTransferMetadata);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDeactivateTransferMetadata);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseActivateTransferRequest = { transferId: '' };
exports.ActivateTransferRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseActivateTransferRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseActivateTransferRequest);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseActivateTransferRequest);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseActivateTransferMetadata = { transferId: '' };
exports.ActivateTransferMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transferId !== '') {
            writer.uint32(10).string(message.transferId);
        }
        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({}, baseActivateTransferMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transferId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseActivateTransferMetadata);
        message.transferId =
            object.transferId !== undefined && object.transferId !== null
                ? String(object.transferId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transferId !== undefined && (obj.transferId = message.transferId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseActivateTransferMetadata);
        message.transferId = (_a = object.transferId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
exports.TransferServiceService = {
    /** Creates a transfer in the specified folder. */
    create: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Create',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.CreateTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.CreateTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Updates the specified transfer. */
    update: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Update',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.UpdateTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.UpdateTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Deletes the specified transfer. */
    delete: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Delete',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeleteTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeleteTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Lists transfers in the specified folder. */
    list: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListTransfersRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListTransfersRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListTransfersResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListTransfersResponse.decode(value),
    },
    /**
     * Returns the specified transfer.
     *
     * To get the list of all available transfers, make a [List] request.
     */
    get: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(transfer_1.Transfer.encode(value).finish()),
        responseDeserialize: (value) => transfer_1.Transfer.decode(value),
    },
    /**
     * Deactivates the specified transfer.
     *
     * To get the list of all available transfers, make a [List] request.
     */
    deactivate: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Deactivate',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeactivateTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeactivateTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /**
     * Activates the specified transfer.
     *
     * To get the list of all available transfers, make a [List] request.
     */
    activate: {
        path: '/yandex.cloud.datatransfer.v1.TransferService/Activate',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ActivateTransferRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ActivateTransferRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
};
exports.TransferServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.TransferServiceService, 'yandex.cloud.datatransfer.v1.TransferService');
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();
}
