"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TuningTypePromptTune = exports.TuningTypeLora = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = 'yandex.cloud.ai.tuning.v1';
const baseTuningTypeLora = { rank: 0, alpha: 0, initialization: '', type: '' };
exports.TuningTypeLora = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.rank !== 0) {
            writer.uint32(8).int64(message.rank);
        }
        if (message.alpha !== 0) {
            writer.uint32(17).double(message.alpha);
        }
        if (message.initialization !== '') {
            writer.uint32(26).string(message.initialization);
        }
        if (message.type !== '') {
            writer.uint32(34).string(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({}, baseTuningTypeLora);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.rank = longToNumber(reader.int64());
                    break;
                case 2:
                    message.alpha = reader.double();
                    break;
                case 3:
                    message.initialization = reader.string();
                    break;
                case 4:
                    message.type = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTuningTypeLora);
        message.rank = object.rank !== undefined && object.rank !== null ? Number(object.rank) : 0;
        message.alpha =
            object.alpha !== undefined && object.alpha !== null ? Number(object.alpha) : 0;
        message.initialization =
            object.initialization !== undefined && object.initialization !== null
                ? String(object.initialization)
                : '';
        message.type = object.type !== undefined && object.type !== null ? String(object.type) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.rank !== undefined && (obj.rank = Math.round(message.rank));
        message.alpha !== undefined && (obj.alpha = message.alpha);
        message.initialization !== undefined && (obj.initialization = message.initialization);
        message.type !== undefined && (obj.type = message.type);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = Object.assign({}, baseTuningTypeLora);
        message.rank = (_a = object.rank) !== null && _a !== void 0 ? _a : 0;
        message.alpha = (_b = object.alpha) !== null && _b !== void 0 ? _b : 0;
        message.initialization = (_c = object.initialization) !== null && _c !== void 0 ? _c : '';
        message.type = (_d = object.type) !== null && _d !== void 0 ? _d : '';
        return message;
    },
};
const baseTuningTypePromptTune = { virtualTokens: 0 };
exports.TuningTypePromptTune = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.virtualTokens !== 0) {
            writer.uint32(8).int64(message.virtualTokens);
        }
        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({}, baseTuningTypePromptTune);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.virtualTokens = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTuningTypePromptTune);
        message.virtualTokens =
            object.virtualTokens !== undefined && object.virtualTokens !== null
                ? Number(object.virtualTokens)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.virtualTokens !== undefined &&
            (obj.virtualTokens = Math.round(message.virtualTokens));
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseTuningTypePromptTune);
        message.virtualTokens = (_a = object.virtualTokens) !== null && _a !== void 0 ? _a : 0;
        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();
}
