"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageGenerationOptions = exports.AspectRatio = exports.Message = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
exports.protobufPackage = 'yandex.cloud.ai.foundation_models.v1.image_generation';
const baseMessage = { text: '', weight: 0 };
exports.Message = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.text !== '') {
            writer.uint32(10).string(message.text);
        }
        if (message.weight !== 0) {
            writer.uint32(17).double(message.weight);
        }
        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({}, baseMessage);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.text = reader.string();
                    break;
                case 2:
                    message.weight = reader.double();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseMessage);
        message.text = object.text !== undefined && object.text !== null ? String(object.text) : '';
        message.weight =
            object.weight !== undefined && object.weight !== null ? Number(object.weight) : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.text !== undefined && (obj.text = message.text);
        message.weight !== undefined && (obj.weight = message.weight);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseMessage);
        message.text = (_a = object.text) !== null && _a !== void 0 ? _a : '';
        message.weight = (_b = object.weight) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseAspectRatio = { widthRatio: 0, heightRatio: 0 };
exports.AspectRatio = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.widthRatio !== 0) {
            writer.uint32(8).int64(message.widthRatio);
        }
        if (message.heightRatio !== 0) {
            writer.uint32(16).int64(message.heightRatio);
        }
        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({}, baseAspectRatio);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.widthRatio = longToNumber(reader.int64());
                    break;
                case 2:
                    message.heightRatio = longToNumber(reader.int64());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseAspectRatio);
        message.widthRatio =
            object.widthRatio !== undefined && object.widthRatio !== null
                ? Number(object.widthRatio)
                : 0;
        message.heightRatio =
            object.heightRatio !== undefined && object.heightRatio !== null
                ? Number(object.heightRatio)
                : 0;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.widthRatio !== undefined && (obj.widthRatio = Math.round(message.widthRatio));
        message.heightRatio !== undefined && (obj.heightRatio = Math.round(message.heightRatio));
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseAspectRatio);
        message.widthRatio = (_a = object.widthRatio) !== null && _a !== void 0 ? _a : 0;
        message.heightRatio = (_b = object.heightRatio) !== null && _b !== void 0 ? _b : 0;
        return message;
    },
};
const baseImageGenerationOptions = { mimeType: '', seed: 0 };
exports.ImageGenerationOptions = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.mimeType !== '') {
            writer.uint32(10).string(message.mimeType);
        }
        if (message.seed !== 0) {
            writer.uint32(16).int64(message.seed);
        }
        if (message.aspectRatio !== undefined) {
            exports.AspectRatio.encode(message.aspectRatio, 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({}, baseImageGenerationOptions);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.mimeType = reader.string();
                    break;
                case 2:
                    message.seed = longToNumber(reader.int64());
                    break;
                case 3:
                    message.aspectRatio = exports.AspectRatio.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseImageGenerationOptions);
        message.mimeType =
            object.mimeType !== undefined && object.mimeType !== null
                ? String(object.mimeType)
                : '';
        message.seed = object.seed !== undefined && object.seed !== null ? Number(object.seed) : 0;
        message.aspectRatio =
            object.aspectRatio !== undefined && object.aspectRatio !== null
                ? exports.AspectRatio.fromJSON(object.aspectRatio)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.mimeType !== undefined && (obj.mimeType = message.mimeType);
        message.seed !== undefined && (obj.seed = Math.round(message.seed));
        message.aspectRatio !== undefined &&
            (obj.aspectRatio = message.aspectRatio
                ? exports.AspectRatio.toJSON(message.aspectRatio)
                : undefined);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseImageGenerationOptions);
        message.mimeType = (_a = object.mimeType) !== null && _a !== void 0 ? _a : '';
        message.seed = (_b = object.seed) !== null && _b !== void 0 ? _b : 0;
        message.aspectRatio =
            object.aspectRatio !== undefined && object.aspectRatio !== null
                ? exports.AspectRatio.fromPartial(object.aspectRatio)
                : undefined;
        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();
}
