package com.vetti.web.controller.ai;

import com.vetti.common.core.controller.BaseController;
import com.vetti.common.core.domain.R;
import com.vetti.hotake.domain.HotakeAiInterviewQuestionsInfo;
import com.vetti.hotake.domain.HotakeInitialScreeningQuestionsInfo;
import com.vetti.hotake.domain.HotakeRolesInfo;
import com.vetti.hotake.domain.dto.*;
import com.vetti.hotake.domain.vo.*;
import com.vetti.hotake.service.IHotakeAiCommonToolsService;
import com.vetti.web.entity.vo.HotakeAiInterviewScoringVo;
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;

/**
 * AI共通工具 信息Controller
 *
 * @author wangxiangshun
 * @date 2025-12-14
 */
@Api(tags ="AI共通工具信息")
@RestController
@RequestMapping("/hotake/aiCommonTools")
public class HotakeAiCommonToolsController extends BaseController {

    @Autowired
    private IHotakeAiCommonToolsService hotakeAiCommonToolsService;


    /**
     * 职位描述生成器
     */
    @ApiOperation("职位描述生成器")
    @PostMapping(value = "/jobDescriptionGenerator")
    public R<HotakeJobDescriptionGeneratorDto> handleJobDescriptionGenerator(@RequestBody HotakeJobDescriptionGeneratorVo jobDescriptionGeneratorVo)
    {
        return R.ok(hotakeAiCommonToolsService.getJobDescriptionGenerator(jobDescriptionGeneratorVo.getRoleId()));
    }

    /**
     * 初筛问题生成
     */
    @ApiOperation("初筛问题生成")
    @PostMapping(value = "/initialScreeningQuestionsGenerator")
    public R<List<HotakeInitialScreeningQuestionsInfo>> handleInitialScreeningQuestions(@RequestBody HotakeInitialScreeningQuestionsVo questionsVo)
    {
        return R.ok(hotakeAiCommonToolsService.getInitialScreeningQuestionsGenerator(questionsVo));
    }

    /**
     * 简历岗位匹配度评分
     */
    @ApiOperation("简历岗位匹配度评分")
    @PostMapping(value = "/resumeJobMatchingScore")
    public R<?> handleResumeJobMatchingScore(@RequestBody HotakeResumeJobMatchingScoreVo scoreVo)
    {
        return R.ok(hotakeAiCommonToolsService.getResumeJobMatchingScore(scoreVo));
    }

    /**
     * 简历分析优化器
     */
    @ApiOperation("简历分析优化器")
    @GetMapping(value = "/resumeAnalysisOptimizer")
    public R<HotakeCvOptimizeDto> handleResumeAnalysisOptimizer()
    {
        return R.ok(hotakeAiCommonToolsService.getResumeAnalysisOptimizer(""));
    }

    /**
     * 初步筛选问题淘汰评分
     */
    @ApiOperation("初步筛选问题淘汰评分")
    @GetMapping(value = "/initialQuestionEliminationScore")
    public R<HotakeInitialQuestionEliminationScoreDto> handleInitialQuestionEliminationScore()
    {
        return R.ok(hotakeAiCommonToolsService.getInitialQuestionEliminationScore(null));
    }

    /**
     * 处理分析附件结果
     */
    @ApiOperation("处理分析附件结果")
    @GetMapping(value = "/analyzedAttachment")
    public R<?> handleAnalyzedAttachment()
    {
        return R.ok(hotakeAiCommonToolsService.handleAnalyzedAttachment(""));
    }

    /**
     * 处理附件分析结果合并信息
     */
    @ApiOperation("处理附件分析结果合并信息")
    @GetMapping(value = "/attachmentResultMerging")
    public R<?> handleAttachmentResultMerging()
    {
        return R.ok(hotakeAiCommonToolsService.handleAttachmentResultMerging("",""));
    }

    /**
     * 生成最终的Markdown格式简历
     */
    @ApiOperation("生成最终的Markdown格式简历")
    @GetMapping(value = "/generateMarkdown")
    public R<?> handleGenerateMarkdown()
    {
        return R.ok(hotakeAiCommonToolsService.handleGenerateMarkdown(""));
    }

    /**
     * 网站内容抓取
     */
    @ApiOperation("网站内容抓取")
    @PostMapping(value = "/webContentScraping")
    public R<?> handleWebContentScraping(@RequestBody HotakeWebInfoExtractVo webInfoExtractVo)
    {
        return R.ok(hotakeAiCommonToolsService.handleWebContentScraping(webInfoExtractVo.getWebUrl()));
    }


