"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SparkParameters = exports.JobProgress = exports.JobMetadata = exports.GracefulShutdownParameters = exports.JobResult = exports.Job = exports.OutputDataset = exports.OutputDatasetDesc_LabelsEntry = exports.OutputDatasetDesc = exports.PipOptions = exports.PythonEnv = exports.DockerImageSpec = exports.Environment_VarsEntry = exports.Environment = exports.FileUploadError = exports.FileDesc = exports.StorageFile = exports.File = exports.Argument = exports.ExtendedWorkingStorage = exports.CloudInstanceType = exports.JobParameters = exports.fileUploadError_ErrorTypeToJSON = exports.fileUploadError_ErrorTypeFromJSON = exports.FileUploadError_ErrorType = exports.extendedWorkingStorage_StorageTypeToJSON = exports.extendedWorkingStorage_StorageTypeFromJSON = exports.ExtendedWorkingStorage_StorageType = exports.jobStatusToJSON = exports.jobStatusFromJSON = exports.JobStatus = exports.fileCompressionTypeToJSON = exports.fileCompressionTypeFromJSON = exports.FileCompressionType = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const duration_1 = require("../../../../../google/protobuf/duration");
const timestamp_1 = require("../../../../../google/protobuf/timestamp");
exports.protobufPackage = 'yandex.cloud.datasphere.v2.jobs';
var FileCompressionType;
(function (FileCompressionType) {
    FileCompressionType[FileCompressionType["FILE_COMPRESSION_TYPE_UNSPECIFIED"] = 0] = "FILE_COMPRESSION_TYPE_UNSPECIFIED";
    FileCompressionType[FileCompressionType["NONE"] = 1] = "NONE";
    FileCompressionType[FileCompressionType["ZIP"] = 2] = "ZIP";
    FileCompressionType[FileCompressionType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(FileCompressionType = exports.FileCompressionType || (exports.FileCompressionType = {}));
function fileCompressionTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'FILE_COMPRESSION_TYPE_UNSPECIFIED':
            return FileCompressionType.FILE_COMPRESSION_TYPE_UNSPECIFIED;
        case 1:
        case 'NONE':
            return FileCompressionType.NONE;
        case 2:
        case 'ZIP':
            return FileCompressionType.ZIP;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return FileCompressionType.UNRECOGNIZED;
    }
}
exports.fileCompressionTypeFromJSON = fileCompressionTypeFromJSON;
function fileCompressionTypeToJSON(object) {
    switch (object) {
        case FileCompressionType.FILE_COMPRESSION_TYPE_UNSPECIFIED:
            return 'FILE_COMPRESSION_TYPE_UNSPECIFIED';
        case FileCompressionType.NONE:
            return 'NONE';
        case FileCompressionType.ZIP:
            return 'ZIP';
        default:
            return 'UNKNOWN';
    }
}
exports.fileCompressionTypeToJSON = fileCompressionTypeToJSON;
var JobStatus;
(function (JobStatus) {
    JobStatus[JobStatus["JOB_STATUS_UNSPECIFIED"] = 0] = "JOB_STATUS_UNSPECIFIED";
    JobStatus[JobStatus["CREATING"] = 1] = "CREATING";
    JobStatus[JobStatus["EXECUTING"] = 2] = "EXECUTING";
    JobStatus[JobStatus["UPLOADING_OUTPUT"] = 3] = "UPLOADING_OUTPUT";
    JobStatus[JobStatus["SUCCESS"] = 4] = "SUCCESS";
    JobStatus[JobStatus["ERROR"] = 5] = "ERROR";
    JobStatus[JobStatus["CANCELLED"] = 6] = "CANCELLED";
    JobStatus[JobStatus["CANCELLING"] = 7] = "CANCELLING";
    JobStatus[JobStatus["PREPARING"] = 8] = "PREPARING";
    JobStatus[JobStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(JobStatus = exports.JobStatus || (exports.JobStatus = {}));
function jobStatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'JOB_STATUS_UNSPECIFIED':
            return JobStatus.JOB_STATUS_UNSPECIFIED;
        case 1:
        case 'CREATING':
            return JobStatus.CREATING;
        case 2:
        case 'EXECUTING':
            return JobStatus.EXECUTING;
        case 3:
        case 'UPLOADING_OUTPUT':
            return JobStatus.UPLOADING_OUTPUT;
        case 4:
        case 'SUCCESS':
            return JobStatus.SUCCESS;
        case 5:
        case 'ERROR':
            return JobStatus.ERROR;
        case 6:
        case 'CANCELLED':
            return JobStatus.CANCELLED;
        case 7:
        case 'CANCELLING':
            return JobStatus.CANCELLING;
        case 8:
        case 'PREPARING':
            return JobStatus.PREPARING;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return JobStatus.UNRECOGNIZED;
    }
}
exports.jobStatusFromJSON = jobStatusFromJSON;
function jobStatusToJSON(object) {
    switch (object) {
        case JobStatus.JOB_STATUS_UNSPECIFIED:
            return 'JOB_STATUS_UNSPECIFIED';
        case JobStatus.CREATING:
            return 'CREATING';
        case JobStatus.EXECUTING:
            return 'EXECUTING';
        case JobStatus.UPLOADING_OUTPUT:
            return 'UPLOADING_OUTPUT';
        case JobStatus.SUCCESS:
            return 'SUCCESS';
        case JobStatus.ERROR:
            return 'ERROR';
        case JobStatus.CANCELLED:
            return 'CANCELLED';
        case JobStatus.CANCELLING:
            return 'CANCELLING';
        case JobStatus.PREPARING:
            return 'PREPARING';
        default:
            return 'UNKNOWN';
    }
}
exports.jobStatusToJSON = jobStatusToJSON;
var ExtendedWorkingStorage_StorageType;
(function (ExtendedWorkingStorage_StorageType) {
    ExtendedWorkingStorage_StorageType[ExtendedWorkingStorage_StorageType["STORAGE_TYPE_UNSPECIFIED"] = 0] = "STORAGE_TYPE_UNSPECIFIED";
    ExtendedWorkingStorage_StorageType[ExtendedWorkingStorage_StorageType["SSD"] = 1] = "SSD";
    ExtendedWorkingStorage_StorageType[ExtendedWorkingStorage_StorageType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ExtendedWorkingStorage_StorageType = exports.ExtendedWorkingStorage_StorageType || (exports.ExtendedWorkingStorage_StorageType = {}));
function extendedWorkingStorage_StorageTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'STORAGE_TYPE_UNSPECIFIED':
            return ExtendedWorkingStorage_StorageType.STORAGE_TYPE_UNSPECIFIED;
        case 1:
        case 'SSD':
            return ExtendedWorkingStorage_StorageType.SSD;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return ExtendedWorkingStorage_StorageType.UNRECOGNIZED;
    }
}
exports.extendedWorkingStorage_StorageTypeFromJSON = extendedWorkingStorage_StorageTypeFromJSON;
function extendedWorkingStorage_StorageTypeToJSON(object) {
    switch (object) {
        case ExtendedWorkingStorage_StorageType.STORAGE_TYPE_UNSPECIFIED:
            return 'STORAGE_TYPE_UNSPECIFIED';
        case ExtendedWorkingStorage_StorageType.SSD:
            return 'SSD';
        default:
            return 'UNKNOWN';
    }
}
exports.extendedWorkingStorage_StorageTypeToJSON = extendedWorkingStorage_StorageTypeToJSON;
var FileUploadError_ErrorType;
(function (FileUploadError_ErrorType) {
    FileUploadError_ErrorType[FileUploadError_ErrorType["ERROR_TYPE_UNSPECIFIED"] = 0] = "ERROR_TYPE_UNSPECIFIED";
    FileUploadError_ErrorType[FileUploadError_ErrorType["UPLOAD_FAILED"] = 1] = "UPLOAD_FAILED";
    FileUploadError_ErrorType[FileUploadError_ErrorType["NOT_FOUND"] = 2] = "NOT_FOUND";
    FileUploadError_ErrorType[FileUploadError_ErrorType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(FileUploadError_ErrorType = exports.FileUploadError_ErrorType || (exports.FileUploadError_ErrorType = {}));
function fileUploadError_ErrorTypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'ERROR_TYPE_UNSPECIFIED':
            return FileUploadError_ErrorType.ERROR_TYPE_UNSPECIFIED;
        case 1:
        case 'UPLOAD_FAILED':
            return FileUploadError_ErrorType.UPLOAD_FAILED;
        case 2:
        case 'NOT_FOUND':
            return FileUploadError_ErrorType.NOT_FOUND;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return FileUploadError_ErrorType.UNRECOGNIZED;
    }
}
exports.fileUploadError_ErrorTypeFromJSON = fileUploadError_ErrorTypeFromJSON;
function fileUploadError_ErrorTypeToJSON(object) {
    switch (object) {
        case FileUploadError_ErrorType.ERROR_TYPE_UNSPECIFIED:
            return 'ERROR_TYPE_UNSPECIFIED';
        case FileUploadError_ErrorType.UPLOAD_FAILED:
            return 'UPLOAD_FAILED';
        case FileUploadError_ErrorType.NOT_FOUND:
            return 'NOT_FOUND';
        default:
            return 'UNKNOWN';
    }
}
exports.fileUploadError_ErrorTypeToJSON = fileUploadError_ErrorTypeToJSON;
const baseJobParameters = {
    s3MountIds: '',
    datasetIds: '',
    cmd: '',
    attachProjectDisk: false,
};
exports.JobParameters = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.inputFiles) {
            exports.File.encode(v, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.outputFiles) {
            exports.FileDesc.encode(v, writer.uint32(18).fork()).ldelim();
        }
        for (const v of message.s3MountIds) {
            writer.uint32(26).string(v);
        }
        for (const v of message.datasetIds) {
            writer.uint32(34).string(v);
        }
        if (message.cmd !== '') {
            writer.uint32(42).string(message.cmd);
        }
        if (message.env !== undefined) {
            exports.Environment.encode(message.env, writer.uint32(50).fork()).ldelim();
        }
        if (message.attachProjectDisk === true) {
            writer.uint32(56).bool(message.attachProjectDisk);
        }
        for (const v of message.cloudInstanceTypes) {
            exports.CloudInstanceType.encode(v, writer.uint32(66).fork()).ldelim();
        }
        if (message.extendedWorkingStorage !== undefined) {
            exports.ExtendedWorkingStorage.encode(message.extendedWorkingStorage, writer.uint32(74).fork()).ldelim();
        }
        for (const v of message.arguments) {
            exports.Argument.encode(v, writer.uint32(82).fork()).ldelim();
        }
        for (const v of message.outputDatasets) {
            exports.OutputDatasetDesc.encode(v, writer.uint32(90).fork()).ldelim();
        }
        if (message.gracefulShutdownParameters !== undefined) {
            exports.GracefulShutdownParameters.encode(message.gracefulShutdownParameters, writer.uint32(98).fork()).ldelim();
        }
        if (message.sparkParameters !== undefined) {
            exports.SparkParameters.encode(message.sparkParameters, writer.uint32(106).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({}, baseJobParameters);
        message.inputFiles = [];
        message.outputFiles = [];
        message.s3MountIds = [];
        message.datasetIds = [];
        message.cloudInstanceTypes = [];
        message.arguments = [];
        message.outputDatasets = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.inputFiles.push(exports.File.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.outputFiles.push(exports.FileDesc.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.s3MountIds.push(reader.string());
                    break;
                case 4:
                    message.datasetIds.push(reader.string());
                    break;
                case 5:
                    message.cmd = reader.string();
                    break;
                case 6:
                    message.env = exports.Environment.decode(reader, reader.uint32());
                    break;
                case 7:
                    message.attachProjectDisk = reader.bool();
                    break;
                case 8:
                    message.cloudInstanceTypes.push(exports.CloudInstanceType.decode(reader, reader.uint32()));
                    break;
                case 9:
                    message.extendedWorkingStorage = exports.ExtendedWorkingStorage.decode(reader, reader.uint32());
                    break;
                case 10:
                    message.arguments.push(exports.Argument.decode(reader, reader.uint32()));
                    break;
                case 11:
                    message.outputDatasets.push(exports.OutputDatasetDesc.decode(reader, reader.uint32()));
                    break;
                case 12:
                    message.gracefulShutdownParameters = exports.GracefulShutdownParameters.decode(reader, reader.uint32());
                    break;
                case 13:
                    message.sparkParameters = exports.SparkParameters.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b, _c, _d, _e, _f, _g;
        const message = Object.assign({}, baseJobParameters);
        message.inputFiles = ((_a = object.inputFiles) !== null && _a !== void 0 ? _a : []).map((e) => exports.File.fromJSON(e));
        message.outputFiles = ((_b = object.outputFiles) !== null && _b !== void 0 ? _b : []).map((e) => exports.FileDesc.fromJSON(e));
        message.s3MountIds = ((_c = object.s3MountIds) !== null && _c !== void 0 ? _c : []).map((e) => String(e));
        message.datasetIds = ((_d = object.datasetIds) !== null && _d !== void 0 ? _d : []).map((e) => String(e));
        message.cmd = object.cmd !== undefined && object.cmd !== null ? String(object.cmd) : '';
        message.env =
            object.env !== undefined && object.env !== null
                ? exports.Environment.fromJSON(object.env)
                : undefined;
        message.attachProjectDisk =
            object.attachProjectDisk !== undefined && object.attachProjectDisk !== null
                ? Boolean(object.attachProjectDisk)
                : false;
        message.cloudInstanceTypes = ((_e = object.cloudInstanceTypes) !== null && _e !== void 0 ? _e : []).map((e) => exports.CloudInstanceType.fromJSON(e));
        message.extendedWorkingStorage =
            object.extendedWorkingStorage !== undefined && object.extendedWorkingStorage !== null
                ? exports.ExtendedWorkingStorage.fromJSON(object.extendedWorkingStorage)
                : undefined;
        message.arguments = ((_f = object.arguments) !== null && _f !== void 0 ? _f : []).map((e) => exports.Argument.fromJSON(e));
        message.outputDatasets = ((_g = object.outputDatasets) !== null && _g !== void 0 ? _g : []).map((e) => exports.OutputDatasetDesc.fromJSON(e));
        message.gracefulShutdownParameters =
            object.gracefulShutdownParameters !== undefined &&
                object.gracefulShutdownParameters !== null
                ? exports.GracefulShutdownParameters.fromJSON(object.gracefulShutdownParameters)
                : undefined;
        message.sparkParameters =
            object.sparkParameters !== undefined && object.sparkParameters !== null
                ? exports.SparkParameters.fromJSON(object.sparkParameters)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.inputFiles) {
            obj.inputFiles = message.inputFiles.map((e) => (e ? exports.File.toJSON(e) : undefined));
        }
        else {
            obj.inputFiles = [];
        }
        if (message.outputFiles) {
            obj.outputFiles = message.outputFiles.map((e) => (e ? exports.FileDesc.toJSON(e) : undefined));
        }
        else {
            obj.outputFiles = [];
        }
        if (message.s3MountIds) {
            obj.s3MountIds = message.s3MountIds.map((e) => e);
        }
        else {
            obj.s3MountIds = [];
        }
        if (message.datasetIds) {
            obj.datasetIds = message.datasetIds.map((e) => e);
        }
        else {
            obj.datasetIds = [];
        }
        message.cmd !== undefined && (obj.cmd = message.cmd);
        message.env !== undefined &&
            (obj.env = message.env ? exports.Environment.toJSON(message.env) : undefined);
        message.attachProjectDisk !== undefined &&
            (obj.attachProjectDisk = message.attachProjectDisk);
        if (message.cloudInstanceTypes) {
            obj.cloudInstanceTypes = message.cloudInstanceTypes.map((e) => e ? exports.CloudInstanceType.toJSON(e) : undefined);
        }
        else {
            obj.cloudInstanceTypes = [];
        }
        message.extendedWorkingStorage !== undefined &&
            (obj.extendedWorkingStorage = message.extendedWorkingStorage
                ? exports.ExtendedWorkingStorage.toJSON(message.extendedWorkingStorage)
                : undefined);
        if (message.arguments) {
            obj.arguments = message.arguments.map((e) => (e ? exports.Argument.toJSON(e) : undefined));
        }
        else {
            obj.arguments = [];
        }
        if (message.outputDatasets) {
            obj.outputDatasets = message.outputDatasets.map((e) => e ? exports.OutputDatasetDesc.toJSON(e) : undefined);
        }
        else {
            obj.outputDatasets = [];
        }
        message.gracefulShutdownParameters !== undefined &&
            (obj.gracefulShutdownParameters = message.gracefulShutdownParameters
                ? exports.GracefulShutdownParameters.toJSON(message.gracefulShutdownParameters)
                : undefined);
        message.sparkParameters !== undefined &&
            (obj.sparkParameters = message.sparkParameters
                ? exports.SparkParameters.toJSON(message.sparkParameters)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j;
        const message = Object.assign({}, baseJobParameters);
        message.inputFiles = ((_a = object.inputFiles) === null || _a === void 0 ? void 0 : _a.map((e) => exports.File.fromPartial(e))) || [];
        message.outputFiles = ((_b = object.outputFiles) === null || _b === void 0 ? void 0 : _b.map((e) => exports.FileDesc.fromPartial(e))) || [];
        message.s3MountIds = ((_c = object.s3MountIds) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
        message.datasetIds = ((_d = object.datasetIds) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
        message.cmd = (_e = object.cmd) !== null && _e !== void 0 ? _e : '';
        message.env =
            object.env !== undefined && object.env !== null
                ? exports.Environment.fromPartial(object.env)
                : undefined;
        message.attachProjectDisk = (_f = object.attachProjectDisk) !== null && _f !== void 0 ? _f : false;
        message.cloudInstanceTypes =
            ((_g = object.cloudInstanceTypes) === null || _g === void 0 ? void 0 : _g.map((e) => exports.CloudInstanceType.fromPartial(e))) || [];
        message.extendedWorkingStorage =
            object.extendedWorkingStorage !== undefined && object.extendedWorkingStorage !== null
                ? exports.ExtendedWorkingStorage.fromPartial(object.extendedWorkingStorage)
                : undefined;
        message.arguments = ((_h = object.arguments) === null || _h === void 0 ? void 0 : _h.map((e) => exports.Argument.fromPartial(e))) || [];
        message.outputDatasets =
            ((_j = object.outputDatasets) === null || _j === void 0 ? void 0 : _j.map((e) => exports.OutputDatasetDesc.fromPartial(e))) || [];
        message.gracefulShutdownParameters =
            object.gracefulShutdownParameters !== undefined &&
                object.gracefulShutdownParameters !== null
                ? exports.GracefulShutdownParameters.fromPartial(object.gracefulShutdownParameters)
                : undefined;
        message.sparkParameters =
            object.sparkParameters !== undefined && object.sparkParameters !== null
                ? exports.SparkParameters.fromPartial(object.sparkParameters)
                : undefined;
        return message;
    },
};
const baseCloudInstanceType = { name: '' };
exports.CloudInstanceType = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).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({}, baseCloudInstanceType);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseCloudInstanceType);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseCloudInstanceType);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseExtendedWorkingStorage = { type: 0, sizeGb: 0 };
exports.ExtendedWorkingStorage = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.type !== 0) {
            writer.uint32(8).int32(message.type);
        }
        if (message.sizeGb !== 0) {
            writer.uint32(16).int64(message.sizeGb);
        }
        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({}, baseExtendedWorkingStorage);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.type = reader.int32();
                    break;
                case 2:
                    message.sizeGb = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseExtendedWorkingStorage);
        message.type =
            object.type !== undefined && object.type !== null
                ? extendedWorkingStorage_StorageTypeFromJSON(object.type)
                : 0;
        message.sizeGb =
            object.sizeGb !== undefined && object.sizeGb !== null ? Number(object.sizeGb) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.type !== undefined &&
            (obj.type = extendedWorkingStorage_StorageTypeToJSON(message.type));
        message.sizeGb !== undefined && (obj.sizeGb = Math.round(message.sizeGb));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseExtendedWorkingStorage);
        message.type = (_a = object.type) !== null && _a !== void 0 ? _a : 0;
        message.sizeGb = (_b = object.sizeGb) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseArgument = { name: '', value: '' };
exports.Argument = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        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({}, baseArgument);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseArgument);
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.name !== undefined && (obj.name = message.name);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseArgument);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseFile = { sha256: '', sizeBytes: 0, compressionType: 0 };
exports.File = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.desc !== undefined) {
            exports.FileDesc.encode(message.desc, writer.uint32(10).fork()).ldelim();
        }
        if (message.sha256 !== '') {
            writer.uint32(18).string(message.sha256);
        }
        if (message.sizeBytes !== 0) {
            writer.uint32(24).int64(message.sizeBytes);
        }
        if (message.compressionType !== 0) {
            writer.uint32(32).int32(message.compressionType);
        }
        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({}, baseFile);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.desc = exports.FileDesc.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.sha256 = reader.string();
                    break;
                case 3:
                    message.sizeBytes = longToNumber(reader.int64());
                    break;
                case 4:
                    message.compressionType = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFile);
        message.desc =
            object.desc !== undefined && object.desc !== null
                ? exports.FileDesc.fromJSON(object.desc)
                : undefined;
        message.sha256 =
            object.sha256 !== undefined && object.sha256 !== null ? String(object.sha256) : '';
        message.sizeBytes =
            object.sizeBytes !== undefined && object.sizeBytes !== null
                ? Number(object.sizeBytes)
                : 0;
        message.compressionType =
            object.compressionType !== undefined && object.compressionType !== null
                ? fileCompressionTypeFromJSON(object.compressionType)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.desc !== undefined &&
            (obj.desc = message.desc ? exports.FileDesc.toJSON(message.desc) : undefined);
        message.sha256 !== undefined && (obj.sha256 = message.sha256);
        message.sizeBytes !== undefined && (obj.sizeBytes = Math.round(message.sizeBytes));
        message.compressionType !== undefined &&
            (obj.compressionType = fileCompressionTypeToJSON(message.compressionType));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseFile);
        message.desc =
            object.desc !== undefined && object.desc !== null
                ? exports.FileDesc.fromPartial(object.desc)
                : undefined;
        message.sha256 = (_a = object.sha256) !== null && _a !== void 0 ? _a : '';
        message.sizeBytes = (_b = object.sizeBytes) !== null && _b !== void 0 ? _b : 0;
        message.compressionType = (_c = object.compressionType) !== null && _c !== void 0 ? _c : 0;
        return message;
    },
};
const baseStorageFile = { url: '' };
exports.StorageFile = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.file !== undefined) {
            exports.File.encode(message.file, writer.uint32(10).fork()).ldelim();
        }
        if (message.url !== '') {
            writer.uint32(18).string(message.url);
        }
        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({}, baseStorageFile);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.file = exports.File.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.url = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseStorageFile);
        message.file =
            object.file !== undefined && object.file !== null
                ? exports.File.fromJSON(object.file)
                : undefined;
        message.url = object.url !== undefined && object.url !== null ? String(object.url) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.file !== undefined &&
            (obj.file = message.file ? exports.File.toJSON(message.file) : undefined);
        message.url !== undefined && (obj.url = message.url);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseStorageFile);
        message.file =
            object.file !== undefined && object.file !== null
                ? exports.File.fromPartial(object.file)
                : undefined;
        message.url = (_a = object.url) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseFileDesc = { path: '', var: '' };
