"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataObjects = exports.Transformation = exports.Transformer = exports.FilterRowsTransformer = exports.TableSplitterTransformer = exports.SharderTransformer = exports.ToStringTransformer = exports.ReplacePrimaryKeyTransformer = exports.RenameTablesTransformer = exports.RenameTable = exports.Table = exports.FilterColumnsTransformer = exports.MaskFieldTransformer = exports.ColumnsFilter = exports.TablesFilter = exports.MaskFunctionHash = exports.MaskFunction = exports.YcRuntime = exports.ShardingUploadParams = exports.Runtime = exports.Transfer_LabelsEntry = exports.Transfer = exports.transferStatusToJSON = exports.transferStatusFromJSON = exports.TransferStatus = exports.transferTypeToJSON = exports.transferTypeFromJSON = exports.TransferType = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const endpoint_1 = require("../../../../yandex/cloud/datatransfer/v1/endpoint");
exports.protobufPackage = 'yandex.cloud.datatransfer.v1';
var TransferType;
(function (TransferType) {
    TransferType[TransferType["TRANSFER_TYPE_UNSPECIFIED"] = 0] = "TRANSFER_TYPE_UNSPECIFIED";
    /** SNAPSHOT_AND_INCREMENT - Snapshot and increment */
    TransferType[TransferType["SNAPSHOT_AND_INCREMENT"] = 1] = "SNAPSHOT_AND_INCREMENT";
    /** SNAPSHOT_ONLY - Snapshot */
    TransferType[TransferType["SNAPSHOT_ONLY"] = 2] = "SNAPSHOT_ONLY";
    /** INCREMENT_ONLY - Increment */
    TransferType[TransferType["INCREMENT_ONLY"] = 3] = "INCREMENT_ONLY";
    TransferType[TransferType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(TransferType = exports.TransferType || (exports.TransferType = {}));
function transferTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'TRANSFER_TYPE_UNSPECIFIED':
            return TransferType.TRANSFER_TYPE_UNSPECIFIED;
        case 1:
        case 'SNAPSHOT_AND_INCREMENT':
            return TransferType.SNAPSHOT_AND_INCREMENT;
        case 2:
        case 'SNAPSHOT_ONLY':
            return TransferType.SNAPSHOT_ONLY;
        case 3:
        case 'INCREMENT_ONLY':
            return TransferType.INCREMENT_ONLY;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return TransferType.UNRECOGNIZED;
    }
}
exports.transferTypeFromJSON = transferTypeFromJSON;
function transferTypeToJSON(object) {
    switch (object) {
        case TransferType.TRANSFER_TYPE_UNSPECIFIED:
            return 'TRANSFER_TYPE_UNSPECIFIED';
        case TransferType.SNAPSHOT_AND_INCREMENT:
            return 'SNAPSHOT_AND_INCREMENT';
        case TransferType.SNAPSHOT_ONLY:
            return 'SNAPSHOT_ONLY';
        case TransferType.INCREMENT_ONLY:
            return 'INCREMENT_ONLY';
        default:
            return 'UNKNOWN';
    }
}
exports.transferTypeToJSON = transferTypeToJSON;
var TransferStatus;
(function (TransferStatus) {
    TransferStatus[TransferStatus["TRANSFER_STATUS_UNSPECIFIED"] = 0] = "TRANSFER_STATUS_UNSPECIFIED";
    /** CREATING - Transfer does some work before running */
    TransferStatus[TransferStatus["CREATING"] = 1] = "CREATING";
    /** CREATED - Transfer created but not started by user */
    TransferStatus[TransferStatus["CREATED"] = 2] = "CREATED";
    /** RUNNING - Transfer currently doing replication work */
    TransferStatus[TransferStatus["RUNNING"] = 3] = "RUNNING";
    /** STOPPING - Transfer shutdown */
    TransferStatus[TransferStatus["STOPPING"] = 4] = "STOPPING";
    /** STOPPED - Transfer stopped by user */
    TransferStatus[TransferStatus["STOPPED"] = 5] = "STOPPED";
    /** ERROR - Transfer stopped by system */
    TransferStatus[TransferStatus["ERROR"] = 6] = "ERROR";
    /** SNAPSHOTTING - Transfer copy snapshot */
    TransferStatus[TransferStatus["SNAPSHOTTING"] = 7] = "SNAPSHOTTING";
    /** DONE - Transfer reach terminal phase */
    TransferStatus[TransferStatus["DONE"] = 8] = "DONE";
    TransferStatus[TransferStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(TransferStatus = exports.TransferStatus || (exports.TransferStatus = {}));
function transferStatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'TRANSFER_STATUS_UNSPECIFIED':
            return TransferStatus.TRANSFER_STATUS_UNSPECIFIED;
        case 1:
        case 'CREATING':
            return TransferStatus.CREATING;
        case 2:
        case 'CREATED':
            return TransferStatus.CREATED;
        case 3:
        case 'RUNNING':
            return TransferStatus.RUNNING;
        case 4:
        case 'STOPPING':
            return TransferStatus.STOPPING;
        case 5:
        case 'STOPPED':
            return TransferStatus.STOPPED;
        case 6:
        case 'ERROR':
            return TransferStatus.ERROR;
        case 7:
        case 'SNAPSHOTTING':
            return TransferStatus.SNAPSHOTTING;
        case 8:
        case 'DONE':
            return TransferStatus.DONE;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return TransferStatus.UNRECOGNIZED;
    }
}
exports.transferStatusFromJSON = transferStatusFromJSON;
function transferStatusToJSON(object) {
    switch (object) {
        case TransferStatus.TRANSFER_STATUS_UNSPECIFIED:
            return 'TRANSFER_STATUS_UNSPECIFIED';
        case TransferStatus.CREATING:
            return 'CREATING';
        case TransferStatus.CREATED:
            return 'CREATED';
        case TransferStatus.RUNNING:
            return 'RUNNING';
        case TransferStatus.STOPPING:
            return 'STOPPING';
        case TransferStatus.STOPPED:
            return 'STOPPED';
        case TransferStatus.ERROR:
            return 'ERROR';
        case TransferStatus.SNAPSHOTTING:
            return 'SNAPSHOTTING';
        case TransferStatus.DONE:
            return 'DONE';
        default:
            return 'UNKNOWN';
    }
}
exports.transferStatusToJSON = transferStatusToJSON;
const baseTransfer = {
    id: '',
    folderId: '',
    name: '',
    description: '',
    status: 0,
    type: 0,
    warning: '',
    prestable: false,
};
exports.Transfer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.folderId !== '') {
            writer.uint32(18).string(message.folderId);
        }
        if (message.name !== '') {
            writer.uint32(34).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(42).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.Transfer_LabelsEntry.encode({ key: key, value }, writer.uint32(50).fork()).ldelim();
        });
        if (message.source !== undefined) {
            endpoint_1.Endpoint.encode(message.source, writer.uint32(58).fork()).ldelim();
        }
        if (message.target !== undefined) {
            endpoint_1.Endpoint.encode(message.target, writer.uint32(66).fork()).ldelim();
        }
        if (message.runtime !== undefined) {
            exports.Runtime.encode(message.runtime, writer.uint32(74).fork()).ldelim();
        }
        if (message.status !== 0) {
            writer.uint32(80).int32(message.status);
        }
        if (message.type !== 0) {
            writer.uint32(96).int32(message.type);
        }
        if (message.warning !== '') {
            writer.uint32(122).string(message.warning);
        }
        if (message.transformation !== undefined) {
            exports.Transformation.encode(message.transformation, writer.uint32(138).fork()).ldelim();
        }
        if (message.dataObjects !== undefined) {
            exports.DataObjects.encode(message.dataObjects, writer.uint32(154).fork()).ldelim();
        }
        if (message.prestable === true) {
            writer.uint32(176).bool(message.prestable);
        }
        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({}, baseTransfer);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.folderId = reader.string();
                    break;
                case 4:
                    message.name = reader.string();
                    break;
                case 5:
                    message.description = reader.string();
                    break;
                case 6:
                    const entry6 = exports.Transfer_LabelsEntry.decode(reader, reader.uint32());
                    if (entry6.value !== undefined) {
                        message.labels[entry6.key] = entry6.value;
                    }
                    break;
                case 7:
                    message.source = endpoint_1.Endpoint.decode(reader, reader.uint32());
                    break;
                case 8:
                    message.target = endpoint_1.Endpoint.decode(reader, reader.uint32());
                    break;
                case 9:
                    message.runtime = exports.Runtime.decode(reader, reader.uint32());
                    break;
                case 10:
                    message.status = reader.int32();
                    break;
                case 12:
                    message.type = reader.int32();
                    break;
                case 15:
                    message.warning = reader.string();
                    break;
                case 17:
                    message.transformation = exports.Transformation.decode(reader, reader.uint32());
                    break;
                case 19:
                    message.dataObjects = exports.DataObjects.decode(reader, reader.uint32());
                    break;
                case 22:
                    message.prestable = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseTransfer);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        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;
        }, {});
        message.source =
            object.source !== undefined && object.source !== null
                ? endpoint_1.Endpoint.fromJSON(object.source)
                : undefined;
        message.target =
            object.target !== undefined && object.target !== null
                ? endpoint_1.Endpoint.fromJSON(object.target)
                : undefined;
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? exports.Runtime.fromJSON(object.runtime)
                : undefined;
        message.status =
            object.status !== undefined && object.status !== null
                ? transferStatusFromJSON(object.status)
                : 0;
        message.type =
            object.type !== undefined && object.type !== null
                ? transferTypeFromJSON(object.type)
                : 0;
        message.warning =
            object.warning !== undefined && object.warning !== null ? String(object.warning) : '';
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? exports.Transformation.fromJSON(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? exports.DataObjects.fromJSON(object.dataObjects)
                : undefined;
        message.prestable =
            object.prestable !== undefined && object.prestable !== null
                ? Boolean(object.prestable)
                : false;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        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;
            });
        }
        message.source !== undefined &&
            (obj.source = message.source ? endpoint_1.Endpoint.toJSON(message.source) : undefined);
        message.target !== undefined &&
            (obj.target = message.target ? endpoint_1.Endpoint.toJSON(message.target) : undefined);
        message.runtime !== undefined &&
            (obj.runtime = message.runtime ? exports.Runtime.toJSON(message.runtime) : undefined);
        message.status !== undefined && (obj.status = transferStatusToJSON(message.status));
        message.type !== undefined && (obj.type = transferTypeToJSON(message.type));
        message.warning !== undefined && (obj.warning = message.warning);
        message.transformation !== undefined &&
            (obj.transformation = message.transformation
                ? exports.Transformation.toJSON(message.transformation)
                : undefined);
        message.dataObjects !== undefined &&
            (obj.dataObjects = message.dataObjects
                ? exports.DataObjects.toJSON(message.dataObjects)
                : undefined);
        message.prestable !== undefined && (obj.prestable = message.prestable);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j;
        const message = Object.assign({}, baseTransfer);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.folderId = (_b = object.folderId) !== null && _b !== void 0 ? _b : '';
        message.name = (_c = object.name) !== null && _c !== void 0 ? _c : '';
        message.description = (_d = object.description) !== null && _d !== void 0 ? _d : '';
        message.labels = Object.entries((_e = object.labels) !== null && _e !== void 0 ? _e : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.source =
            object.source !== undefined && object.source !== null
                ? endpoint_1.Endpoint.fromPartial(object.source)
                : undefined;
        message.target =
            object.target !== undefined && object.target !== null
                ? endpoint_1.Endpoint.fromPartial(object.target)
                : undefined;
        message.runtime =
            object.runtime !== undefined && object.runtime !== null
                ? exports.Runtime.fromPartial(object.runtime)
                : undefined;
        message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
        message.type = (_g = object.type) !== null && _g !== void 0 ? _g : 0;
        message.warning = (_h = object.warning) !== null && _h !== void 0 ? _h : '';
        message.transformation =
            object.transformation !== undefined && object.transformation !== null
                ? exports.Transformation.fromPartial(object.transformation)
                : undefined;
        message.dataObjects =
            object.dataObjects !== undefined && object.dataObjects !== null
                ? exports.DataObjects.fromPartial(object.dataObjects)
                : undefined;
        message.prestable = (_j = object.prestable) !== null && _j !== void 0 ? _j : false;
        return message;
    },
};
const baseTransfer_LabelsEntry = { key: '', value: '' };
exports.Transfer_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({}, baseTransfer_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({}, baseTransfer_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({}, baseTransfer_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseRuntime = {};
exports.Runtime = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.ycRuntime !== undefined) {
            exports.YcRuntime.encode(message.ycRuntime, writer.uint32(34).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({}, baseRuntime);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 4:
                    message.ycRuntime = exports.YcRuntime.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseRuntime);
        message.ycRuntime =
            object.ycRuntime !== undefined && object.ycRuntime !== null
                ? exports.YcRuntime.fromJSON(object.ycRuntime)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.ycRuntime !== undefined &&
            (obj.ycRuntime = message.ycRuntime ? exports.YcRuntime.toJSON(message.ycRuntime) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseRuntime);
        message.ycRuntime =
            object.ycRuntime !== undefined && object.ycRuntime !== null
                ? exports.YcRuntime.fromPartial(object.ycRuntime)
                : undefined;
        return message;
    },
};
const baseShardingUploadParams = { jobCount: 0, processCount: 0 };
exports.ShardingUploadParams = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.jobCount !== 0) {
            writer.uint32(8).int64(message.jobCount);
        }
        if (message.processCount !== 0) {
            writer.uint32(16).int64(message.processCount);
        }
        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({}, baseShardingUploadParams);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.jobCount = longToNumber(reader.int64());
                    break;
                case 2:
                    message.processCount = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseShardingUploadParams);
        message.jobCount =
            object.jobCount !== undefined && object.jobCount !== null ? Number(object.jobCount) : 0;
        message.processCount =
            object.processCount !== undefined && object.processCount !== null
                ? Number(object.processCount)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.jobCount !== undefined && (obj.jobCount = Math.round(message.jobCount));
        message.processCount !== undefined && (obj.processCount = Math.round(message.processCount));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseShardingUploadParams);
        message.jobCount = (_a = object.jobCount) !== null && _a !== void 0 ? _a : 0;
        message.processCount = (_b = object.processCount) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseYcRuntime = { jobCount: 0 };
