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.AjaxResult;
import com.vetti.common.core.domain.R;
import com.vetti.common.core.page.TableDataInfo;
import com.vetti.common.core.page.TableWebDataInfo;
import com.vetti.common.enums.BusinessType;
import com.vetti.common.utils.poi.ExcelUtil;
import com.vetti.hotake.domain.HotakeCvInfo;
import com.vetti.hotake.service.IHotakeCvInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 简历信息Controller
 * 
 * @author wangxiangshun
 * @date 2025-11-02
 */
@Api(tags ="简历信息")
@RestController
@RequestMapping("/hotake/cvInfo")
public class HotakeCvInfoController extends BaseController
{
    @Autowired
    private IHotakeCvInfoService hotakeCvInfoService;

    /**
     * 查询简历信息列表
     */
    @ApiOperation("查询简历信息列表(分页)")
    @GetMapping("/getPagelist")
    public TableWebDataInfo<HotakeCvInfo> list(HotakeCvInfo hotakeCvInfo)
    {
        startPage();
        List<HotakeCvInfo> list = hotakeCvInfoService.selectHotakeCvInfoList(hotakeCvInfo);
        return getWebDataTable(list);
    }

    /**
     * 查询简历信息列表
     */
    @ApiOperation("查询简历信息列表(无分页)")
    @GetMapping("/getList")
    public R<List<HotakeCvInfo>> getList(HotakeCvInfo hotakeCvInfo)
    {
        List<HotakeCvInfo> list = hotakeCvInfoService.selectHotakeCvInfoList(hotakeCvInfo);
        return R.ok(list,"");
    }

    /**
     * 获取简历信息详细信息
     */
    @ApiOperation("获取简历信息详细信息")
    @GetMapping(value = "/{id}")
    public R<HotakeCvInfo> getInfo(@ApiParam("简历ID") @PathVariable("id") Long id)
    {
        return R.ok(hotakeCvInfoService.selectHotakeCvInfoById(id),"");
    }

    /**
     * 新增简历信息
     */
    @ApiOperation("新增简历信息")
    @Log(title = "简历信息", businessType = BusinessType.INSERT)
    @PostMapping
    public R<HotakeCvInfo> add(@RequestBody HotakeCvInfo hotakeCvInfo)
    {
        return R.ok(hotakeCvInfoService.insertHotakeCvInfo(hotakeCvInfo));
    }

    /**
     * 修改简历信息
     */
    @ApiOperation("修改简历信息")
    @Log(title = "简历信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<HotakeCvInfo> edit(@RequestBody HotakeCvInfo hotakeCvInfo)
    {
        return R.ok(hotakeCvInfoService.updateHotakeCvInfo(hotakeCvInfo));
    }

    /**
     * 删除简历信息
     */
    @ApiOperation("删除简历信息")
    @Log(title = "简历信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public R remove(@PathVariable Long id)
    {
        return R.ok(hotakeCvInfoService.deleteHotakeCvInfoById(id));
    }


    /**
     * 简历解析以及生成问题和评分
     */
    @ApiOperation("简历解析以及生成问题和评分")
    @Log(title = "简历解析以及生成问题和评分", businessType = BusinessType.INSERT)
    @PostMapping("/analysis")
    public R<HotakeCvInfo> handleCvAnalysis(@RequestBody HotakeCvInfo hotakeCvInfo)
    {
        return R.ok(hotakeCvInfoService.handleCvAnalysis(hotakeCvInfo));
    }

    /**
     *  根据其他的附件信息生成个人简历
     */
    @ApiOperation("根据其他的附件信息生成个人简历")
    @Log(title = "根据其他的附件信息生成个人简历", businessType = BusinessType.INSERT)
    @PostMapping("/generateResume")
    public R<HotakeCvInfo> handleGenerateResume()
    {
        return R.ok(hotakeCvInfoService.getGenerateResume());
    }

}
