package com.ruoyi.api;

import com.ruoyi.ai.domain.AiManager;
import com.ruoyi.ai.service.IAiManagerService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * AI管理Controller
 *
 * @author shi
 * @date 2025-11-13
 */
@Api(tags = "ai-AI管理列表")
@RestController
@RequestMapping("/api/manager")
public class AiManagerApiController extends BaseController {
    @Autowired
    private IAiManagerService aiManagerService;

    /**
     * 查询AI管理列表
     */
    @ApiOperation("查询AI列表")
    @GetMapping("/list")
    @Anonymous
    public TableDataInfo list(AiManager aiManager) {
        startPage();
        List<AiManager> list = aiManagerService.selectAiManagerList(aiManager);
        return getDataTable(list);
    }

    /**
     * 查询AI管理列表
     */
    @ApiOperation("查询AI功能信息")
    @GetMapping("/selectInfo")
    @Anonymous
    public AjaxResult selectInfo(String aiType) {
        AiManager aiManager = aiManagerService.selectAiManagerByType(aiType);
        aiManager.setPrompt(null);
        return AjaxResult.success(aiManager);
    }

}
