package com.njcn.device.pq.controller;

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.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
import com.njcn.device.pq.pojo.vo.OldTimeVO;
import com.njcn.device.pq.service.LargeScreenService;
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.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;

/**
 * @version 1.0.0
 * @author: zbj
 * @date: 2023/03/21
 */
@Slf4j
@Api(tags = "大屏监测点规模")
@RestController
@RequestMapping("/largeScreen")
@RequiredArgsConstructor
public class LargeScreenController extends BaseController {

    private final LargeScreenService largeScreenService;

    /**
     * 监测点规模
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMonitoringPointScale")
    @ApiOperation("监测点规模(区域)")
    @ApiImplicitParam(name = "largeScreenParam", value = "监测点规模(区域)", required = true)
    public HttpResult<MonitoringPointScaleVO> getMonitoringPointScale(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getMonitoringPointScale");
        MonitoringPointScaleVO result = largeScreenService.getMonitoringPointScale(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 监测点规模
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLoadType")
    @ApiOperation("监测点规模(负荷类型)")
    @ApiImplicitParam(name = "largeScreenParam", value = "监测点规模(负荷类型)", required = true)
    public HttpResult<MonitoringPointScaleVO> getLoadType(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getLoadType");
        MonitoringPointScaleVO result = largeScreenService.getLoadType(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 运行时间
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getRunTime")
    @ApiOperation("运行时间")
    public HttpResult<OldTimeVO> getRunTime() {
        String methodDescribe = getMethodDescribe("getRunTime");
        OldTimeVO result = largeScreenService.getRunTime();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
