package cn.iocoder.yudao.module.llm.controller.admin.modelassesstaskmanual;

import cn.iocoder.yudao.module.llm.controller.admin.modelassesstaskmanual.manualAnnoVo.ManualModelAnnoPageReqVO;
import cn.iocoder.yudao.module.llm.controller.admin.modelassesstaskmanual.manualAnnoVo.ManualModelAnnoRespVO;
import cn.iocoder.yudao.module.llm.controller.admin.modelassesstaskmanual.manualAnnoVo.ManualModelAnnoSaveReqVO;
import cn.iocoder.yudao.module.llm.dal.dataobject.modelassesstaskmanual.ManualModelAnnoDO;
import cn.iocoder.yudao.module.llm.service.modelassesstaskmanual.ManualModelAnnoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;


@Tag(name = "管理后台 - 模型评估人工评估标注")
@RestController
@RequestMapping("/llm/manual-model-anno")
@Validated
public class ManualModelAnnoController {

    @Resource
    private ManualModelAnnoService manualModelAnnoService;


    /*@PostMapping("/create")
    @Operation(summary = "创建模型评估人工评估标注")
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:create')")
    public CommonResult<Long> createManualModelAnno(@Valid @RequestBody ManualModelAnnoSaveReqVO createReqVO) {
        return success(manualModelAnnoService.createManualModelAnno(createReqVO));
    }

    @PutMapping("/update")
    @Operation(summary = "更新模型评估人工评估标注")
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:update')")
    public CommonResult<Boolean> updateManualModelAnno(@Valid @RequestBody ManualModelAnnoSaveReqVO updateReqVO) {
        manualModelAnnoService.updateManualModelAnno(updateReqVO);
        return success(true);
    }

    @DeleteMapping("/delete")
    @Operation(summary = "删除模型评估人工评估标注")
    @Parameter(name = "id", description = "编号", required = true)
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:delete')")
    public CommonResult<Boolean> deleteManualModelAnno(@RequestParam("id") Long id) {
        manualModelAnnoService.deleteManualModelAnno(id);
        return success(true);
    }

    @GetMapping("/get")
    @Operation(summary = "获得模型评估人工评估标注")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:query')")
    public CommonResult<ManualModelAnnoRespVO> getManualModelAnno(@RequestParam("id") Long id) {
        ManualModelAnnoDO manualModelAnno = manualModelAnnoService.getManualModelAnno(id);
        return success(BeanUtils.toBean(manualModelAnno, ManualModelAnnoRespVO.class));
    }

    @GetMapping("/page")
    @Operation(summary = "获得模型评估人工评估标注分页")
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:query')")
    public CommonResult<PageResult<ManualModelAnnoRespVO>> getManualModelAnnoPage(@Valid ManualModelAnnoPageReqVO pageReqVO) {
        PageResult<ManualModelAnnoDO> pageResult = manualModelAnnoService.getManualModelAnnoPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, ManualModelAnnoRespVO.class));
    }

    @GetMapping("/export-excel")
    @Operation(summary = "导出模型评估人工评估标注 Excel")
    @PreAuthorize("@ss.hasPermission('llm:manual-model-anno:export')")
    @ApiAccessLog(operateType = EXPORT)
    public void exportManualModelAnnoExcel(@Valid ManualModelAnnoPageReqVO pageReqVO,
              HttpServletResponse response) throws IOException {
        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
        List<ManualModelAnnoDO> list = manualModelAnnoService.getManualModelAnnoPage(pageReqVO).getList();
        // 导出 Excel
        ExcelUtils.write(response, "模型评估人工评估标注.xls", "数据", ManualModelAnnoRespVO.class,
                        BeanUtils.toBean(list, ManualModelAnnoRespVO.class));
    }*/

}