package com.sonic.frog.controller.web;

import com.sonic.common.auth.domains.Session;
import com.sonic.common.rpc.Page;
import com.sonic.common.rpc.Result;
import com.sonic.frog.domain.input.GiftDictListInput;
import com.sonic.frog.domain.output.AiDictOut;
import com.sonic.frog.domain.output.ChatModelDictOutput;
import com.sonic.frog.domain.output.GiftDictListOutput;
import com.sonic.frog.service.AiDictService;
import com.sonic.frog.service.ChatModelDictService;
import com.sonic.frog.service.GiftDictService;
import com.sonic.sdk.api.annotation.IgnoreAuth;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Web-Dict管理
 *
 * @author code
 */
@RestController
@Slf4j
public class AiDictWeb {

    @Autowired
    private AiDictService aiDictService;
    @Autowired
    private GiftDictService giftDictService;
    @Autowired
    private ChatModelDictService chatModelDictService;

    @ApiOperation(value = "获取AI字典信息", tags = {"Web-AI字典"})
    @PostMapping("/web/get-ai-dict")
    @IgnoreAuth
    public Result<AiDictOut> getAiDict(@ApiParam(hidden = true) Session session) {
        return Result.success(aiDictService.getAiDict());
    }

    @ApiOperation(value = "获取礼物字典列表", tags = {"Web-AI字典"})
    @PostMapping("/web/gift/dict-list")
    @IgnoreAuth
    public Result<Page<GiftDictListOutput>> getGiftDictList(@Validated @RequestBody GiftDictListInput input, @ApiParam(hidden = true) Session session) {
        return Result.success(giftDictService.getGiftDictList(input));
    }

    @ApiOperation(value = "获取对话模型字典列表", tags = {"Web-AI字典"})
    @PostMapping("/web/chat-model/dict-list")
    @IgnoreAuth
    public Result<ChatModelDictOutput> getChatModelDictList(@ApiParam(hidden = true) Session session) {
        return Result.success(chatModelDictService.getChatModelDictList());
    }
}