exports.FileDesc = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.path !== '') {
            writer.uint32(10).string(message.path);
        }
        if (message.var !== '') {
            writer.uint32(18).string(message.var);
        }
        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({}, baseFileDesc);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.path = reader.string();
                    break;
                case 2:
                    message.var = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFileDesc);
        message.path = object.path !== undefined && object.path !== null ? String(object.path) : '';
        message.var = object.var !== undefined && object.var !== null ? String(object.var) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.path !== undefined && (obj.path = message.path);
        message.var !== undefined && (obj.var = message.var);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseFileDesc);
        message.path = (_a = object.path) !== null && _a !== void 0 ? _a : '';
        message.var = (_b = object.var) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseFileUploadError = { description: '', type: 0 };
exports.FileUploadError = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.outputFileDesc !== undefined) {
            exports.FileDesc.encode(message.outputFileDesc, writer.uint32(10).fork()).ldelim();
        }
        if (message.logFileName !== undefined) {
            writer.uint32(18).string(message.logFileName);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.type !== 0) {
            writer.uint32(32).int32(message.type);
        }
        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({}, baseFileUploadError);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.outputFileDesc = exports.FileDesc.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.logFileName = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    message.type = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseFileUploadError);
        message.outputFileDesc =
            object.outputFileDesc !== undefined && object.outputFileDesc !== null
                ? exports.FileDesc.fromJSON(object.outputFileDesc)
                : undefined;
        message.logFileName =
            object.logFileName !== undefined && object.logFileName !== null
                ? String(object.logFileName)
                : undefined;
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.type =
            object.type !== undefined && object.type !== null
                ? fileUploadError_ErrorTypeFromJSON(object.type)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.outputFileDesc !== undefined &&
            (obj.outputFileDesc = message.outputFileDesc
                ? exports.FileDesc.toJSON(message.outputFileDesc)
                : undefined);
        message.logFileName !== undefined && (obj.logFileName = message.logFileName);
        message.description !== undefined && (obj.description = message.description);
        message.type !== undefined && (obj.type = fileUploadError_ErrorTypeToJSON(message.type));
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseFileUploadError);
        message.outputFileDesc =
            object.outputFileDesc !== undefined && object.outputFileDesc !== null
                ? exports.FileDesc.fromPartial(object.outputFileDesc)
                : undefined;
        message.logFileName = (_a = object.logFileName) !== null && _a !== void 0 ? _a : undefined;
        message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
        message.type = (_c = object.type) !== null && _c !== void 0 ? _c : 0;
        return message;
    },
};
const baseEnvironment = {};
exports.Environment = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        Object.entries(message.vars).forEach(([key, value]) => {
            exports.Environment_VarsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim();
        });
        if (message.dockerImageResourceId !== undefined) {
            writer.uint32(18).string(message.dockerImageResourceId);
        }
        if (message.dockerImageSpec !== undefined) {
            exports.DockerImageSpec.encode(message.dockerImageSpec, writer.uint32(26).fork()).ldelim();
        }
        if (message.pythonEnv !== undefined) {
            exports.PythonEnv.encode(message.pythonEnv, 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({}, baseEnvironment);
        message.vars = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    const entry1 = exports.Environment_VarsEntry.decode(reader, reader.uint32());
                    if (entry1.value !== undefined) {
                        message.vars[entry1.key] = entry1.value;
                    }
                    break;
                case 2:
                    message.dockerImageResourceId = reader.string();
                    break;
                case 3:
                    message.dockerImageSpec = exports.DockerImageSpec.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.pythonEnv = exports.PythonEnv.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseEnvironment);
        message.vars = Object.entries((_a = object.vars) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.dockerImageResourceId =
            object.dockerImageResourceId !== undefined && object.dockerImageResourceId !== null
                ? String(object.dockerImageResourceId)
                : undefined;
        message.dockerImageSpec =
            object.dockerImageSpec !== undefined && object.dockerImageSpec !== null
                ? exports.DockerImageSpec.fromJSON(object.dockerImageSpec)
                : undefined;
        message.pythonEnv =
            object.pythonEnv !== undefined && object.pythonEnv !== null
                ? exports.PythonEnv.fromJSON(object.pythonEnv)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        obj.vars = {};
        if (message.vars) {
            Object.entries(message.vars).forEach(([k, v]) => {
                obj.vars[k] = v;
            });
        }
        message.dockerImageResourceId !== undefined &&
            (obj.dockerImageResourceId = message.dockerImageResourceId);
        message.dockerImageSpec !== undefined &&
            (obj.dockerImageSpec = message.dockerImageSpec
                ? exports.DockerImageSpec.toJSON(message.dockerImageSpec)
                : undefined);
        message.pythonEnv !== undefined &&
            (obj.pythonEnv = message.pythonEnv ? exports.PythonEnv.toJSON(message.pythonEnv) : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseEnvironment);
        message.vars = Object.entries((_a = object.vars) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.dockerImageResourceId = (_b = object.dockerImageResourceId) !== null && _b !== void 0 ? _b : undefined;
        message.dockerImageSpec =
            object.dockerImageSpec !== undefined && object.dockerImageSpec !== null
                ? exports.DockerImageSpec.fromPartial(object.dockerImageSpec)
                : undefined;
        message.pythonEnv =
            object.pythonEnv !== undefined && object.pythonEnv !== null
                ? exports.PythonEnv.fromPartial(object.pythonEnv)
                : undefined;
        return message;
    },
};
const baseEnvironment_VarsEntry = { key: '', value: '' };
exports.Environment_VarsEntry = {
    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({}, baseEnvironment_VarsEntry);
        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({}, baseEnvironment_VarsEntry);
        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({}, baseEnvironment_VarsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseDockerImageSpec = { imageUrl: '', username: '' };
exports.DockerImageSpec = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.imageUrl !== '') {
            writer.uint32(10).string(message.imageUrl);
        }
        if (message.username !== '') {
            writer.uint32(18).string(message.username);
        }
        if (message.passwordPlainText !== undefined) {
            writer.uint32(26).string(message.passwordPlainText);
        }
        if (message.passwordDsSecretName !== undefined) {
            writer.uint32(34).string(message.passwordDsSecretName);
        }
        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({}, baseDockerImageSpec);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.imageUrl = reader.string();
                    break;
                case 2:
                    message.username = reader.string();
                    break;
                case 3:
                    message.passwordPlainText = reader.string();
                    break;
                case 4:
                    message.passwordDsSecretName = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDockerImageSpec);
        message.imageUrl =
            object.imageUrl !== undefined && object.imageUrl !== null
                ? String(object.imageUrl)
                : '';
        message.username =
            object.username !== undefined && object.username !== null
                ? String(object.username)
                : '';
        message.passwordPlainText =
            object.passwordPlainText !== undefined && object.passwordPlainText !== null
                ? String(object.passwordPlainText)
                : undefined;
        message.passwordDsSecretName =
            object.passwordDsSecretName !== undefined && object.passwordDsSecretName !== null
                ? String(object.passwordDsSecretName)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.imageUrl !== undefined && (obj.imageUrl = message.imageUrl);
        message.username !== undefined && (obj.username = message.username);
        message.passwordPlainText !== undefined &&
            (obj.passwordPlainText = message.passwordPlainText);
        message.passwordDsSecretName !== undefined &&
            (obj.passwordDsSecretName = message.passwordDsSecretName);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseDockerImageSpec);
        message.imageUrl = (_a = object.imageUrl) !== null && _a !== void 0 ? _a : '';
        message.username = (_b = object.username) !== null && _b !== void 0 ? _b : '';
        message.passwordPlainText = (_c = object.passwordPlainText) !== null && _c !== void 0 ? _c : undefined;
        message.passwordDsSecretName = (_d = object.passwordDsSecretName) !== null && _d !== void 0 ? _d : undefined;
        return message;
    },
};
const basePythonEnv = { condaYaml: '', pythonVersion: '', requirements: '' };
exports.PythonEnv = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.condaYaml !== '') {
            writer.uint32(10).string(message.condaYaml);
        }
        for (const v of message.localModules) {
            exports.File.encode(v, writer.uint32(18).fork()).ldelim();
        }
        if (message.pythonVersion !== '') {
            writer.uint32(26).string(message.pythonVersion);
        }
        for (const v of message.requirements) {
            writer.uint32(34).string(v);
        }
        if (message.pipOptions !== undefined) {
            exports.PipOptions.encode(message.pipOptions, writer.uint32(42).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, basePythonEnv);
        message.localModules = [];
        message.requirements = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.condaYaml = reader.string();
                    break;
                case 2:
                    message.localModules.push(exports.File.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.pythonVersion = reader.string();
                    break;
                case 4:
                    message.requirements.push(reader.string());
                    break;
                case 5:
                    message.pipOptions = exports.PipOptions.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, basePythonEnv);
        message.condaYaml =
            object.condaYaml !== undefined && object.condaYaml !== null
                ? String(object.condaYaml)
                : '';
        message.localModules = ((_a = object.localModules) !== null && _a !== void 0 ? _a : []).map((e) => exports.File.fromJSON(e));
        message.pythonVersion =
            object.pythonVersion !== undefined && object.pythonVersion !== null
                ? String(object.pythonVersion)
                : '';
        message.requirements = ((_b = object.requirements) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
        message.pipOptions =
            object.pipOptions !== undefined && object.pipOptions !== null
                ? exports.PipOptions.fromJSON(object.pipOptions)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.condaYaml !== undefined && (obj.condaYaml = message.condaYaml);
        if (message.localModules) {
            obj.localModules = message.localModules.map((e) => (e ? exports.File.toJSON(e) : undefined));
        }
        else {
            obj.localModules = [];
        }
        message.pythonVersion !== undefined && (obj.pythonVersion = message.pythonVersion);
        if (message.requirements) {
            obj.requirements = message.requirements.map((e) => e);
        }
        else {
            obj.requirements = [];
        }
        message.pipOptions !== undefined &&
            (obj.pipOptions = message.pipOptions
                ? exports.PipOptions.toJSON(message.pipOptions)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, basePythonEnv);
        message.condaYaml = (_a = object.condaYaml) !== null && _a !== void 0 ? _a : '';
        message.localModules = ((_b = object.localModules) === null || _b === void 0 ? void 0 : _b.map((e) => exports.File.fromPartial(e))) || [];
        message.pythonVersion = (_c = object.pythonVersion) !== null && _c !== void 0 ? _c : '';
        message.requirements = ((_d = object.requirements) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
        message.pipOptions =
            object.pipOptions !== undefined && object.pipOptions !== null
                ? exports.PipOptions.fromPartial(object.pipOptions)
                : undefined;
        return message;
    },
};
const basePipOptions = {
    indexUrl: '',
    extraIndexUrls: '',
    trustedHosts: '',
    noDeps: false,
};
exports.PipOptions = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.indexUrl !== '') {
            writer.uint32(10).string(message.indexUrl);
        }
        for (const v of message.extraIndexUrls) {
            writer.uint32(18).string(v);
        }
        for (const v of message.trustedHosts) {
            writer.uint32(26).string(v);
        }
        if (message.noDeps === true) {
            writer.uint32(32).bool(message.noDeps);
        }
        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({}, basePipOptions);
        message.extraIndexUrls = [];
        message.trustedHosts = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.indexUrl = reader.string();
                    break;
                case 2:
                    message.extraIndexUrls.push(reader.string());
                    break;
                case 3:
                    message.trustedHosts.push(reader.string());
                    break;
                case 4:
                    message.noDeps = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, basePipOptions);
        message.indexUrl =
            object.indexUrl !== undefined && object.indexUrl !== null
                ? String(object.indexUrl)
                : '';
        message.extraIndexUrls = ((_a = object.extraIndexUrls) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        message.trustedHosts = ((_b = object.trustedHosts) !== null && _b !== void 0 ? _b : []).map((e) => String(e));
        message.noDeps =
            object.noDeps !== undefined && object.noDeps !== null ? Boolean(object.noDeps) : false;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.indexUrl !== undefined && (obj.indexUrl = message.indexUrl);
        if (message.extraIndexUrls) {
            obj.extraIndexUrls = message.extraIndexUrls.map((e) => e);
        }
        else {
            obj.extraIndexUrls = [];
        }
        if (message.trustedHosts) {
            obj.trustedHosts = message.trustedHosts.map((e) => e);
        }
        else {
            obj.trustedHosts = [];
        }
        message.noDeps !== undefined && (obj.noDeps = message.noDeps);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, basePipOptions);
        message.indexUrl = (_a = object.indexUrl) !== null && _a !== void 0 ? _a : '';
        message.extraIndexUrls = ((_b = object.extraIndexUrls) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        message.trustedHosts = ((_c = object.trustedHosts) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
        message.noDeps = (_d = object.noDeps) !== null && _d !== void 0 ? _d : false;
        return message;
    },
};
const baseOutputDatasetDesc = { name: '', description: '', sizeGb: 0, var: '' };
exports.OutputDatasetDesc = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.name !== '') {
            writer.uint32(10).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(18).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.OutputDatasetDesc_LabelsEntry.encode({ key: key, value }, writer.uint32(26).fork()).ldelim();
        });
        if (message.sizeGb !== 0) {
            writer.uint32(32).int64(message.sizeGb);
        }
        if (message.var !== '') {
            writer.uint32(42).string(message.var);
        }
        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({}, baseOutputDatasetDesc);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.description = reader.string();
                    break;
                case 3:
                    const entry3 = exports.OutputDatasetDesc_LabelsEntry.decode(reader, reader.uint32());
                    if (entry3.value !== undefined) {
                        message.labels[entry3.key] = entry3.value;
                    }
                    break;
                case 4:
                    message.sizeGb = longToNumber(reader.int64());
                    break;
                case 5:
                    message.var = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseOutputDatasetDesc);
        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.sizeGb =
            object.sizeGb !== undefined && object.sizeGb !== null ? Number(object.sizeGb) : 0;
        message.var = object.var !== undefined && object.var !== null ? String(object.var) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        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.sizeGb !== undefined && (obj.sizeGb = Math.round(message.sizeGb));
        message.var !== undefined && (obj.var = message.var);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e;
        const message = Object.assign({}, baseOutputDatasetDesc);
        message.name = (_a = object.name) !== null && _a !== void 0 ? _a : '';
        message.description = (_b = object.description) !== null && _b !== void 0 ? _b : '';
        message.labels = Object.entries((_c = object.labels) !== null && _c !== void 0 ? _c : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.sizeGb = (_d = object.sizeGb) !== null && _d !== void 0 ? _d : 0;
        message.var = (_e = object.var) !== null && _e !== void 0 ? _e : '';
        return message;
    },
};
const baseOutputDatasetDesc_LabelsEntry = { key: '', value: '' };
exports.OutputDatasetDesc_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({}, baseOutputDatasetDesc_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({}, baseOutputDatasetDesc_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({}, baseOutputDatasetDesc_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseOutputDataset = { id: '' };
exports.OutputDataset = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.desc !== undefined) {
            exports.OutputDatasetDesc.encode(message.desc, writer.uint32(10).fork()).ldelim();
        }
        if (message.id !== '') {
            writer.uint32(18).string(message.id);
        }
        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({}, baseOutputDataset);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.desc = exports.OutputDatasetDesc.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.id = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseOutputDataset);
        message.desc =
            object.desc !== undefined && object.desc !== null
                ? exports.OutputDatasetDesc.fromJSON(object.desc)
                : undefined;
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.desc !== undefined &&
            (obj.desc = message.desc ? exports.OutputDatasetDesc.toJSON(message.desc) : undefined);
        message.id !== undefined && (obj.id = message.id);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseOutputDataset);
        message.desc =
            object.desc !== undefined && object.desc !== null
                ? exports.OutputDatasetDesc.fromPartial(object.desc)
                : undefined;
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseJob = {
    id: '',
    name: '',
    desc: '',
    status: 0,
    config: '',
    createdById: '',
    projectId: '',
    dataCleared: false,
    dataSizeBytes: 0,
    statusDetails: '',
    parentJobId: '',
};
exports.Job = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.desc !== '') {
            writer.uint32(26).string(message.desc);
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(34).fork()).ldelim();
        }
        if (message.finishedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.finishedAt), writer.uint32(42).fork()).ldelim();
        }
        if (message.status !== 0) {
            writer.uint32(48).int32(message.status);
        }
        if (message.config !== '') {
            writer.uint32(58).string(message.config);
        }
        if (message.createdById !== '') {
            writer.uint32(66).string(message.createdById);
        }
        if (message.projectId !== '') {
            writer.uint32(74).string(message.projectId);
        }
        if (message.jobParameters !== undefined) {
            exports.JobParameters.encode(message.jobParameters, writer.uint32(82).fork()).ldelim();
        }
        if (message.dataExpiresAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.dataExpiresAt), writer.uint32(90).fork()).ldelim();
        }
        if (message.dataCleared === true) {
            writer.uint32(96).bool(message.dataCleared);
        }
        for (const v of message.outputFiles) {
            exports.File.encode(v, writer.uint32(106).fork()).ldelim();
        }
        for (const v of message.logFiles) {
            exports.File.encode(v, writer.uint32(114).fork()).ldelim();
        }
        for (const v of message.diagnosticFiles) {
            exports.File.encode(v, writer.uint32(122).fork()).ldelim();
        }
        if (message.dataSizeBytes !== 0) {
            writer.uint32(128).int64(message.dataSizeBytes);
        }
        if (message.startedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.startedAt), writer.uint32(138).fork()).ldelim();
        }
        if (message.statusDetails !== '') {
            writer.uint32(146).string(message.statusDetails);
        }
        if (message.actualCloudInstanceType !== undefined) {
            exports.CloudInstanceType.encode(message.actualCloudInstanceType, writer.uint32(154).fork()).ldelim();
        }
        if (message.parentJobId !== '') {
            writer.uint32(162).string(message.parentJobId);
        }
        for (const v of message.fileErrors) {
            exports.FileUploadError.encode(v, writer.uint32(170).fork()).ldelim();
        }
        for (const v of message.outputDatasets) {
            exports.OutputDataset.encode(v, writer.uint32(178).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({}, baseJob);
        message.outputFiles = [];
        message.logFiles = [];
        message.diagnosticFiles = [];
        message.fileErrors = [];
        message.outputDatasets = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.desc = reader.string();
                    break;
                case 4:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 5:
                    message.finishedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 6:
                    message.status = reader.int32();
                    break;
                case 7:
                    message.config = reader.string();
                    break;
                case 8:
                    message.createdById = reader.string();
                    break;
                case 9:
                    message.projectId = reader.string();
                    break;
                case 10:
                    message.jobParameters = exports.JobParameters.decode(reader, reader.uint32());
                    break;
                case 11:
                    message.dataExpiresAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 12:
                    message.dataCleared = reader.bool();
                    break;
                case 13:
                    message.outputFiles.push(exports.File.decode(reader, reader.uint32()));
                    break;
                case 14:
                    message.logFiles.push(exports.File.decode(reader, reader.uint32()));
                    break;
                case 15:
                    message.diagnosticFiles.push(exports.File.decode(reader, reader.uint32()));
                    break;
                case 16:
                    message.dataSizeBytes = longToNumber(reader.int64());
                    break;
                case 17:
                    message.startedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 18:
                    message.statusDetails = reader.string();
                    break;
                case 19:
                    message.actualCloudInstanceType = exports.CloudInstanceType.decode(reader, reader.uint32());
                    break;
                case 20:
                    message.parentJobId = reader.string();
                    break;
                case 21:
                    message.fileErrors.push(exports.FileUploadError.decode(reader, reader.uint32()));
                    break;
                case 22:
                    message.outputDatasets.push(exports.OutputDataset.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b, _c, _d, _e;
        const message = Object.assign({}, baseJob);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.desc = object.desc !== undefined && object.desc !== null ? String(object.desc) : '';
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.finishedAt =
            object.finishedAt !== undefined && object.finishedAt !== null
                ? fromJsonTimestamp(object.finishedAt)
                : undefined;
        message.status =
            object.status !== undefined && object.status !== null
                ? jobStatusFromJSON(object.status)
                : 0;
        message.config =
            object.config !== undefined && object.config !== null ? String(object.config) : '';
        message.createdById =
            object.createdById !== undefined && object.createdById !== null
                ? String(object.createdById)
                : '';
        message.projectId =
            object.projectId !== undefined && object.projectId !== null
                ? String(object.projectId)
                : '';
        message.jobParameters =
            object.jobParameters !== undefined && object.jobParameters !== null
                ? exports.JobParameters.fromJSON(object.jobParameters)
                : undefined;
        message.dataExpiresAt =
            object.dataExpiresAt !== undefined && object.dataExpiresAt !== null
                ? fromJsonTimestamp(object.dataExpiresAt)
                : undefined;
        message.dataCleared =
            object.dataCleared !== undefined && object.dataCleared !== null
                ? Boolean(object.dataCleared)
                : false;
        message.outputFiles = ((_a = object.outputFiles) !== null && _a !== void 0 ? _a : []).map((e) => exports.File.fromJSON(e));
        message.logFiles = ((_b = object.logFiles) !== null && _b !== void 0 ? _b : []).map((e) => exports.File.fromJSON(e));
        message.diagnosticFiles = ((_c = object.diagnosticFiles) !== null && _c !== void 0 ? _c : []).map((e) => exports.File.fromJSON(e));
        message.dataSizeBytes =
            object.dataSizeBytes !== undefined && object.dataSizeBytes !== null
                ? Number(object.dataSizeBytes)
                : 0;
        message.startedAt =
            object.startedAt !== undefined && object.startedAt !== null
                ? fromJsonTimestamp(object.startedAt)
                : undefined;
        message.statusDetails =
            object.statusDetails !== undefined && object.statusDetails !== null
                ? String(object.statusDetails)
                : '';
        message.actualCloudInstanceType =
            object.actualCloudInstanceType !== undefined && object.actualCloudInstanceType !== null
                ? exports.CloudInstanceType.fromJSON(object.actualCloudInstanceType)
                : undefined;
        message.parentJobId =
            object.parentJobId !== undefined && object.parentJobId !== null
                ? String(object.parentJobId)
                : '';
        message.fileErrors = ((_d = object.fileErrors) !== null && _d !== void 0 ? _d : []).map((e) => exports.FileUploadError.fromJSON(e));
        message.outputDatasets = ((_e = object.outputDatasets) !== null && _e !== void 0 ? _e : []).map((e) => exports.OutputDataset.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.name !== undefined && (obj.name = message.name);
        message.desc !== undefined && (obj.desc = message.desc);
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.finishedAt !== undefined && (obj.finishedAt = message.finishedAt.toISOString());
        message.status !== undefined && (obj.status = jobStatusToJSON(message.status));
        message.config !== undefined && (obj.config = message.config);
        message.createdById !== undefined && (obj.createdById = message.createdById);
        message.projectId !== undefined && (obj.projectId = message.projectId);
        message.jobParameters !== undefined &&
            (obj.jobParameters = message.jobParameters
                ? exports.JobParameters.toJSON(message.jobParameters)
                : undefined);
        message.dataExpiresAt !== undefined &&
            (obj.dataExpiresAt = message.dataExpiresAt.toISOString());
        message.dataCleared !== undefined && (obj.dataCleared = message.dataCleared);
        if (message.outputFiles) {
            obj.outputFiles = message.outputFiles.map((e) => (e ? exports.File.toJSON(e) : undefined));
        }
        else {
            obj.outputFiles = [];
        }
        if (message.logFiles) {
            obj.logFiles = message.logFiles.map((e) => (e ? exports.File.toJSON(e) : undefined));
        }
        else {
            obj.logFiles = [];
        }
        if (message.diagnosticFiles) {
            obj.diagnosticFiles = message.diagnosticFiles.map((e) => e ? exports.File.toJSON(e) : undefined);
        }
        else {
            obj.diagnosticFiles = [];
        }
        message.dataSizeBytes !== undefined &&
            (obj.dataSizeBytes = Math.round(message.dataSizeBytes));
        message.startedAt !== undefined && (obj.startedAt = message.startedAt.toISOString());
        message.statusDetails !== undefined && (obj.statusDetails = message.statusDetails);
        message.actualCloudInstanceType !== undefined &&
            (obj.actualCloudInstanceType = message.actualCloudInstanceType
                ? exports.CloudInstanceType.toJSON(message.actualCloudInstanceType)
                : undefined);
        message.parentJobId !== undefined && (obj.parentJobId = message.parentJobId);
        if (message.fileErrors) {
            obj.fileErrors = message.fileErrors.map((e) => e ? exports.FileUploadError.toJSON(e) : undefined);
        }
        else {
            obj.fileErrors = [];
        }
        if (message.outputDatasets) {
            obj.outputDatasets = message.outputDatasets.map((e) => e ? exports.OutputDataset.toJSON(e) : undefined);
        }
        else {
            obj.outputDatasets = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
        const message = Object.assign({}, baseJob);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.desc = (_c = object.desc) !== null && _c !== void 0 ? _c : '';
        message.createdAt = (_d = object.createdAt) !== null && _d !== void 0 ? _d : undefined;
        message.finishedAt = (_e = object.finishedAt) !== null && _e !== void 0 ? _e : undefined;
        message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
        message.config = (_g = object.config) !== null && _g !== void 0 ? _g : '';
        message.createdById = (_h = object.createdById) !== null && _h !== void 0 ? _h : '';
        message.projectId = (_j = object.projectId) !== null && _j !== void 0 ? _j : '';
        message.jobParameters =
            object.jobParameters !== undefined && object.jobParameters !== null
                ? exports.JobParameters.fromPartial(object.jobParameters)
                : undefined;
        message.dataExpiresAt = (_k = object.dataExpiresAt) !== null && _k !== void 0 ? _k : undefined;
        message.dataCleared = (_l = object.dataCleared) !== null && _l !== void 0 ? _l : false;
        message.outputFiles = ((_m = object.outputFiles) === null || _m === void 0 ? void 0 : _m.map((e) => exports.File.fromPartial(e))) || [];
        message.logFiles = ((_o = object.logFiles) === null || _o === void 0 ? void 0 : _o.map((e) => exports.File.fromPartial(e))) || [];
        message.diagnosticFiles = ((_p = object.diagnosticFiles) === null || _p === void 0 ? void 0 : _p.map((e) => exports.File.fromPartial(e))) || [];
        message.dataSizeBytes = (_q = object.dataSizeBytes) !== null && _q !== void 0 ? _q : 0;
        message.startedAt = (_r = object.startedAt) !== null && _r !== void 0 ? _r : undefined;
        message.statusDetails = (_s = object.statusDetails) !== null && _s !== void 0 ? _s : '';
        message.actualCloudInstanceType =
            object.actualCloudInstanceType !== undefined && object.actualCloudInstanceType !== null
                ? exports.CloudInstanceType.fromPartial(object.actualCloudInstanceType)
                : undefined;
        message.parentJobId = (_t = object.parentJobId) !== null && _t !== void 0 ? _t : '';
        message.fileErrors = ((_u = object.fileErrors) === null || _u === void 0 ? void 0 : _u.map((e) => exports.FileUploadError.fromPartial(e))) || [];
        message.outputDatasets =
            ((_v = object.outputDatasets) === null || _v === void 0 ? void 0 : _v.map((e) => exports.OutputDataset.fromPartial(e))) || [];
        return message;
    },
};
const baseJobResult = { returnCode: 0 };
exports.JobResult = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.returnCode !== 0) {
            writer.uint32(8).int64(message.returnCode);
        }
        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({}, baseJobResult);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.returnCode = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseJobResult);
        message.returnCode =
            object.returnCode !== undefined && object.returnCode !== null
                ? Number(object.returnCode)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.returnCode !== undefined && (obj.returnCode = Math.round(message.returnCode));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseJobResult);
        message.returnCode = (_a = object.returnCode) !== null && _a !== void 0 ? _a : 0;
        return message;
    },
};
const baseGracefulShutdownParameters = { signal: 0 };
exports.GracefulShutdownParameters = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.timeout !== undefined) {
            duration_1.Duration.encode(message.timeout, writer.uint32(10).fork()).ldelim();
        }
        if (message.signal !== 0) {
            writer.uint32(16).int64(message.signal);
        }
        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({}, baseGracefulShutdownParameters);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.timeout = duration_1.Duration.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.signal = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGracefulShutdownParameters);
        message.timeout =
            object.timeout !== undefined && object.timeout !== null
                ? duration_1.Duration.fromJSON(object.timeout)
                : undefined;
        message.signal =
            object.signal !== undefined && object.signal !== null ? Number(object.signal) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.timeout !== undefined &&
            (obj.timeout = message.timeout ? duration_1.Duration.toJSON(message.timeout) : undefined);
        message.signal !== undefined && (obj.signal = Math.round(message.signal));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGracefulShutdownParameters);
        message.timeout =
            object.timeout !== undefined && object.timeout !== null
                ? duration_1.Duration.fromPartial(object.timeout)
                : undefined;
        message.signal = (_a = object.signal) !== null && _a !== void 0 ? _a : 0;
        return message;
    },
};
const baseJobMetadata = {
    id: '',
    name: '',
    description: '',
    status: 0,
    statusDetails: '',
    createdById: '',
    projectId: '',
    parentJobId: '',
};
exports.JobMetadata = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(34).fork()).ldelim();
        }
        if (message.startedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.startedAt), writer.uint32(42).fork()).ldelim();
        }
        if (message.finishedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.finishedAt), writer.uint32(50).fork()).ldelim();
        }
        if (message.dataExpiresAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.dataExpiresAt), writer.uint32(58).fork()).ldelim();
        }
        if (message.status !== 0) {
            writer.uint32(64).int32(message.status);
        }
        if (message.statusDetails !== '') {
            writer.uint32(74).string(message.statusDetails);
        }
        if (message.createdById !== '') {
            writer.uint32(82).string(message.createdById);
        }
        if (message.projectId !== '') {
            writer.uint32(90).string(message.projectId);
        }
        if (message.parentJobId !== '') {
            writer.uint32(98).string(message.parentJobId);
        }
        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({}, baseJobMetadata);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 4:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 5:
                    message.startedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 6:
                    message.finishedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 7:
                    message.dataExpiresAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 8:
                    message.status = reader.int32();
                    break;
                case 9:
                    message.statusDetails = reader.string();
                    break;
                case 10:
                    message.createdById = reader.string();
                    break;
                case 11:
                    message.projectId = reader.string();
                    break;
                case 12:
                    message.parentJobId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseJobMetadata);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.startedAt =
            object.startedAt !== undefined && object.startedAt !== null
                ? fromJsonTimestamp(object.startedAt)
                : undefined;
        message.finishedAt =
            object.finishedAt !== undefined && object.finishedAt !== null
                ? fromJsonTimestamp(object.finishedAt)
                : undefined;
        message.dataExpiresAt =
            object.dataExpiresAt !== undefined && object.dataExpiresAt !== null
                ? fromJsonTimestamp(object.dataExpiresAt)
                : undefined;
        message.status =
            object.status !== undefined && object.status !== null
                ? jobStatusFromJSON(object.status)
                : 0;
        message.statusDetails =
            object.statusDetails !== undefined && object.statusDetails !== null
                ? String(object.statusDetails)
                : '';
        message.createdById =
            object.createdById !== undefined && object.createdById !== null
                ? String(object.createdById)
                : '';
        message.projectId =
            object.projectId !== undefined && object.projectId !== null
                ? String(object.projectId)
                : '';
        message.parentJobId =
            object.parentJobId !== undefined && object.parentJobId !== null
                ? String(object.parentJobId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.startedAt !== undefined && (obj.startedAt = message.startedAt.toISOString());
        message.finishedAt !== undefined && (obj.finishedAt = message.finishedAt.toISOString());
        message.dataExpiresAt !== undefined &&
            (obj.dataExpiresAt = message.dataExpiresAt.toISOString());
        message.status !== undefined && (obj.status = jobStatusToJSON(message.status));
        message.statusDetails !== undefined && (obj.statusDetails = message.statusDetails);
        message.createdById !== undefined && (obj.createdById = message.createdById);
        message.projectId !== undefined && (obj.projectId = message.projectId);
        message.parentJobId !== undefined && (obj.parentJobId = message.parentJobId);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
        const message = Object.assign({}, baseJobMetadata);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.createdAt = (_d = object.createdAt) !== null && _d !== void 0 ? _d : undefined;
        message.startedAt = (_e = object.startedAt) !== null && _e !== void 0 ? _e : undefined;
        message.finishedAt = (_f = object.finishedAt) !== null && _f !== void 0 ? _f : undefined;
        message.dataExpiresAt = (_g = object.dataExpiresAt) !== null && _g !== void 0 ? _g : undefined;
        message.status = (_h = object.status) !== null && _h !== void 0 ? _h : 0;
        message.statusDetails = (_j = object.statusDetails) !== null && _j !== void 0 ? _j : '';
        message.createdById = (_k = object.createdById) !== null && _k !== void 0 ? _k : '';
        message.projectId = (_l = object.projectId) !== null && _l !== void 0 ? _l : '';
        message.parentJobId = (_m = object.parentJobId) !== null && _m !== void 0 ? _m : '';
        return message;
    },
};
const baseJobProgress = { message: '', progress: 0 };
exports.JobProgress = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.message !== '') {
            writer.uint32(10).string(message.message);
        }
        if (message.progress !== 0) {
            writer.uint32(16).int64(message.progress);
        }
        if (message.createTime !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createTime), 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({}, baseJobProgress);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.message = reader.string();
                    break;
                case 2:
                    message.progress = longToNumber(reader.int64());
                    break;
                case 3:
                    message.createTime = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseJobProgress);
        message.message =
            object.message !== undefined && object.message !== null ? String(object.message) : '';
        message.progress =
            object.progress !== undefined && object.progress !== null ? Number(object.progress) : 0;
        message.createTime =
            object.createTime !== undefined && object.createTime !== null
                ? fromJsonTimestamp(object.createTime)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.message !== undefined && (obj.message = message.message);
        message.progress !== undefined && (obj.progress = Math.round(message.progress));
        message.createTime !== undefined && (obj.createTime = message.createTime.toISOString());
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseJobProgress);
        message.message = (_a = object.message) !== null && _a !== void 0 ? _a : '';
        message.progress = (_b = object.progress) !== null && _b !== void 0 ? _b : 0;
        message.createTime = (_c = object.createTime) !== null && _c !== void 0 ? _c : undefined;
        return message;
    },
};
const baseSparkParameters = { connectorId: '' };
exports.SparkParameters = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.connectorId !== '') {
            writer.uint32(10).string(message.connectorId);
        }
        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({}, baseSparkParameters);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.connectorId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseSparkParameters);
        message.connectorId =
            object.connectorId !== undefined && object.connectorId !== null
                ? String(object.connectorId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.connectorId !== undefined && (obj.connectorId = message.connectorId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseSparkParameters);
        message.connectorId = (_a = object.connectorId) !== null && _a !== void 0 ? _a : '';
        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 toTimestamp(date) {
    const seconds = date.getTime() / 1000;
    const nanos = (date.getTime() % 1000) * 1000000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = t.seconds * 1000;
    millis += t.nanos / 1000000;
    return new Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof Date) {
        return o;
    }
    else if (typeof o === 'string') {
        return new Date(o);
    }
    else {
        return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
    }
}
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();
}
