package com.njcn.product.event.transientes.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.product.event.devcie.pojo.po.PqGdCompany;
import com.njcn.product.event.devcie.pojo.po.PqSubstation;
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
import com.njcn.product.event.transientes.pojo.po.*;
import com.njcn.product.event.transientes.pojo.vo.EventDetailVO;
import com.njcn.product.event.transientes.pojo.vo.UserLedgerStatisticVO;
import com.njcn.product.event.transientes.service.*;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
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.*;

import java.util.*;

/**
 * @Author: cdf
 * @CreateTime: 2025-06-23
 * @Description:
 */
@Api(tags = "暂降接收")
@RequestMapping("right")
@RestController
@RequiredArgsConstructor
@Slf4j
public class EventRightController extends BaseController {

    private final EventRightService eventRightService;


    @OperateInfo
    @PostMapping("/rightEvent")
    @ApiOperation("右侧表头")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightEvent(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightEvent");
        UserLedgerStatisticVO userLedgerStatisticVO = eventRightService.userLedgerStatisticClone(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userLedgerStatisticVO, methodDescribe);
    }


    @OperateInfo
    @PostMapping("/rightImportUser")
    @ApiOperation("右侧重要用户")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightImportUser(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightImportUser");
        List<UserLedgerStatisticVO.Inner> result = eventRightService.rightImportUser(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo
    @PostMapping("/rightEventOpen")
    @ApiOperation("右侧表头点击事件")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightEventOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightEventOpen");
        Page<PqUserLedgerPO> page = eventRightService.rightEventOpenClone(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

    @OperateInfo
    @PostMapping("/rightEventOpenClone")
    @ApiOperation("右侧表头点击事件")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightEventOpenClone(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightEventOpenClone");
        Page<EventDetailVO> page = eventRightService.rightEventOpen(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

    @OperateInfo
    @PostMapping("/rightEventOpenForDetail")
    @ApiOperation("右侧表头点击事件")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightEventOpenForDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightEventOpenForDetail");
        Page<EventDetailVO> page = eventRightService.rightEventOpenForDetail(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }



    @OperateInfo
    @PostMapping("/rightEventDevOpen")
    @ApiOperation("右侧表头终端点击事件")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightEventDevOpen(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightEventDevOpen");
        Page<PqUserLedgerPO> page = eventRightService.rightEventDevOpen(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }


    @OperateInfo
    @PostMapping("/rightImportOpenDetail")
    @ApiOperation("右侧表头终端点击事件")
    @ApiImplicitParam(name = "largeScreenCountParam", value = "", required = true)
    public HttpResult<Object> rightImportOpenDetail(@RequestBody LargeScreenCountParam largeScreenCountParam) {
        String methodDescribe = getMethodDescribe("rightImportOpenDetail");
        PqUserLedgerPO po = eventRightService.rightImportOpenDetail(largeScreenCountParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
    }


    @GetMapping("gdSelect")
    public HttpResult<List<PqGdCompany>> gdSelect() {
        String methodDescribe = getMethodDescribe("gdSelect");
        List<PqGdCompany> list = eventRightService.gdSelect();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }


    @GetMapping("bdSelect")
    public HttpResult<List<PqSubstation>> bdSelect() {
        String methodDescribe = getMethodDescribe("bdSelect");
        List<PqSubstation> list = eventRightService.bdSelect();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
