package com.hdkj.lt.bf.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdkj.lt.core.bizms.modle.dto.SchemeQueryDTO;
import com.hdkj.lt.bf.entity.vo.*;
import com.hdkj.lt.bf.service.*;
import com.hdkj.lt.core.mvc.BaseController;
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;

/**
 * 停电计划转供方案检查查询
 *
 * @author zhuzhe
 * @since 2025-05-15
 */
@RestController
@RequestMapping("/fhzgPlanProcessStateCheck")
@RequiredArgsConstructor
public class FhzgPlanProcessStateCheckController extends BaseController {

    private final FhzgPlanProcessStateCheckService planProcessStateCheckService;

    /**
     * 接口9：停电计划转供方案过程态详情分页查询
     * @param dto
     * @return
     */
    @PostMapping("/getProcessStateList")
    @ApiOperation(value = "停电计划转供方案过程态详情分页查询")
    public ApiResponse<Page<ProcessStateVO>> getProcessStateList(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSchemeId() == null) {
            return fail("方案ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getProcessStateList(dto));
    }

    /**
     * 接口10：计划停电转供方案开关动作顺序分页查询
     * @param dto
     * @return
     */
    @PostMapping("/getSwitchingSequenceList")
    @ApiOperation(value = "计划停电转供方案开关动作顺序分页查询")
    public ApiResponse<Page<SwitchingSequenceVO>> getSwitchingSequenceList(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSchemeId() == null) {
            return fail("方案ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getSwitchingSequenceList(dto));
    }
    /**
     * 开关动作顺序查询合环校验明细
     * @param dto
     * @return
     */
    @PostMapping("/getSwitchCurrentDetail")
    @ApiOperation(value = "开关动作顺序查询合环校验明细")
    public ApiResponse<SwitchingLoopCheckVO> getSwitchCurrentDetail(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSwitchingId() == null) {
            return fail("开关动作ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getSwitchCurrentDetail(dto));
    }


    /**
     * 合环路径开关电流校验分页查询
     * @param dto
     * @return
     */
    @PostMapping("/getSwitchingLoopSwCurrentList")
    @ApiOperation(value = "合环路径开关电流校验分页查询")
    public ApiResponse<Page<SwitchingLoopSwVO>> getSwitchingLoopSwCurrentList(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSwitchingId() == null) {
            return fail("开关动作ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getSwitchingLoopSwCurrentList(dto));
    }

    /**
     * 合环路径导线电流校验分页查询
     * @param dto
     * @return
     */
    @PostMapping("/getSwitchingLoopSegCurrentList")
    @ApiOperation(value = "合环路径开关电流校验分页查询")
    public ApiResponse<Page<SwitchingLoopSegVO>> getSwitchingLoopSegCurrentList(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSwitchingId() == null) {
            return fail("开关动作ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getSwitchingLoopSegCurrentList(dto));
    }

    /**
     * 终态校验明细查询
     * @param dto
     * @return
     */
    @PostMapping("/getFinalStateCheckDetail")
    @ApiOperation(value = "终态校验明细查询")
    public ApiResponse<FinalStateCheckVO> getFinalStateCheckDetail(@RequestBody SchemeQueryDTO dto) {
        if (dto == null) {
            return fail("参数不能为空");
        }
        if (dto.getSwitchingId() == null) {
            return fail("开关动作ID不能为空");
        }
        return ApiResponse.success(planProcessStateCheckService.getFinalStateCheckDetail(dto));
    }

}
