package com.hz.pm.api.performance.controller;

import com.hz.pm.api.performance.manage.AppAppraisalManage;
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO;
import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq;
import com.hz.pm.api.performance.model.vo.AppAppraisalIndexDetailVO;
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalAppVO;
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.log.annotation.WebLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * ReAppraisalController
 * @return
 * @author CMM
 * @since 2023/08/10 8:54
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "绩效评价-应用评价")
@RequestMapping("/api/v1/app-appraisal")
public class AppAppraisalController {

    private final AppAppraisalManage appAppraisalManage;

    @GetMapping("/list")
    @ApiOperation("当前复评用户的应用绩效评价计划列表")
    public PageVo<PerformanceAppraisalVO> list(PerformanceAppraisalListReq req) {
        return appAppraisalManage.list(req);
    }

    @GetMapping("/unEvaluate-list/{planId}")
    @ApiOperation("当前绩效评价应用待评价列表")
    public PageVo<PerformanceAppraisalAppVO> unEvaluateList(@PathVariable Long planId, PerformanceAppraisalListReq req) {
        return appAppraisalManage.unEvaluateList(planId,req);
    }

    @GetMapping("/evaluated-list/{planId}")
    @ApiOperation("当前绩效评价应用已评价列表")
    public PageVo<PerformanceAppraisalAppVO> evaluatedList(@PathVariable Long planId, PerformanceAppraisalListReq req) {
        return appAppraisalManage.evaluatedList(planId,req);
    }

    @GetMapping("/detail/{planId}/{appId}")
    @ApiOperation("获取详情")
    public AppAppraisalIndexDetailVO detail(@PathVariable Long planId,@PathVariable Long appId){
        return appAppraisalManage.detail(planId,appId);
    }

    @PostMapping("/save")
    @ApiOperation("保存分数")
    @WebLog(value = "保存分数",modular = "绩效评价-应用评价")
    public String saveAppraisal(@Valid @RequestBody ProjectAppraisalDTO param){
        return appAppraisalManage.saveAppraisal(param);
    }

}
