package com.pavis.admin.controller.aigc;

import com.pavis.admin.aigc.model.entity.AgentKnowledgeDO;
import com.pavis.admin.aigc.model.entity.KnowledgeDO;
import com.pavis.admin.aigc.model.entity.ToolDO;
import com.pavis.admin.aigc.model.req.AgentToolReq;
import io.swagger.v3.oas.annotations.Operation;
import top.continew.starter.extension.crud.enums.Api;

import io.swagger.v3.oas.annotations.tags.Tag;

import org.springframework.web.bind.annotation.*;

import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import com.pavis.admin.common.controller.BaseController;
import com.pavis.admin.aigc.model.query.AgentQuery;
import com.pavis.admin.aigc.model.req.AgentReq;
import com.pavis.admin.aigc.model.resp.AgentDetailResp;
import com.pavis.admin.aigc.model.resp.AgentResp;
import com.pavis.admin.aigc.service.AgentService;

import java.util.List;

/**
 * 智能体管理 API
 *
 * @author semi
 * @since 2025/05/26 17:28
 */
@Tag(name = "AIGC智能体管理 API")
@RestController
@CrudRequestMapping(value = "/aigc/agent", api = {Api.PAGE, Api.GET, Api.CREATE, Api.UPDATE, Api.DELETE, Api.EXPORT})
public class AgentController extends BaseController<AgentService, AgentResp, AgentDetailResp, AgentQuery, AgentReq> {
    @Operation(summary = "根据智能体ID获取关联知识库Know", description = "根据智能体ID获取关联知识库Know")
    @PostMapping(value = "/selAgentKnowList/{agentId}")
    public KnowledgeDO selAgentKnowList(@PathVariable Long agentId) {
        return baseService.selAgentKnowList(agentId);
    }

    @Operation(summary = "根据智能体ID获取关联工具tool", description = "根据智能体ID获取关联工具tool")
    @PostMapping(value = "/selTool/{agentId}")
    public List<ToolDO> selTool(@PathVariable Long agentId) {
        return baseService.selTool(agentId);
    }

    @Operation(summary = "根据工具ID删除智能体关联工具tool", description = "根据工具ID删除智能体关联工具tool")
    @PostMapping(value = "/delToolToAgent")
    public void delToolToAgent(@RequestBody AgentToolReq agentToolReq) {
        baseService.delToolToAgent(agentToolReq);
    }
}