"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Error = exports.ExpirationConfig = exports.expirationConfig_ExpirationPolicyToJSON = exports.expirationConfig_ExpirationPolicyFromJSON = exports.ExpirationConfig_ExpirationPolicy = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = 'yandex.cloud.ai.common';
var ExpirationConfig_ExpirationPolicy;
(function (ExpirationConfig_ExpirationPolicy) {
    ExpirationConfig_ExpirationPolicy[ExpirationConfig_ExpirationPolicy["EXPIRATION_POLICY_UNSPECIFIED"] = 0] = "EXPIRATION_POLICY_UNSPECIFIED";
    ExpirationConfig_ExpirationPolicy[ExpirationConfig_ExpirationPolicy["STATIC"] = 1] = "STATIC";
    ExpirationConfig_ExpirationPolicy[ExpirationConfig_ExpirationPolicy["SINCE_LAST_ACTIVE"] = 2] = "SINCE_LAST_ACTIVE";
    ExpirationConfig_ExpirationPolicy[ExpirationConfig_ExpirationPolicy["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ExpirationConfig_ExpirationPolicy = exports.ExpirationConfig_ExpirationPolicy || (exports.ExpirationConfig_ExpirationPolicy = {}));
function expirationConfig_ExpirationPolicyFromJSON(object) {
    switch (object) {
        case 0:
        case 'EXPIRATION_POLICY_UNSPECIFIED':
            return ExpirationConfig_ExpirationPolicy.EXPIRATION_POLICY_UNSPECIFIED;
        case 1:
        case 'STATIC':
            return ExpirationConfig_ExpirationPolicy.STATIC;
        case 2:
        case 'SINCE_LAST_ACTIVE':
            return ExpirationConfig_ExpirationPolicy.SINCE_LAST_ACTIVE;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return ExpirationConfig_ExpirationPolicy.UNRECOGNIZED;
    }
}
exports.expirationConfig_ExpirationPolicyFromJSON = expirationConfig_ExpirationPolicyFromJSON;
function expirationConfig_ExpirationPolicyToJSON(object) {
    switch (object) {
        case ExpirationConfig_ExpirationPolicy.EXPIRATION_POLICY_UNSPECIFIED:
            return 'EXPIRATION_POLICY_UNSPECIFIED';
        case ExpirationConfig_ExpirationPolicy.STATIC:
            return 'STATIC';
        case ExpirationConfig_ExpirationPolicy.SINCE_LAST_ACTIVE:
            return 'SINCE_LAST_ACTIVE';
        default:
            return 'UNKNOWN';
    }
}
exports.expirationConfig_ExpirationPolicyToJSON = expirationConfig_ExpirationPolicyToJSON;
const baseExpirationConfig = { expirationPolicy: 0, ttlDays: 0 };
exports.ExpirationConfig = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.expirationPolicy !== 0) {
            writer.uint32(8).int32(message.expirationPolicy);
        }
        if (message.ttlDays !== 0) {
            writer.uint32(16).int64(message.ttlDays);
        }
        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({}, baseExpirationConfig);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.expirationPolicy = reader.int32();
                    break;
                case 2:
                    message.ttlDays = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseExpirationConfig);
        message.expirationPolicy =
            object.expirationPolicy !== undefined && object.expirationPolicy !== null
                ? expirationConfig_ExpirationPolicyFromJSON(object.expirationPolicy)
                : 0;
        message.ttlDays =
            object.ttlDays !== undefined && object.ttlDays !== null ? Number(object.ttlDays) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.expirationPolicy !== undefined &&
            (obj.expirationPolicy = expirationConfig_ExpirationPolicyToJSON(message.expirationPolicy));
        message.ttlDays !== undefined && (obj.ttlDays = Math.round(message.ttlDays));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseExpirationConfig);
        message.expirationPolicy = (_a = object.expirationPolicy) !== null && _a !== void 0 ? _a : 0;
        message.ttlDays = (_b = object.ttlDays) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseError = { code: 0, message: '' };
exports.Error = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.code !== 0) {
            writer.uint32(8).int64(message.code);
        }
        if (message.message !== '') {
            writer.uint32(18).string(message.message);
        }
        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({}, baseError);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.code = longToNumber(reader.int64());
                    break;
                case 2:
                    message.message = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseError);
        message.code = object.code !== undefined && object.code !== null ? Number(object.code) : 0;
        message.message =
            object.message !== undefined && object.message !== null ? String(object.message) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.code !== undefined && (obj.code = Math.round(message.code));
        message.message !== undefined && (obj.message = message.message);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseError);
        message.code = (_a = object.code) !== null && _a !== void 0 ? _a : 0;
        message.message = (_b = object.message) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
var globalThis = (() => {
    if (typeof globalThis !== 'undefined')
        return globalThis;
    if (typeof self !== 'undefined')
        return self;
    if (typeof window !== 'undefined')
        return window;
    if (typeof global !== 'undefined')
        return global;
    throw 'Unable to locate global object';
})();
function longToNumber(long) {
    if (long.gt(Number.MAX_SAFE_INTEGER)) {
        throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER');
    }
    return long.toNumber();
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