    /**
     * 网站AI信息提取（使用提示词）
     */
    @ApiOperation("网站AI信息提取（使用提示词）")
    @PostMapping(value = "/webInfoExtract")
    public R<?> handleWebInfoExtract(@RequestBody HotakeWebInfoExtractVo webInfoExtractVo)
    {
        hotakeAiCommonToolsService.handleWebInfoExtract(webInfoExtractVo);
        return R.ok();
    }

    /**
     * 个人简介生成器
     */
    @ApiOperation("个人简介生成器")
    @PostMapping(value = "/personalProfileGenerator")
    public R<HotakePersonalProfileGeneratorDto> handlePersonalProfileGenerator(@RequestBody HotakePersonalProfileGeneratorVo personalProfileGeneratorVo)
    {
        return R.ok(hotakeAiCommonToolsService.getPersonalProfileGenerator(personalProfileGeneratorVo));
    }

    /**
     * 工作经验生成器
     */
    @ApiOperation("工作经验生成器")
    @PostMapping(value = "/workExperienceGenerator")
    public R<HotakeWorkExperienceGeneratorDto> handleWorkExperienceGenerator(@RequestBody HotakeWorkExperienceGeneratorVo workExperienceGeneratorVo)
    {
        return R.ok(hotakeAiCommonToolsService.getWorkExperienceGenerator(workExperienceGeneratorVo));
    }

    /**
     * 招聘链接信息分析补全（使用提示词）
     */
    @ApiOperation("招聘链接信息分析补全（使用提示词）")
    @PostMapping(value = "/roleLinkAnalysis")
    public R<HotakeRolesInfoDto> handleRoleLinkAnalysis(@RequestBody HotakeRoleLinkAnalysisVo roleLinkAnalysisVo)
    {
        return R.ok(hotakeAiCommonToolsService.getRoleLinkAnalysis(roleLinkAnalysisVo));
    }

    /**
     * 招聘信息分析补全
     */
    @ApiOperation("招聘信息分析补全（按照步骤生成）")
    @PostMapping(value = "/roleInfoAnalysisSetUp")
    public R<HotakeRolesInfoDto> handleRoleInfoAnalysisSetUp(@RequestBody HotakeRolesInfoDto rolesInfoDto)
    {
        return R.ok(hotakeAiCommonToolsService.getRoleInfoAnalysisSetUp(rolesInfoDto));
    }

    /**
     * AI面试问题生成
     */
    @ApiOperation("AI面试问题生成")
    @PostMapping(value = "/aiInterviewQuestions")
    public R<HotakeAiInterviewQuestionsInfo> handleAiInterviewQuestions(@RequestBody HotakeRolesInfo rolesInfo)
    {
        return R.ok(hotakeAiCommonToolsService.getAiInterviewQuestions(rolesInfo));
    }

    /**
     * 候选人AI面试分析
     */
    @ApiOperation("候选人AI面试分析")
    @PostMapping(value = "/candidateAiInterviewAnalysis")
    public R<HotakeCandidateAiInterviewAnalysisDto> candidateAiInterviewAnalysis(@RequestBody HotakeCandidateAiInterviewAnalysisVo analysisVo)
    {
        return R.ok(hotakeAiCommonToolsService.handleCandidateAiInterviewAnalysis(analysisVo));
    }

    /**
     * 招聘者 AI简历评分和排名系统
     */
    @ApiOperation("招聘者 AI简历评分和排名系统")
    @PostMapping(value = "/aiCvScoringRanking")
    public R<HotakeAiCvScoringRankingDto> aiCvScoringRanking(@RequestBody HotakeAiCvScoringRankingRoleApplyVo roleApplyVo)
    {
        return R.ok(hotakeAiCommonToolsService.handleAiCvScoringRanking(roleApplyVo));
    }

    /**
     * 招聘者查看候选人匹配度
     */
    @ApiOperation("招聘者查看候选人匹配度")
    @PostMapping(value = "/candidateCompatibility")
    public R<HotakeCandidateCompatibilityDto> candidateCompatibility(@RequestBody HotakeCandidateCompatibilityVo compatibilityVo)
    {
        return R.ok(hotakeAiCommonToolsService.handleCandidateCompatibility(compatibilityVo));
    }

    /**
     * 候选人面试综合评估
     */
    @ApiOperation("候选人面试综合评估")
    @PostMapping(value = "/candidateInterviewEvaluation")
    public R<HotakeCandidateInterviewEvaluationDto> candidateInterviewEvaluation(@RequestBody HotakeCandidateInterviewEvaluationVo evaluationVo)
    {
        return R.ok(hotakeAiCommonToolsService.getCandidateInterviewEvaluation(evaluationVo));
    }
}
