package com.zsElectric.boot.business.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zsElectric.boot.charging.model.query.ThirdPartyStationInfoQuery;
import com.zsElectric.boot.charging.model.query.ThirdPartyEquipmentInfoQuery;
import com.zsElectric.boot.charging.model.vo.ThirdPartyStationInfoVO;
import com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO;
import com.zsElectric.boot.charging.service.ThirdPartyStationInfoService;
import com.zsElectric.boot.charging.service.ThirdPartyEquipmentInfoService;
import com.zsElectric.boot.common.annotation.Log;
import com.zsElectric.boot.common.enums.LogModuleEnum;
import com.zsElectric.boot.core.web.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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 system
 * @since 2025-12-11
 */
@Tag(name = "第三方充电站/充电桩信息查询接口")
@RestController
@RequestMapping("/api/v1/third-party-charging")
@RequiredArgsConstructor
public class ThirdPartyChargingController {

    private final ThirdPartyStationInfoService stationInfoService;
    private final ThirdPartyEquipmentInfoService equipmentInfoService;

    @Operation(summary = "充电站信息分页列表")
    @PostMapping("/stations/page")
    @Log(value = "充电站信息分页列表", module = LogModuleEnum.OTHER)
    public PageResult<ThirdPartyStationInfoVO> getStationInfoPage(@RequestBody ThirdPartyStationInfoQuery queryParams) {
        IPage<ThirdPartyStationInfoVO> result = stationInfoService.getStationInfoPage(queryParams);
        return PageResult.success(result);
    }

    @Operation(summary = "充电桩信息分页列表")
    @PostMapping("/equipments/page")
    @Log(value = "充电桩信息分页列表", module = LogModuleEnum.OTHER)
    public PageResult<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(@RequestBody ThirdPartyEquipmentInfoQuery queryParams) {
        IPage<ThirdPartyEquipmentInfoVO> result = equipmentInfoService.getEquipmentInfoPage(queryParams);
        return PageResult.success(result);
    }
}
