using CrazyStudio.Core.Common.Eitities;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using XPrintServer.Api.Entities;
using XPrintServer.Api.Tools;

namespace XPrintServer.Api.Controllers.Ai
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    public class KLController
    {

        private readonly KelinInfos _kelinInfos;
        private readonly AliyunInfos _aliyunInfos;
        public KLController(KelinInfos kelinInfos, AliyunInfos aliyunInfos)
        {
            _kelinInfos = kelinInfos;
            _aliyunInfos = aliyunInfos;
        }

        [HttpPost]
        public async Task<dynamic?> CreateImageUrl()
        {
            dynamic? result = await HttpKelinTool.RequestKelin(new RequestKelinInfo<KenlinImageRequest>
            {
                Data = new KenlinImageRequest
                {
                    //AspectRatio = "1:1",
                    Prompt = "一架飞机，飞在蔚蓝的天空上，旁边飘着几朵白云",
                    //CallbackUrl = "",
                    //Image = "",
                    //ImageReference = "",//subject
                    //ModelName = "kling-v1",//kling-v2
                },
                Url = "/v1/images/generations"
            }, _kelinInfos.AccessKey, _kelinInfos.SecretKey);
            return result;
        }
    }
}