exports.YcRuntime = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.jobCount !== 0) {
            writer.uint32(8).int64(message.jobCount);
        }
        if (message.uploadShardParams !== undefined) {
            exports.ShardingUploadParams.encode(message.uploadShardParams, writer.uint32(66).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseYcRuntime);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.jobCount = longToNumber(reader.int64());
                    break;
                case 8:
                    message.uploadShardParams = exports.ShardingUploadParams.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseYcRuntime);
        message.jobCount =
            object.jobCount !== undefined && object.jobCount !== null ? Number(object.jobCount) : 0;
        message.uploadShardParams =
            object.uploadShardParams !== undefined && object.uploadShardParams !== null
                ? exports.ShardingUploadParams.fromJSON(object.uploadShardParams)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.jobCount !== undefined && (obj.jobCount = Math.round(message.jobCount));
        message.uploadShardParams !== undefined &&
            (obj.uploadShardParams = message.uploadShardParams
                ? exports.ShardingUploadParams.toJSON(message.uploadShardParams)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseYcRuntime);
        message.jobCount = (_a = object.jobCount) !== null && _a !== void 0 ? _a : 0;
        message.uploadShardParams =
            object.uploadShardParams !== undefined && object.uploadShardParams !== null
                ? exports.ShardingUploadParams.fromPartial(object.uploadShardParams)
                : undefined;
        return message;
    },
};
const baseMaskFunction = {};
exports.MaskFunction = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.maskFunctionHash !== undefined) {
            exports.MaskFunctionHash.encode(message.maskFunctionHash, 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({}, baseMaskFunction);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.maskFunctionHash = exports.MaskFunctionHash.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseMaskFunction);
        message.maskFunctionHash =
            object.maskFunctionHash !== undefined && object.maskFunctionHash !== null
                ? exports.MaskFunctionHash.fromJSON(object.maskFunctionHash)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.maskFunctionHash !== undefined &&
            (obj.maskFunctionHash = message.maskFunctionHash
                ? exports.MaskFunctionHash.toJSON(message.maskFunctionHash)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseMaskFunction);
        message.maskFunctionHash =
            object.maskFunctionHash !== undefined && object.maskFunctionHash !== null
                ? exports.MaskFunctionHash.fromPartial(object.maskFunctionHash)
                : undefined;
        return message;
    },
};
const baseMaskFunctionHash = { userDefinedSalt: '' };
exports.MaskFunctionHash = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.userDefinedSalt !== '') {
            writer.uint32(10).string(message.userDefinedSalt);
        }
        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({}, baseMaskFunctionHash);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.userDefinedSalt = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseMaskFunctionHash);
        message.userDefinedSalt =
            object.userDefinedSalt !== undefined && object.userDefinedSalt !== null
                ? String(object.userDefinedSalt)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.userDefinedSalt !== undefined && (obj.userDefinedSalt = message.userDefinedSalt);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseMaskFunctionHash);
        message.userDefinedSalt = (_a = object.userDefinedSalt) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseTablesFilter = { includeTables: '', excludeTables: '' };
