package com.easyproject.web.controller.aiModel;

import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.common.core.page.TableDataInfo;
import com.easyproject.system.domain.dto.AddKnowledgeDocumentDto;
import com.easyproject.system.domain.dto.KnowledgeDocListDto;
import com.easyproject.system.domain.dto.KnowledgeDocumentDto;
import com.easyproject.system.domain.dto.KnowledgeImageDto;
import com.easyproject.system.service.aiModel.IKnowledgeDocumentService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 方法说明: 知识库文件
 * @param
 * @return
 * @author java-101
 * @date 2025-03-25 23:03:03
 */
@RestController
@RequestMapping("/system/knowledgeDocument")
public class KnowledgeDocumentController extends BaseController{

    @Resource
    private IKnowledgeDocumentService knowledgeDocumentService;

    /**
     * 方法说明: 查询知识库文件列表
     * @param
     * @return
     * @author java-101
     * @date 2025-03-25 23:05:41
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:list')")
    @GetMapping("/list")
    public AjaxResult list(KnowledgeDocListDto dto) {
        return knowledgeDocumentService.getKnowledgeDocList(dto);
    }

    /**
     * 方法说明: 查询知识库图片列表
     * @param
     * @return
     * @author java-101
     * @date 2025-04-03 23:08:44
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:images')")
    @GetMapping("/datasetsImages")
    public AjaxResult datasetsImages(KnowledgeDocListDto dto) {
        return knowledgeDocumentService.datasetsImages(dto);
    }

    /**
     * 方法说明: 知识库文件-修改名称
     * @param
     * @return
     * @author java-101
     * @date 2025-04-04 19:16:36
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:updateName')")
    @PostMapping("/updateDocumentName")
    public AjaxResult updateDocumentName(@RequestBody KnowledgeDocumentDto dto) {
        return knowledgeDocumentService.updateDocumentName(dto);
    }

    /**
     * 方法说明: 知识库文件-添加文件
     * @param
     * @return
     * @author java-101
     * @date 2025-04-05 20:27:44
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:add')")
    @PostMapping("/addDocument")
    public AjaxResult addDocument(@RequestBody AddKnowledgeDocumentDto dto) {
        return knowledgeDocumentService.addDocument(dto);
    }

    /**
     * 方法说明: 知识库文件-删除文件
     * @param
     * @return
     * @author java-101
     * @date 2025-04-05 23:46:17
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:delete')")
    @PostMapping("/deleteDocument")
    public AjaxResult deleteDocument(@RequestBody KnowledgeDocumentDto dto) {
        return knowledgeDocumentService.deleteDocument(dto);
    }



    /**
     * 方法说明: 知识库文件-添加图片
     * @param
     * @return
     * @author java-101
     * @date 2025-04-05 20:27:44
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:add')")
    @PostMapping("/addImage")
    public AjaxResult addImage(@RequestBody AddKnowledgeDocumentDto dto) {
        return knowledgeDocumentService.addImage(dto);
    }

    /**
     * 方法说明: 知识库文件-修改图片描述
     * @param
     * @return
     * @author java-101
     * @date 2025-04-04 19:16:36
     */
    @PreAuthorize("@ss.hasPermi('system:knowledgeDocument:updateCaption')")
    @PostMapping("/updateImageCaption")
    public AjaxResult updateImageCaption(@RequestBody KnowledgeImageDto dto) {
        return knowledgeDocumentService.updateImageCaption(dto);
    }



}
