"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelmRelease = exports.helmRelease_StatusToJSON = exports.helmRelease_StatusFromJSON = exports.HelmRelease_Status = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const timestamp_1 = require("../../../../../google/protobuf/timestamp");
exports.protobufPackage = 'yandex.cloud.k8s.marketplace.v1';
var HelmRelease_Status;
(function (HelmRelease_Status) {
    HelmRelease_Status[HelmRelease_Status["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
    /** UNKNOWN - Helm release status is unknown */
    HelmRelease_Status[HelmRelease_Status["UNKNOWN"] = 1] = "UNKNOWN";
    /** DEPLOYED - Helm release deployed. */
    HelmRelease_Status[HelmRelease_Status["DEPLOYED"] = 2] = "DEPLOYED";
    /** UNINSTALLED - Helm release uninstalled. */
    HelmRelease_Status[HelmRelease_Status["UNINSTALLED"] = 3] = "UNINSTALLED";
    /** SUPERSEDED - Helm release superseded. */
    HelmRelease_Status[HelmRelease_Status["SUPERSEDED"] = 4] = "SUPERSEDED";
    /** FAILED - Helm release installation failed. */
    HelmRelease_Status[HelmRelease_Status["FAILED"] = 5] = "FAILED";
    /** UNINSTALLING - Helm release is being uninstalled. */
    HelmRelease_Status[HelmRelease_Status["UNINSTALLING"] = 6] = "UNINSTALLING";
    /** PENDING_INSTALL - Helm release is to be installed. */
    HelmRelease_Status[HelmRelease_Status["PENDING_INSTALL"] = 7] = "PENDING_INSTALL";
    /** PENDING_UPGRADE - Helm release is to be updated. */
    HelmRelease_Status[HelmRelease_Status["PENDING_UPGRADE"] = 8] = "PENDING_UPGRADE";
    /** PENDING_ROLLBACK - Helm release is to be rolled back. */
    HelmRelease_Status[HelmRelease_Status["PENDING_ROLLBACK"] = 9] = "PENDING_ROLLBACK";
    HelmRelease_Status[HelmRelease_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(HelmRelease_Status = exports.HelmRelease_Status || (exports.HelmRelease_Status = {}));
function helmRelease_StatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'STATUS_UNSPECIFIED':
            return HelmRelease_Status.STATUS_UNSPECIFIED;
        case 1:
        case 'UNKNOWN':
            return HelmRelease_Status.UNKNOWN;
        case 2:
        case 'DEPLOYED':
            return HelmRelease_Status.DEPLOYED;
        case 3:
        case 'UNINSTALLED':
            return HelmRelease_Status.UNINSTALLED;
        case 4:
        case 'SUPERSEDED':
            return HelmRelease_Status.SUPERSEDED;
        case 5:
        case 'FAILED':
            return HelmRelease_Status.FAILED;
        case 6:
        case 'UNINSTALLING':
            return HelmRelease_Status.UNINSTALLING;
        case 7:
        case 'PENDING_INSTALL':
            return HelmRelease_Status.PENDING_INSTALL;
        case 8:
        case 'PENDING_UPGRADE':
            return HelmRelease_Status.PENDING_UPGRADE;
        case 9:
        case 'PENDING_ROLLBACK':
            return HelmRelease_Status.PENDING_ROLLBACK;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return HelmRelease_Status.UNRECOGNIZED;
    }
}
exports.helmRelease_StatusFromJSON = helmRelease_StatusFromJSON;
function helmRelease_StatusToJSON(object) {
    switch (object) {
        case HelmRelease_Status.STATUS_UNSPECIFIED:
            return 'STATUS_UNSPECIFIED';
        case HelmRelease_Status.UNKNOWN:
            return 'UNKNOWN';
        case HelmRelease_Status.DEPLOYED:
            return 'DEPLOYED';
        case HelmRelease_Status.UNINSTALLED:
            return 'UNINSTALLED';
        case HelmRelease_Status.SUPERSEDED:
            return 'SUPERSEDED';
        case HelmRelease_Status.FAILED:
            return 'FAILED';
        case HelmRelease_Status.UNINSTALLING:
            return 'UNINSTALLING';
        case HelmRelease_Status.PENDING_INSTALL:
            return 'PENDING_INSTALL';
        case HelmRelease_Status.PENDING_UPGRADE:
            return 'PENDING_UPGRADE';
        case HelmRelease_Status.PENDING_ROLLBACK:
            return 'PENDING_ROLLBACK';
        default:
            return 'UNKNOWN';
    }
}
exports.helmRelease_StatusToJSON = helmRelease_StatusToJSON;
const baseHelmRelease = {
    id: '',
    clusterId: '',
    appName: '',
    appNamespace: '',
    productId: '',
    productName: '',
    productVersion: '',
    status: 0,
};
exports.HelmRelease = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.clusterId !== '') {
            writer.uint32(18).string(message.clusterId);
        }
        if (message.appName !== '') {
            writer.uint32(26).string(message.appName);
        }
        if (message.appNamespace !== '') {
            writer.uint32(34).string(message.appNamespace);
        }
        if (message.productId !== '') {
            writer.uint32(42).string(message.productId);
        }
        if (message.productName !== '') {
            writer.uint32(50).string(message.productName);
        }
        if (message.productVersion !== '') {
            writer.uint32(82).string(message.productVersion);
        }
        if (message.status !== 0) {
            writer.uint32(56).int32(message.status);
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(66).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseHelmRelease);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.clusterId = reader.string();
                    break;
                case 3:
                    message.appName = reader.string();
                    break;
                case 4:
                    message.appNamespace = reader.string();
                    break;
                case 5:
                    message.productId = reader.string();
                    break;
                case 6:
                    message.productName = reader.string();
                    break;
                case 10:
                    message.productVersion = reader.string();
                    break;
                case 7:
                    message.status = reader.int32();
                    break;
                case 8:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseHelmRelease);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.clusterId =
            object.clusterId !== undefined && object.clusterId !== null
                ? String(object.clusterId)
                : '';
        message.appName =
            object.appName !== undefined && object.appName !== null ? String(object.appName) : '';
        message.appNamespace =
            object.appNamespace !== undefined && object.appNamespace !== null
                ? String(object.appNamespace)
                : '';
        message.productId =
            object.productId !== undefined && object.productId !== null
                ? String(object.productId)
                : '';
        message.productName =
            object.productName !== undefined && object.productName !== null
                ? String(object.productName)
                : '';
        message.productVersion =
            object.productVersion !== undefined && object.productVersion !== null
                ? String(object.productVersion)
                : '';
        message.status =
            object.status !== undefined && object.status !== null
                ? helmRelease_StatusFromJSON(object.status)
                : 0;
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.clusterId !== undefined && (obj.clusterId = message.clusterId);
        message.appName !== undefined && (obj.appName = message.appName);
        message.appNamespace !== undefined && (obj.appNamespace = message.appNamespace);
        message.productId !== undefined && (obj.productId = message.productId);
        message.productName !== undefined && (obj.productName = message.productName);
        message.productVersion !== undefined && (obj.productVersion = message.productVersion);
        message.status !== undefined && (obj.status = helmRelease_StatusToJSON(message.status));
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j;
        const message = Object.assign({}, baseHelmRelease);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.clusterId = (_b = object.clusterId) !== null && _b !== void 0 ? _b : '';
        message.appName = (_c = object.appName) !== null && _c !== void 0 ? _c : '';
        message.appNamespace = (_d = object.appNamespace) !== null && _d !== void 0 ? _d : '';
        message.productId = (_e = object.productId) !== null && _e !== void 0 ? _e : '';
        message.productName = (_f = object.productName) !== null && _f !== void 0 ? _f : '';
        message.productVersion = (_g = object.productVersion) !== null && _g !== void 0 ? _g : '';
        message.status = (_h = object.status) !== null && _h !== void 0 ? _h : 0;
        message.createdAt = (_j = object.createdAt) !== null && _j !== void 0 ? _j : undefined;
        return message;
    },
};
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));
    }
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
