package com.hdkj.lt.bf.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdkj.lt.bf.entity.dto.CustomerPowerProtectionConfigDTO;
import com.hdkj.lt.bf.entity.dto.CustomerPowerProtectionConfigUpdateDTO;
import com.hdkj.lt.bf.entity.vo.CustomerPowerProtectionConfigVO;
import com.hdkj.lt.bf.service.ICustomerPowerProtectionConfigService;
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;

/**
 * <p>
 * 保电用户配置信息 前端控制器
 * </p>
 *
 * @author luorui
 * @since 2025-06-05
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/customerPowerProtectionConfig")
public class CustomerPowerProtectionConfigController extends BaseController {

    private final ICustomerPowerProtectionConfigService customerPowerProtectionConfigService;

    /**
     * 保电配置分页查询
     * @author luorui
     * @date 2025/6/5 14:17
     *
     *
     **/
    @PostMapping("/getConfigPage")
    @ApiOperation(value = "保电配置分页查询")
    public ApiResponse<Page<CustomerPowerProtectionConfigVO>> getConfigPage(@RequestBody CustomerPowerProtectionConfigDTO customerPowerProtectionConfigDTO) {
        return ApiResponse.success(customerPowerProtectionConfigService.getConfigPage(customerPowerProtectionConfigDTO));
    }

    /**
     * 批量修改/取消
     * @author luorui
     * @date 2025/6/5 14:17
     *
     **/
    @PostMapping("/batchUpdate")
    @ApiOperation(value = "保电配置分页查询")
    public ApiResponse<String> batchUpdate(@RequestBody CustomerPowerProtectionConfigUpdateDTO data) {
        customerPowerProtectionConfigService.batchUpdate(data);
        return ApiResponse.success("批量更新完成");
    }


    /**
     *初始化数据
     * @author luorui
     * @date 2025/6/5 14:17
     *
     **/
    @PostMapping("/initData")
    @ApiOperation(value = "初始化数据")
    public ApiResponse<String> initData() {
        customerPowerProtectionConfigService.initData();
        return ApiResponse.success("初始化数据完成");
    }
}
