package com.ningdatech.pmapi.dashboard.controller;

import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.dashboard.manage.DashboardExpertManage;
import com.ningdatech.pmapi.dashboard.manage.DashboardProjectManage;
import com.ningdatech.pmapi.dashboard.model.po.QueryYearPO;
import com.ningdatech.pmapi.dashboard.model.vo.DashboardInvestmentSummaryVO;
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectCntSummaryVO;
import com.ningdatech.pmapi.dashboard.model.vo.DashboardProjectSummaryVO;
import com.ningdatech.pmapi.dashboard.model.vo.ExpertDashboardSummaryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author liuxinxin
 * @date 2023/8/2 上午10:36
 */

@RestController
@RequestMapping("/api/v1/dashboard")
@Validated
@RequiredArgsConstructor
@Api(value = "DashboardController", tags = "驾驶舱相关接口")
public class DashboardController {

    private final DashboardExpertManage dashboardExpertManage;
    private final DashboardProjectManage dashboardProjectManage;

    @PostMapping("/expert-summary")
    @ApiOperation("专家驾驶舱统计数据")
    @WebLog("专家驾驶舱统计数据")
    public ExpertDashboardSummaryVO getExpertDashboardSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
        return dashboardExpertManage.getExpertDashboardSummary(queryYearPO);
    }

    @PostMapping("project-summary")
    @ApiOperation("驾驶舱项目总览")
    @WebLog("驾驶舱项目总览")
    public DashboardProjectSummaryVO getProjectSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
        return dashboardProjectManage.getProjectSummary(queryYearPO);
    }

    @PostMapping("project-cnt-summary")
    @ApiOperation("驾驶舱项目数量")
    @WebLog("驾驶舱项目数量")
    public DashboardProjectCntSummaryVO getProjectCntSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
        return dashboardProjectManage.getProjectCntSummary(queryYearPO);
    }

    @PostMapping("investment-summary")
    @ApiOperation("驾驶舱投资金额")
    @WebLog("驾驶舱投资金额")
    public DashboardInvestmentSummaryVO getInvestmentSummary(@Valid @RequestBody QueryYearPO queryYearPO) {
        return dashboardProjectManage.getInvestmentSummary(queryYearPO);
    }

}
