"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initImageGenerationSdk = exports.ImageGenerationSdk = void 0;
const image_generation_service_1 = require("../../generated/yandex/cloud/ai/foundation_models/v1/image_generation/image_generation_service");
class ImageGenerationSdk {
    constructor(session, endpoint = ImageGenerationSdk.ENDPOINT) {
        this.imageGenerationClient = session.client(image_generation_service_1.ImageGenerationAsyncServiceClient, endpoint);
    }
    generateImage(params, args) {
        const { modelId, folderId } = params, restParams = __rest(params, ["modelId", "folderId"]);
        const modelUri = `art://${folderId}/${modelId}`;
        return this.imageGenerationClient
            .generate(image_generation_service_1.ImageGenerationRequest.fromPartial(Object.assign(Object.assign({}, restParams), { modelUri })), args)
            .then((operation) => {
            return Object.assign(operation, { decoder: image_generation_service_1.ImageGenerationResponse.decode });
        });
    }
}
exports.ImageGenerationSdk = ImageGenerationSdk;
ImageGenerationSdk.ENDPOINT = 'llm.api.cloud.yandex.net:443';
const initImageGenerationSdk = (session, endpoint = ImageGenerationSdk.ENDPOINT) => {
    return new ImageGenerationSdk(session, endpoint);
};
exports.initImageGenerationSdk = initImageGenerationSdk;
