package com.sonic.frog.controller.api;

import com.sonic.common.rpc.Result;
import com.sonic.frog.domain.input.GetRandomLockImageInput;
import com.sonic.frog.domain.input.UpdateIsDelChattedInput;
import com.sonic.frog.domain.output.AiChatInfoOutput;
import com.sonic.frog.service.AiChatInfoService;
import com.sonic.frog.service.ChatSetService;
import com.sonic.sdk.api.annotation.IgnoreAuth;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * AI接口
 *
 * @author code
 */
@RestController
@Slf4j
public class AiChatInfoApi {

    @Autowired
    private AiChatInfoService aiChatInfoService;
    @Autowired
    private ChatSetService chatSetService;

    @IgnoreAuth
    @ApiOperation(value = "获取聊天设置基础信息", tags = {"API-接口"})
    @PostMapping("/api/ai-chat/info")
    public Result<AiChatInfoOutput> getAiChatInfo(@RequestBody GetRandomLockImageInput input) {
        return Result.success(aiChatInfoService.getAiChatInfo(input.getUserId(), input.getAiId()));
    }

    @IgnoreAuth
    @ApiOperation(value = "获取聊天设置基础信息", tags = {"API-接口"})
    @PostMapping("/api/ai-chat/update-is-del-chatted")
    public Result<AiChatInfoOutput> updateIsDelChatted(@RequestBody UpdateIsDelChattedInput input) {
        chatSetService.updateIsDelChatted(input.getUserId(), input.getAiIdList());
        return Result.success();
    }

}