exports.TablesFilter = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.includeTables) {
            writer.uint32(10).string(v);
        }
        for (const v of message.excludeTables) {
            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({}, baseTablesFilter);
        message.includeTables = [];
        message.excludeTables = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.includeTables.push(reader.string());
                    break;
                case 2:
                    message.excludeTables.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseTablesFilter);
        message.includeTables = ((_a = object.includeTables) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.excludeTables = ((_b = object.excludeTables) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.includeTables) {
            obj.includeTables = message.includeTables.map((e) => e);
        }
        else {
            obj.includeTables = [];
        }
        if (message.excludeTables) {
            obj.excludeTables = message.excludeTables.map((e) => e);
        }
        else {
            obj.excludeTables = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTablesFilter);
        message.includeTables = ((_a = object.includeTables) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        message.excludeTables = ((_b = object.excludeTables) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
const baseColumnsFilter = { includeColumns: '', excludeColumns: '' };
exports.ColumnsFilter = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.includeColumns) {
            writer.uint32(10).string(v);
        }
        for (const v of message.excludeColumns) {
            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({}, baseColumnsFilter);
        message.includeColumns = [];
        message.excludeColumns = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.includeColumns.push(reader.string());
                    break;
                case 2:
                    message.excludeColumns.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseColumnsFilter);
        message.includeColumns = ((_a = object.includeColumns) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.excludeColumns = ((_b = object.excludeColumns) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.includeColumns) {
            obj.includeColumns = message.includeColumns.map((e) => e);
        }
        else {
            obj.includeColumns = [];
        }
        if (message.excludeColumns) {
            obj.excludeColumns = message.excludeColumns.map((e) => e);
        }
        else {
            obj.excludeColumns = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseColumnsFilter);
        message.includeColumns = ((_a = object.includeColumns) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        message.excludeColumns = ((_b = object.excludeColumns) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
const baseMaskFieldTransformer = { columns: '' };
exports.MaskFieldTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.columns) {
            writer.uint32(18).string(v);
        }
        if (message.function !== undefined) {
            exports.MaskFunction.encode(message.function, 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({}, baseMaskFieldTransformer);
        message.columns = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.columns.push(reader.string());
                    break;
                case 3:
                    message.function = exports.MaskFunction.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseMaskFieldTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.columns = ((_a = object.columns) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.function =
            object.function !== undefined && object.function !== null
                ? exports.MaskFunction.fromJSON(object.function)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        if (message.columns) {
            obj.columns = message.columns.map((e) => e);
        }
        else {
            obj.columns = [];
        }
        message.function !== undefined &&
            (obj.function = message.function ? exports.MaskFunction.toJSON(message.function) : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseMaskFieldTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.columns = ((_a = object.columns) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        message.function =
            object.function !== undefined && object.function !== null
                ? exports.MaskFunction.fromPartial(object.function)
                : undefined;
        return message;
    },
};
const baseFilterColumnsTransformer = {};
exports.FilterColumnsTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        if (message.columns !== undefined) {
            exports.ColumnsFilter.encode(message.columns, 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({}, baseFilterColumnsTransformer);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.columns = exports.ColumnsFilter.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFilterColumnsTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromJSON(object.columns)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        message.columns !== undefined &&
            (obj.columns = message.columns ? exports.ColumnsFilter.toJSON(message.columns) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseFilterColumnsTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromPartial(object.columns)
                : undefined;
        return message;
    },
};
const baseTable = { nameSpace: '', name: '' };
exports.Table = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.nameSpace !== '') {
            writer.uint32(10).string(message.nameSpace);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        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({}, baseTable);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.nameSpace = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTable);
        message.nameSpace =
            object.nameSpace !== undefined && object.nameSpace !== null
                ? String(object.nameSpace)
                : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.nameSpace !== undefined && (obj.nameSpace = message.nameSpace);
        message.name !== undefined && (obj.name = message.name);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTable);
        message.nameSpace = (_a = object.nameSpace) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseRenameTable = {};
exports.RenameTable = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.originalName !== undefined) {
            exports.Table.encode(message.originalName, writer.uint32(10).fork()).ldelim();
        }
        if (message.newName !== undefined) {
            exports.Table.encode(message.newName, 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({}, baseRenameTable);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.originalName = exports.Table.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.newName = exports.Table.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseRenameTable);
        message.originalName =
            object.originalName !== undefined && object.originalName !== null
                ? exports.Table.fromJSON(object.originalName)
                : undefined;
        message.newName =
            object.newName !== undefined && object.newName !== null
                ? exports.Table.fromJSON(object.newName)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.originalName !== undefined &&
            (obj.originalName = message.originalName
                ? exports.Table.toJSON(message.originalName)
                : undefined);
        message.newName !== undefined &&
            (obj.newName = message.newName ? exports.Table.toJSON(message.newName) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseRenameTable);
        message.originalName =
            object.originalName !== undefined && object.originalName !== null
                ? exports.Table.fromPartial(object.originalName)
                : undefined;
        message.newName =
            object.newName !== undefined && object.newName !== null
                ? exports.Table.fromPartial(object.newName)
                : undefined;
        return message;
    },
};
const baseRenameTablesTransformer = {};
exports.RenameTablesTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.renameTables) {
            exports.RenameTable.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({}, baseRenameTablesTransformer);
        message.renameTables = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.renameTables.push(exports.RenameTable.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseRenameTablesTransformer);
        message.renameTables = ((_a = object.renameTables) !== null && _a !== void 0 ? _a : []).map((e) => exports.RenameTable.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.renameTables) {
            obj.renameTables = message.renameTables.map((e) => e ? exports.RenameTable.toJSON(e) : undefined);
        }
        else {
            obj.renameTables = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseRenameTablesTransformer);
        message.renameTables = ((_a = object.renameTables) === null || _a === void 0 ? void 0 : _a.map((e) => exports.RenameTable.fromPartial(e))) || [];
        return message;
    },
};
const baseReplacePrimaryKeyTransformer = { keys: '' };
exports.ReplacePrimaryKeyTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.keys) {
            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({}, baseReplacePrimaryKeyTransformer);
        message.keys = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.keys.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseReplacePrimaryKeyTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.keys = ((_a = object.keys) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        if (message.keys) {
            obj.keys = message.keys.map((e) => e);
        }
        else {
            obj.keys = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseReplacePrimaryKeyTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.keys = ((_a = object.keys) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
const baseToStringTransformer = {};
exports.ToStringTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        if (message.columns !== undefined) {
            exports.ColumnsFilter.encode(message.columns, 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({}, baseToStringTransformer);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.columns = exports.ColumnsFilter.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseToStringTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromJSON(object.columns)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        message.columns !== undefined &&
            (obj.columns = message.columns ? exports.ColumnsFilter.toJSON(message.columns) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseToStringTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromPartial(object.columns)
                : undefined;
        return message;
    },
};
const baseSharderTransformer = { shardsCount: 0 };
exports.SharderTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        if (message.columns !== undefined) {
            exports.ColumnsFilter.encode(message.columns, writer.uint32(18).fork()).ldelim();
        }
        if (message.shardsCount !== 0) {
            writer.uint32(24).int64(message.shardsCount);
        }
        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({}, baseSharderTransformer);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.columns = exports.ColumnsFilter.decode(reader, reader.uint32());
                    break;
                case 3:
                    message.shardsCount = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseSharderTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromJSON(object.columns)
                : undefined;
        message.shardsCount =
            object.shardsCount !== undefined && object.shardsCount !== null
                ? Number(object.shardsCount)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        message.columns !== undefined &&
            (obj.columns = message.columns ? exports.ColumnsFilter.toJSON(message.columns) : undefined);
        message.shardsCount !== undefined && (obj.shardsCount = Math.round(message.shardsCount));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseSharderTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.columns =
            object.columns !== undefined && object.columns !== null
                ? exports.ColumnsFilter.fromPartial(object.columns)
                : undefined;
        message.shardsCount = (_a = object.shardsCount) !== null && _a !== void 0 ? _a : 0;
        return message;
    },
};
const baseTableSplitterTransformer = { columns: '', splitter: '' };
exports.TableSplitterTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.columns) {
            writer.uint32(18).string(v);
        }
        if (message.splitter !== '') {
            writer.uint32(26).string(message.splitter);
        }
        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({}, baseTableSplitterTransformer);
        message.columns = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.columns.push(reader.string());
                    break;
                case 3:
                    message.splitter = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseTableSplitterTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.columns = ((_a = object.columns) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.splitter =
            object.splitter !== undefined && object.splitter !== null
                ? String(object.splitter)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        if (message.columns) {
            obj.columns = message.columns.map((e) => e);
        }
        else {
            obj.columns = [];
        }
        message.splitter !== undefined && (obj.splitter = message.splitter);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTableSplitterTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.columns = ((_a = object.columns) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        message.splitter = (_b = object.splitter) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseFilterRowsTransformer = { filter: '', filters: '' };
exports.FilterRowsTransformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.tables !== undefined) {
            exports.TablesFilter.encode(message.tables, writer.uint32(10).fork()).ldelim();
        }
        if (message.filter !== '') {
            writer.uint32(18).string(message.filter);
        }
        for (const v of message.filters) {
            writer.uint32(26).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({}, baseFilterRowsTransformer);
        message.filters = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tables = exports.TablesFilter.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.filter = reader.string();
                    break;
                case 3:
                    message.filters.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseFilterRowsTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromJSON(object.tables)
                : undefined;
        message.filter =
            object.filter !== undefined && object.filter !== null ? String(object.filter) : '';
        message.filters = ((_a = object.filters) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.tables !== undefined &&
            (obj.tables = message.tables ? exports.TablesFilter.toJSON(message.tables) : undefined);
        message.filter !== undefined && (obj.filter = message.filter);
        if (message.filters) {
            obj.filters = message.filters.map((e) => e);
        }
        else {
            obj.filters = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseFilterRowsTransformer);
        message.tables =
            object.tables !== undefined && object.tables !== null
                ? exports.TablesFilter.fromPartial(object.tables)
                : undefined;
        message.filter = (_a = object.filter) !== null && _a !== void 0 ? _a : '';
        message.filters = ((_b = object.filters) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
const baseTransformer = {};
exports.Transformer = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.maskField !== undefined) {
            exports.MaskFieldTransformer.encode(message.maskField, writer.uint32(10).fork()).ldelim();
        }
        if (message.filterColumns !== undefined) {
            exports.FilterColumnsTransformer.encode(message.filterColumns, writer.uint32(18).fork()).ldelim();
        }
        if (message.renameTables !== undefined) {
            exports.RenameTablesTransformer.encode(message.renameTables, writer.uint32(34).fork()).ldelim();
        }
        if (message.replacePrimaryKey !== undefined) {
            exports.ReplacePrimaryKeyTransformer.encode(message.replacePrimaryKey, writer.uint32(50).fork()).ldelim();
        }
        if (message.convertToString !== undefined) {
            exports.ToStringTransformer.encode(message.convertToString, writer.uint32(58).fork()).ldelim();
        }
        if (message.sharderTransformer !== undefined) {
            exports.SharderTransformer.encode(message.sharderTransformer, writer.uint32(74).fork()).ldelim();
        }
        if (message.tableSplitterTransformer !== undefined) {
            exports.TableSplitterTransformer.encode(message.tableSplitterTransformer, writer.uint32(106).fork()).ldelim();
        }
        if (message.filterRows !== undefined) {
            exports.FilterRowsTransformer.encode(message.filterRows, writer.uint32(114).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({}, baseTransformer);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.maskField = exports.MaskFieldTransformer.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.filterColumns = exports.FilterColumnsTransformer.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.renameTables = exports.RenameTablesTransformer.decode(reader, reader.uint32());
                    break;
                case 6:
                    message.replacePrimaryKey = exports.ReplacePrimaryKeyTransformer.decode(reader, reader.uint32());
                    break;
                case 7:
                    message.convertToString = exports.ToStringTransformer.decode(reader, reader.uint32());
                    break;
                case 9:
                    message.sharderTransformer = exports.SharderTransformer.decode(reader, reader.uint32());
                    break;
                case 13:
                    message.tableSplitterTransformer = exports.TableSplitterTransformer.decode(reader, reader.uint32());
                    break;
                case 14:
                    message.filterRows = exports.FilterRowsTransformer.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTransformer);
        message.maskField =
            object.maskField !== undefined && object.maskField !== null
                ? exports.MaskFieldTransformer.fromJSON(object.maskField)
                : undefined;
        message.filterColumns =
            object.filterColumns !== undefined && object.filterColumns !== null
                ? exports.FilterColumnsTransformer.fromJSON(object.filterColumns)
                : undefined;
        message.renameTables =
            object.renameTables !== undefined && object.renameTables !== null
                ? exports.RenameTablesTransformer.fromJSON(object.renameTables)
                : undefined;
        message.replacePrimaryKey =
            object.replacePrimaryKey !== undefined && object.replacePrimaryKey !== null
                ? exports.ReplacePrimaryKeyTransformer.fromJSON(object.replacePrimaryKey)
                : undefined;
        message.convertToString =
            object.convertToString !== undefined && object.convertToString !== null
                ? exports.ToStringTransformer.fromJSON(object.convertToString)
                : undefined;
        message.sharderTransformer =
            object.sharderTransformer !== undefined && object.sharderTransformer !== null
                ? exports.SharderTransformer.fromJSON(object.sharderTransformer)
                : undefined;
        message.tableSplitterTransformer =
            object.tableSplitterTransformer !== undefined &&
                object.tableSplitterTransformer !== null
                ? exports.TableSplitterTransformer.fromJSON(object.tableSplitterTransformer)
                : undefined;
        message.filterRows =
            object.filterRows !== undefined && object.filterRows !== null
                ? exports.FilterRowsTransformer.fromJSON(object.filterRows)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.maskField !== undefined &&
            (obj.maskField = message.maskField
                ? exports.MaskFieldTransformer.toJSON(message.maskField)
                : undefined);
        message.filterColumns !== undefined &&
            (obj.filterColumns = message.filterColumns
                ? exports.FilterColumnsTransformer.toJSON(message.filterColumns)
                : undefined);
        message.renameTables !== undefined &&
            (obj.renameTables = message.renameTables
                ? exports.RenameTablesTransformer.toJSON(message.renameTables)
                : undefined);
        message.replacePrimaryKey !== undefined &&
            (obj.replacePrimaryKey = message.replacePrimaryKey
                ? exports.ReplacePrimaryKeyTransformer.toJSON(message.replacePrimaryKey)
                : undefined);
        message.convertToString !== undefined &&
            (obj.convertToString = message.convertToString
                ? exports.ToStringTransformer.toJSON(message.convertToString)
                : undefined);
        message.sharderTransformer !== undefined &&
            (obj.sharderTransformer = message.sharderTransformer
                ? exports.SharderTransformer.toJSON(message.sharderTransformer)
                : undefined);
        message.tableSplitterTransformer !== undefined &&
            (obj.tableSplitterTransformer = message.tableSplitterTransformer
                ? exports.TableSplitterTransformer.toJSON(message.tableSplitterTransformer)
                : undefined);
        message.filterRows !== undefined &&
            (obj.filterRows = message.filterRows
                ? exports.FilterRowsTransformer.toJSON(message.filterRows)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = Object.assign({}, baseTransformer);
        message.maskField =
            object.maskField !== undefined && object.maskField !== null
                ? exports.MaskFieldTransformer.fromPartial(object.maskField)
                : undefined;
        message.filterColumns =
            object.filterColumns !== undefined && object.filterColumns !== null
                ? exports.FilterColumnsTransformer.fromPartial(object.filterColumns)
                : undefined;
        message.renameTables =
            object.renameTables !== undefined && object.renameTables !== null
                ? exports.RenameTablesTransformer.fromPartial(object.renameTables)
                : undefined;
        message.replacePrimaryKey =
            object.replacePrimaryKey !== undefined && object.replacePrimaryKey !== null
                ? exports.ReplacePrimaryKeyTransformer.fromPartial(object.replacePrimaryKey)
                : undefined;
        message.convertToString =
            object.convertToString !== undefined && object.convertToString !== null
                ? exports.ToStringTransformer.fromPartial(object.convertToString)
                : undefined;
        message.sharderTransformer =
            object.sharderTransformer !== undefined && object.sharderTransformer !== null
                ? exports.SharderTransformer.fromPartial(object.sharderTransformer)
                : undefined;
        message.tableSplitterTransformer =
            object.tableSplitterTransformer !== undefined &&
                object.tableSplitterTransformer !== null
                ? exports.TableSplitterTransformer.fromPartial(object.tableSplitterTransformer)
                : undefined;
        message.filterRows =
            object.filterRows !== undefined && object.filterRows !== null
                ? exports.FilterRowsTransformer.fromPartial(object.filterRows)
                : undefined;
        return message;
    },
};
const baseTransformation = {};
exports.Transformation = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.transformers) {
            exports.Transformer.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({}, baseTransformation);
        message.transformers = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transformers.push(exports.Transformer.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseTransformation);
        message.transformers = ((_a = object.transformers) !== null && _a !== void 0 ? _a : []).map((e) => exports.Transformer.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.transformers) {
            obj.transformers = message.transformers.map((e) => e ? exports.Transformer.toJSON(e) : undefined);
        }
        else {
            obj.transformers = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseTransformation);
        message.transformers = ((_a = object.transformers) === null || _a === void 0 ? void 0 : _a.map((e) => exports.Transformer.fromPartial(e))) || [];
        return message;
    },
};
const baseDataObjects = { includeObjects: '' };
exports.DataObjects = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.includeObjects) {
            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({}, baseDataObjects);
        message.includeObjects = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.includeObjects.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseDataObjects);
        message.includeObjects = ((_a = object.includeObjects) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.includeObjects) {
            obj.includeObjects = message.includeObjects.map((e) => e);
        }
        else {
            obj.includeObjects = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseDataObjects);
        message.includeObjects = ((_a = object.includeObjects) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
        return message;
    },
};
var globalThis = (() => {
    if (typeof globalThis !== 'undefined')
        return globalThis;
    if (typeof self !== 'undefined')
        return self;
    if (typeof window !== 'undefined')
        return window;
    if (typeof global !== 'undefined')
        return global;
    throw 'Unable to locate global object';
})();
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
    }
    return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
