package com.hdkj.lt.bf.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdkj.lt.bf.entity.dto.*;
import com.hdkj.lt.bf.entity.vo.VolSchemeCheckNumVO;
import com.hdkj.lt.bf.service.voltageLimitViolation.FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailService;
import com.hdkj.lt.bf.service.voltageLimitViolation.FhzgLimitTransferSchemeSwitchingFinalSwCurrentDetailService;
import com.hdkj.lt.bf.service.voltageLimitViolation.FhzgVoltageLimitViolationPowerCutService;
import com.hdkj.lt.bf.service.voltageLimitViolation.FhzgVoltageLimitViolationTransferSchemeDetailService;
import com.hdkj.lt.bf.service.voltageLimitViolation.impl.FhzgInfoLimitTransferSchemeResultServiceImpl;
import com.hdkj.lt.core.bizms.modle.po.voltageLimitViolation.*;
import com.hdkj.lt.modle.dto.abnormal.SwitchDetailDTO;
import com.hdkj.hussar.ApiResponse;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;

@RestController
@RequiredArgsConstructor
@ApiOperation(value = "全口径低电压接口")
@RequestMapping("/voltageLimitViolation")
public class FhzgVoltageLimitViolationController {


    private final FhzgVoltageLimitViolationPowerCutService powerCutService;
    private final FhzgVoltageLimitViolationTransferSchemeDetailService schemeDetailService;

    private final FhzgLimitTransferSchemeSwitchingFinalSwCurrentDetailService switchingFinalSwCurrentDetailService;

    private final FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetailService switchingFinalSegCurrentDetailService;

    private final FhzgInfoLimitTransferSchemeResultServiceImpl fhzgInfoLimitTransferSchemeResultService;

    @PostMapping("/getVolPowerCutList")
    @ApiOperation(value = "成片电压越限列表查询接口")
    public ApiResponse<Page<FhzgVoltageLimitViolationPowerCut>> getVolPowerCutList(@RequestBody VolPowerCutDTO dto) {
        Page<FhzgVoltageLimitViolationPowerCut> result = powerCutService.getVolPowerCutList(dto);
        return ApiResponse.success(result);
    }

    @PostMapping("/getVolLimitDetail")
    @ApiOperation(value = "成片电压越限方案电压越限对比详情查询接口")
    public ApiResponse<List<FhzgVoltageLimitViolationTransferSchemeDetail>> getVolLimitDetail(@RequestBody VolLimitViolationSchemeDetailDTO dto) {
        List<FhzgVoltageLimitViolationTransferSchemeDetail> result = schemeDetailService.getVolLimitDetail(dto);
        return ApiResponse.success(result);
    }

    @PostMapping("/getVolLimitSchemeList")
    @ApiOperation(value = "成片电压越限方案电压越限方案列表接口")
    public ApiResponse<List<FhzgInfoLimitTransferScheme>> getVolLimitSchemeList(@RequestBody VolLimitViolationSchemeDetailDTO dto) {
        List<FhzgInfoLimitTransferScheme> result = schemeDetailService.getVolLimitSchemeList(dto);
        return ApiResponse.success(result);
    }

    @PostMapping("/getVolLimitSchemeLCheck")
    @ApiOperation(value = "成片电压越限方案校验数量获取")
    public ApiResponse<VolSchemeCheckNumVO> getVolLimitSchemeLCheck(@RequestBody VolLimitViolationSchemeDetailDTO dto) {
        VolSchemeCheckNumVO result = schemeDetailService.getVolLimitSchemeLCheck(dto);
        return ApiResponse.success(result);
    }

    @PostMapping("/getVolLimitSchemeTransferPathList")
    @ApiOperation(value = "成片电压越限转供路径细明列表")
    public ApiResponse<Page<FhzgLimitTransferSchemePathDetail>> getVolLimitSchemeTransferPathList(@RequestBody VolLimitViolationSchemeDetailDTO dto) {
        Page<FhzgLimitTransferSchemePathDetail> result = schemeDetailService.getVolLimitSchemeTransferPathList(dto);
        return ApiResponse.success(result);
    }


    @PostMapping("/getTransferSchemeFinalSwitchCurrentDetailByIdPage")
    @ApiOperation(value = "成片电压越限转供方案终态安全校验开关电流校验明细分页查询")
    public ApiResponse<Page<FhzgLimitTransferSchemeFinalSwitchCurrentDetailDTO>> getTransferSchemeFinalSwitchCurrentDetailByIdPage(@RequestBody FhzgLimitTransferSchemeSwitchingFinalSwCurrentDetail limitTransferSchemeSwitchingFinalSwCurrentDetail) {
        Page<FhzgLimitTransferSchemeFinalSwitchCurrentDetailDTO> page = switchingFinalSwCurrentDetailService.getTransferSchemeFinalSwitchCurrentDetailByIdPage(limitTransferSchemeSwitchingFinalSwCurrentDetail);
        return ApiResponse.success(page);
    }

    @PostMapping("/getTransferSchemeFinalSegmentCurrentDetailByIdPage")
    @ApiOperation(value = "成片电压越限转供方案终态安全校验导线电流校验明细分页查询")
    public ApiResponse<Page<FhzgLimitTransferSchemeFinalSegmentCurrentDetailDTO>> getTransferSchemeFinalSegmentCurrentDetailByIdPage(@RequestBody FhzgLimitTransferSchemeSwitchingFinalSegCurrentDetail limitTransferSchemeSwitchingFinalSegCurrentDetail) {
        Page<FhzgLimitTransferSchemeFinalSegmentCurrentDetailDTO> page =  switchingFinalSegCurrentDetailService.getTransferSchemeFinalSegmentCurrentDetailByIdPage(limitTransferSchemeSwitchingFinalSegCurrentDetail);
        return ApiResponse.success(page);
    }

    @PostMapping("/getSvgPquiDataLimit")
    @ApiOperation(value = "成片电压越限转供方案svg pqui数据")
    public ApiResponse<List<SwitchDetailDTO>> getSvgPquiDataLimit(@RequestBody OperationAbnormalityQueryDTO operationAbnormalityQueryDTO) {
        List<SwitchDetailDTO> svgPquiDataLimit = fhzgInfoLimitTransferSchemeResultService.getSvgPquiDataLimit(operationAbnormalityQueryDTO);
        return ApiResponse.success(svgPquiDataLimit);
    }

}
