package com.njcn.supervision.controller.gridDiagram;

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.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.supervision.service.gridDiagram.GridDiagramService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 com.njcn.supervision.pojo.vo.gridDiagram.GridDiagramVO;

import java.util.List;


/**
 * @author wr
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/gridDiagram")
@Api(tags = "冀北电网一张图信息展示")
@AllArgsConstructor
public class GridDiagramController extends BaseController {

    private final GridDiagramService gridDiagramService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSupervisionData")
    @ApiOperation("技术监督首页数据展示")
    public HttpResult<GridDiagramVO> getSupervisionData(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getSupervisionData");
        GridDiagramVO.Info supervisionData = gridDiagramService.getSupervisionData(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionData, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSupervisionDetailsData")
    @ApiOperation("技术监督详细页面展示")
    public HttpResult<List<GridDiagramVO.Info>> getSupervisionDetailsData(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getSupervisionDetailsData");
        List<GridDiagramVO.Info> supervisionData = gridDiagramService.getSupervisionDetailsData(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionData, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSupervisionCityDetailsData")
    @ApiOperation("技术监督市级详细页面展示")
    public HttpResult<GridDiagramVO.City> getSupervisionCityDetailsData(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getSupervisionCityDetailsData");
        GridDiagramVO.City supervisionData = gridDiagramService.getSupervisionCityDetailsData(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionData, methodDescribe);
    }
}
