package com.microservices.dms.referral.controller;

import com.microservices.common.core.web.domain.AjaxResult;
import com.microservices.dms.referral.service.TalentReferralService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Data
@Api(tags = "数据管理体系-推荐接口")
@RestController
@RequestMapping("/talentReferral")
@RequiredArgsConstructor
public class TalentReferralController {

    private final TalentReferralService talentReferralService;

    @GetMapping("/issueTalentReferral")
    @ApiOperation(value = "疑修人才推荐")
    public AjaxResult issueTalentReferral(@RequestParam("issueId") Long issueId, @RequestParam("projectId") Long projectId) {
        return AjaxResult.success(talentReferralService.doIssueTalentReferral(issueId, projectId));
    }

    @GetMapping("/pullRequestTalentReferral")
    @ApiOperation(value = "PR人才推荐")
    public AjaxResult pullRequestTalentReferral(@RequestParam("prId") Long prId, @RequestParam("projectId") Long projectId) {
        return AjaxResult.success(talentReferralService.doPRTalentReferral(prId, projectId));
    }

    @GetMapping("/taskAchievementTalentReferral")
    @ApiOperation(value = "任务成果推荐")
    public AjaxResult taskAchievementTalentReferral(@RequestParam("taskId") Long taskId) {
        return AjaxResult.success(talentReferralService.taskAchievementTalentReferral(taskId));
    }

    @GetMapping("/taskExpertTalentReferral")
    @ApiOperation(value = "任务专家推荐")
    public AjaxResult taskExpertTalentReferral(@RequestParam("taskId") Long taskId) {
        return AjaxResult.success(talentReferralService.taskExpertTalentReferral(taskId));
    }


    @GetMapping("/competitionExpertTalentReferral")
    @ApiOperation(value = "竞赛专家推荐")
    public AjaxResult competitionExpertTalentReferral(@RequestParam("competitionId") Long competitionId) {
        return AjaxResult.success(talentReferralService.competitionExpertTalentReferral(competitionId));
    }


}
