package com.njcn.device.pms.controller.majornetwork;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pms.pojo.param.OverviewParam;
import com.njcn.device.pms.pojo.vo.DistributionMonitorVO;
import com.njcn.device.pms.pojo.vo.OverviewVO;
import com.njcn.device.pms.service.majornetwork.OverviewService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;
import java.util.Map;

/**
 * <分布式光伏概览>
 *
 * @author wr
 * @createTime: 2022-12-29
 */
@RestController
@RequestMapping("/overview")
@Slf4j
@Api(tags = "分布式光伏概览")
@RequiredArgsConstructor
public class OverviewController extends BaseController {

    private final OverviewService overviewService;


    @PostMapping("/getMapDisplay")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("监测点统计")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<OverviewVO> getMapDisplay(@RequestBody OverviewParam param) {
        String methodDescribe = getMethodDescribe("getMapDisplay");
        OverviewVO monitorYoY = overviewService.getMonitorYoY(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorYoY, methodDescribe);
    }

    @PostMapping("/getMonitorDistributed")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("监测点分布")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<Map<String, List<DistributionMonitorVO>>> getMonitorDistributed(@RequestBody OverviewParam param) {
        String methodDescribe = getMethodDescribe("getMonitorDistributed");
        Map<String, List<DistributionMonitorVO>> monitorDistributed = overviewService.getMonitorDistributed(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorDistributed, methodDescribe);
    }

}
