"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Registry_PropertiesEntry = exports.Registry_LabelsEntry = exports.Registry = exports.registry_TypeToJSON = exports.registry_TypeFromJSON = exports.Registry_Type = exports.registry_KindToJSON = exports.registry_KindFromJSON = exports.Registry_Kind = exports.registry_StatusToJSON = exports.registry_StatusFromJSON = exports.Registry_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.cloudregistry.v1';
var Registry_Status;
(function (Registry_Status) {
    Registry_Status[Registry_Status["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
    /** CREATING - Registry is being created. */
    Registry_Status[Registry_Status["CREATING"] = 1] = "CREATING";
    /** ACTIVE - Registry is ready to use. */
    Registry_Status[Registry_Status["ACTIVE"] = 2] = "ACTIVE";
    /** DELETING - Registry is being deleted. */
    Registry_Status[Registry_Status["DELETING"] = 3] = "DELETING";
    Registry_Status[Registry_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Registry_Status = exports.Registry_Status || (exports.Registry_Status = {}));
function registry_StatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'STATUS_UNSPECIFIED':
            return Registry_Status.STATUS_UNSPECIFIED;
        case 1:
        case 'CREATING':
            return Registry_Status.CREATING;
        case 2:
        case 'ACTIVE':
            return Registry_Status.ACTIVE;
        case 3:
        case 'DELETING':
            return Registry_Status.DELETING;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Registry_Status.UNRECOGNIZED;
    }
}
exports.registry_StatusFromJSON = registry_StatusFromJSON;
function registry_StatusToJSON(object) {
    switch (object) {
        case Registry_Status.STATUS_UNSPECIFIED:
            return 'STATUS_UNSPECIFIED';
        case Registry_Status.CREATING:
            return 'CREATING';
        case Registry_Status.ACTIVE:
            return 'ACTIVE';
        case Registry_Status.DELETING:
            return 'DELETING';
        default:
            return 'UNKNOWN';
    }
}
exports.registry_StatusToJSON = registry_StatusToJSON;
var Registry_Kind;
(function (Registry_Kind) {
    Registry_Kind[Registry_Kind["KIND_UNSPECIFIED"] = 0] = "KIND_UNSPECIFIED";
    /** MAVEN - Registry kind is maven. */
    Registry_Kind[Registry_Kind["MAVEN"] = 1] = "MAVEN";
    /** NPM - Registry kind is npm. */
    Registry_Kind[Registry_Kind["NPM"] = 2] = "NPM";
    /** DOCKER - Registry kind is docker. */
    Registry_Kind[Registry_Kind["DOCKER"] = 3] = "DOCKER";
    /** NUGET - Registry kind is nuget. */
    Registry_Kind[Registry_Kind["NUGET"] = 4] = "NUGET";
    Registry_Kind[Registry_Kind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Registry_Kind = exports.Registry_Kind || (exports.Registry_Kind = {}));
function registry_KindFromJSON(object) {
    switch (object) {
        case 0:
        case 'KIND_UNSPECIFIED':
            return Registry_Kind.KIND_UNSPECIFIED;
        case 1:
        case 'MAVEN':
            return Registry_Kind.MAVEN;
        case 2:
        case 'NPM':
            return Registry_Kind.NPM;
        case 3:
        case 'DOCKER':
            return Registry_Kind.DOCKER;
        case 4:
        case 'NUGET':
            return Registry_Kind.NUGET;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Registry_Kind.UNRECOGNIZED;
    }
}
exports.registry_KindFromJSON = registry_KindFromJSON;
function registry_KindToJSON(object) {
    switch (object) {
        case Registry_Kind.KIND_UNSPECIFIED:
            return 'KIND_UNSPECIFIED';
        case Registry_Kind.MAVEN:
            return 'MAVEN';
        case Registry_Kind.NPM:
            return 'NPM';
        case Registry_Kind.DOCKER:
            return 'DOCKER';
        case Registry_Kind.NUGET:
            return 'NUGET';
        default:
            return 'UNKNOWN';
    }
}
exports.registry_KindToJSON = registry_KindToJSON;
var Registry_Type;
(function (Registry_Type) {
    Registry_Type[Registry_Type["TYPE_UNSPECIFIED"] = 0] = "TYPE_UNSPECIFIED";
    /** LOCAL - Registry type is local. */
    Registry_Type[Registry_Type["LOCAL"] = 1] = "LOCAL";
    Registry_Type[Registry_Type["REMOTE"] = 2] = "REMOTE";
    Registry_Type[Registry_Type["VIRTUAL"] = 3] = "VIRTUAL";
    Registry_Type[Registry_Type["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(Registry_Type = exports.Registry_Type || (exports.Registry_Type = {}));
function registry_TypeFromJSON(object) {
    switch (object) {
        case 0:
        case 'TYPE_UNSPECIFIED':
            return Registry_Type.TYPE_UNSPECIFIED;
        case 1:
        case 'LOCAL':
            return Registry_Type.LOCAL;
        case 2:
        case 'REMOTE':
            return Registry_Type.REMOTE;
        case 3:
        case 'VIRTUAL':
            return Registry_Type.VIRTUAL;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return Registry_Type.UNRECOGNIZED;
    }
}
exports.registry_TypeFromJSON = registry_TypeFromJSON;
function registry_TypeToJSON(object) {
    switch (object) {
        case Registry_Type.TYPE_UNSPECIFIED:
            return 'TYPE_UNSPECIFIED';
        case Registry_Type.LOCAL:
            return 'LOCAL';
        case Registry_Type.REMOTE:
            return 'REMOTE';
        case Registry_Type.VIRTUAL:
            return 'VIRTUAL';
        default:
            return 'UNKNOWN';
    }
}
exports.registry_TypeToJSON = registry_TypeToJSON;
const baseRegistry = {
    id: '',
    folderId: '',
    name: '',
    kind: 0,
    type: 0,
    status: 0,
    description: '',
};
exports.Registry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.folderId !== '') {
            writer.uint32(18).string(message.folderId);
        }
        if (message.name !== '') {
            writer.uint32(26).string(message.name);
        }
        if (message.kind !== 0) {
            writer.uint32(32).int32(message.kind);
        }
        if (message.type !== 0) {
            writer.uint32(40).int32(message.type);
        }
        if (message.status !== 0) {
            writer.uint32(48).int32(message.status);
        }
        if (message.description !== '') {
            writer.uint32(58).string(message.description);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.Registry_LabelsEntry.encode({ key: key, value }, writer.uint32(66).fork()).ldelim();
        });
        Object.entries(message.properties).forEach(([key, value]) => {
            exports.Registry_PropertiesEntry.encode({ key: key, value }, writer.uint32(74).fork()).ldelim();
        });
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).ldelim();
        }
        if (message.modifiedAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.modifiedAt), writer.uint32(90).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({}, baseRegistry);
        message.labels = {};
        message.properties = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.folderId = reader.string();
                    break;
                case 3:
                    message.name = reader.string();
                    break;
                case 4:
                    message.kind = reader.int32();
                    break;
                case 5:
                    message.type = reader.int32();
                    break;
                case 6:
                    message.status = reader.int32();
                    break;
                case 7:
                    message.description = reader.string();
                    break;
                case 8:
                    const entry8 = exports.Registry_LabelsEntry.decode(reader, reader.uint32());
                    if (entry8.value !== undefined) {
                        message.labels[entry8.key] = entry8.value;
                    }
                    break;
                case 9:
                    const entry9 = exports.Registry_PropertiesEntry.decode(reader, reader.uint32());
                    if (entry9.value !== undefined) {
                        message.properties[entry9.key] = entry9.value;
                    }
                    break;
                case 10:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 11:
                    message.modifiedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a, _b;
        const message = Object.assign({}, baseRegistry);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.kind =
            object.kind !== undefined && object.kind !== null
                ? registry_KindFromJSON(object.kind)
                : 0;
        message.type =
            object.type !== undefined && object.type !== null
                ? registry_TypeFromJSON(object.type)
                : 0;
        message.status =
            object.status !== undefined && object.status !== null
                ? registry_StatusFromJSON(object.status)
                : 0;
        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.properties = Object.entries((_b = object.properties) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.modifiedAt =
            object.modifiedAt !== undefined && object.modifiedAt !== null
                ? fromJsonTimestamp(object.modifiedAt)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.name !== undefined && (obj.name = message.name);
        message.kind !== undefined && (obj.kind = registry_KindToJSON(message.kind));
        message.type !== undefined && (obj.type = registry_TypeToJSON(message.type));
        message.status !== undefined && (obj.status = registry_StatusToJSON(message.status));
        message.description !== undefined && (obj.description = message.description);
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        obj.properties = {};
        if (message.properties) {
            Object.entries(message.properties).forEach(([k, v]) => {
                obj.properties[k] = v;
            });
        }
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.modifiedAt !== undefined && (obj.modifiedAt = message.modifiedAt.toISOString());
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
        const message = Object.assign({}, baseRegistry);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.folderId = (_b = object.folderId) !== null && _b !== void 0 ? _b : '';
        message.name = (_c = object.name) !== null && _c !== void 0 ? _c : '';
        message.kind = (_d = object.kind) !== null && _d !== void 0 ? _d : 0;
        message.type = (_e = object.type) !== null && _e !== void 0 ? _e : 0;
        message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
        message.description = (_g = object.description) !== null && _g !== void 0 ? _g : '';
        message.labels = Object.entries((_h = object.labels) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.properties = Object.entries((_j = object.properties) !== null && _j !== void 0 ? _j : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.createdAt = (_k = object.createdAt) !== null && _k !== void 0 ? _k : undefined;
        message.modifiedAt = (_l = object.modifiedAt) !== null && _l !== void 0 ? _l : undefined;
        return message;
    },
};
const baseRegistry_LabelsEntry = { key: '', value: '' };
exports.Registry_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({}, baseRegistry_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({}, baseRegistry_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({}, baseRegistry_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseRegistry_PropertiesEntry = { key: '', value: '' };
exports.Registry_PropertiesEntry = {
    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({}, baseRegistry_PropertiesEntry);
        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({}, baseRegistry_PropertiesEntry);
        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({}, baseRegistry_PropertiesEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        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();
}
