package com.vetti.web.controller.hotake;

import com.vetti.common.annotation.Log;
import com.vetti.common.core.controller.BaseController;
import com.vetti.common.core.domain.R;
import com.vetti.common.core.page.TableWebDataInfo;
import com.vetti.common.enums.BusinessType;
import com.vetti.common.utils.SecurityUtils;
import com.vetti.hotake.domain.HotakeRolesApplyInfo;
import com.vetti.hotake.domain.dto.HotakeRolesApplyStageStatisticalDto;
import com.vetti.hotake.domain.vo.HotakeRolesApplyStageVo;
import com.vetti.hotake.service.IHotakeRolesApplyInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 候选人岗位申请信息Controller
 * 
 * @author wangxiangshun
 * @date 2025-12-17
 */
@Api(tags ="候选人岗位申请信息")
@RestController
@RequestMapping("/hotake/rolesApplyInfo")
public class HotakeRolesApplyInfoController extends BaseController
{
    @Autowired
    private IHotakeRolesApplyInfoService hotakeRolesApplyInfoService;

    /**
     * 查询候选人岗位申请信息列表
     */
    @ApiOperation("查询候选人岗位申请信息列表")
    @GetMapping("/getPageList")
    public TableWebDataInfo<HotakeRolesApplyInfo> pageList(HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        startPage();
        //招聘人列表数据
        hotakeRolesApplyInfo.setRecruiterId(SecurityUtils.getUserId());
        List<HotakeRolesApplyInfo> list = hotakeRolesApplyInfoService.selectHotakeRolesApplyInfoList(hotakeRolesApplyInfo);
        return getWebDataTable(list);
    }

    /**
     * 查询候选人岗位申请信息列表
     */
    @ApiOperation("查询候选人岗位申请信息列表(无分页)")
    @GetMapping("/getList")
    public R<List<HotakeRolesApplyInfo>> list(HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        List<HotakeRolesApplyInfo> list = hotakeRolesApplyInfoService.selectHotakeRolesApplyInfoList(hotakeRolesApplyInfo);
        return R.ok(list,"");
    }

    /**
     * 获取候选人岗位申请信息详细信息
     */
    @ApiOperation("获取候选人岗位申请信息详细信息")
    @GetMapping(value = "/{id}")
    public R<HotakeRolesApplyInfo> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(hotakeRolesApplyInfoService.selectHotakeRolesApplyInfoById(id),"");
    }

    /**
     * 新增候选人岗位申请信息
     */
    @ApiOperation("新增候选人岗位申请信息")
    @Log(title = "候选人岗位申请信息", businessType = BusinessType.INSERT)
    @PostMapping
    public R<HotakeRolesApplyInfo> add(@RequestBody HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        return R.ok(hotakeRolesApplyInfoService.insertHotakeRolesApplyInfo(hotakeRolesApplyInfo));
    }

    /**
     * 修改候选人岗位申请信息
     */
    @ApiOperation("修改候选人岗位申请信息")
    @Log(title = "候选人岗位申请信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<HotakeRolesApplyInfo> edit(@RequestBody HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        return R.ok(hotakeRolesApplyInfoService.updateHotakeRolesApplyInfo(hotakeRolesApplyInfo));
    }

    /**
     * 删除候选人岗位申请信息
     */
    @ApiOperation("删除候选人岗位申请信息")
    @Log(title = "删除候选人岗位申请信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<?> remove(@PathVariable Long[] ids)
    {
        return R.ok(hotakeRolesApplyInfoService.deleteHotakeRolesApplyInfoByIds(ids));
    }

    /**
     * 批量修改候选人岗位申请信息所属阶段
     */
    @ApiOperation("批量修改候选人岗位申请信息所属阶段")
    @Log(title = "批量修改候选人岗位申请信息所属阶段", businessType = BusinessType.UPDATE)
    @PutMapping("/batchEditStage")
    public R<?> batchEditStage(@RequestBody List<HotakeRolesApplyStageVo> stageVoList)
    {
        hotakeRolesApplyInfoService.updateBatchEditStage(stageVoList);
        return R.ok();
    }

    /**
     * AI简历评分和排名系统
     */
    @ApiOperation("AI简历评分和排名系统")
    @PostMapping("/aiCvScoringRankingList")
    public R<List<HotakeRolesApplyInfo>> getAiCvScoringRankingList(@RequestBody HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        List<HotakeRolesApplyInfo> list = hotakeRolesApplyInfoService.handleAiCvScoringRankingList(hotakeRolesApplyInfo);
        return R.ok(list,"");
    }

    /**
     * 招聘者查看候选人匹配度
     */
    @ApiOperation("招聘者查看候选人匹配度")
    @PostMapping("/candidateCompatibilityInfo")
    public R<HotakeRolesApplyInfo> getCandidateCompatibilityInfo(@RequestBody HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        HotakeRolesApplyInfo info = hotakeRolesApplyInfoService.handleCandidateCompatibilityInfo(hotakeRolesApplyInfo);
        return R.ok(info,"");
    }

    /**
     * 岗位申请数据根据当前阶段进行统计
     */
    @ApiOperation("岗位申请数据根据当前阶段进行统计")
    @GetMapping("/getStageStatistical")
    public R<HotakeRolesApplyStageStatisticalDto> handleStageStatistical(HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        HotakeRolesApplyStageStatisticalDto info = hotakeRolesApplyInfoService.handleHotakeRolesApplyStageStatistical(hotakeRolesApplyInfo);
        return R.ok(info,"");
    }

    /**
     * 候选人面试综合评估
     */
    @ApiOperation("候选人面试综合评估")
    @PostMapping("/candidateInterviewEvaluation")
    public R<HotakeRolesApplyInfo> getCandidateInterviewEvaluation(@RequestBody HotakeRolesApplyInfo hotakeRolesApplyInfo)
    {
        HotakeRolesApplyInfo info = hotakeRolesApplyInfoService.handleCandidateInterviewEvaluation(hotakeRolesApplyInfo);
        return R.ok(info,"");
    }
}
