package com.xhpc.common.api;

import com.xhpc.common.api.factory.PowerPileFallbackFactory;
import com.xhpc.common.core.constant.ServiceNameConstants;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.data.down.StartChargingData;
import com.xhpc.common.data.redis.CacheRateModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

@FeignClient(contextId = "powerPileService", value = ServiceNameConstants.PILE_SERVICE, fallbackFactory =
        PowerPileFallbackFactory.class)
public interface PowerPileService {

    //    @PreAuthorize(hasPermi = "user:privilege:add") todo
    @PostMapping("/charging/start")
    R startCharging(@Validated @RequestBody StartChargingData startChargingData);


    @PostMapping("/charging/capacity/start")
    R startChargingCapacity(@Validated @RequestBody StartChargingData startChargingData);


    @PostMapping("/charging/balance/refresh")
    R refreshBalance(@Validated @RequestBody StartChargingData balanceRefreshData);

    @PutMapping("charging/stop/{orderNo}/{pileNo}/{connectorId}/{version}")
    R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo,
                   @PathVariable("connectorId") String connectorId, @PathVariable("version") String version);

    @PostMapping("/pile/whitelist/add/{stationId}/{version}")
    R addPileWhitelist(@PathVariable("stationId") Long stationId,
                       @PathVariable("version") String version,
                       @RequestBody Set<String> pileNoSet);

    @DeleteMapping("/pile/whitelist/delete/{stationId}")
    R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set<String> pileNoSet);

    @PostMapping("/station/rateModel/{stationId}/{rateModelId}")
    R setStationRateModel(@PathVariable("stationId") @Param("stationId") Long stationId,
                          @PathVariable("rateModelId") @Param("rateModelId") Long rateModelId,
                          @RequestBody @Param("rateModel") CacheRateModel rateModel);

    @PostMapping("/pile/{pileNo}/timeNRateModel")
    R configTimeNRateModel(@PathVariable("pileNo") String pileNo);


    @PostMapping("/pile/{pileNo}/softwareUpgrade")
    R pileSoftwareUpgrade(@PathVariable("pileNo") String pileNo);


    @PostMapping("/pile/{pileNo}/reboot")
    R pileReboot(@PathVariable("pileNo") String pileNo);

    //整合场站数据
    @GetMapping("/station/getNotificationStationInfo")
    R getNotificationStationInfo(@RequestParam("stationId") Long stationId);

    //生成场站推送数据信息
    @GetMapping("/station/addNotificationStationInfo")
    R addNotificationStationInfo(@RequestParam("stationId") Long stationId);


    //查询统计信息(成都市平台调用我们平台)
    @GetMapping("/station/queryStationStats")
    R queryStationStats(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);

    //查询充电设备运行统计计信息
    @GetMapping("/station/querySupEquipmentStatsInfo")
    R querySupEquipmentStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);

    //查询充电设备接口运行统计计信息
    @GetMapping("/station/queryConnectorStatsInfo")
    R queryConnectorStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);

    //查询费率变化
    @GetMapping("/station/getNotificationStationFee")
    R getNotificationStationFee(@RequestParam("stationId") Long stationId);

    //查询充电站功率统信息
    @GetMapping("/station/getSuperviseQueryStationPowerInfo")
    R getSuperviseQueryStationPowerInfo(@RequestParam("stationIDs") String [] stationIDs,@RequestParam("dataTime") String dataTime,@RequestParam("replace") String replace);

    //查询充电设备功率统计信息
    @GetMapping("/station/getSuperviseQueryEquipmentPowerInfo")
    R getSuperviseQueryEquipmentPowerInfo(@RequestParam("stationID") String stationID,@RequestParam("dataTime") String dataTime,@RequestParam("replace") String replace);

    //查充电事故
    @GetMapping("/station/getSuperviseQueryAccidentInfo")
    R getSuperviseQueryAccidentInfo(@RequestParam("lastQueryTime") String lastQueryTime,@RequestParam("replace") String replace);

    //推送充电站用能统计信息
    @GetMapping("/station/getSuperviseNotificationOperationStatusInfo")
    R getSuperviseNotificationOperationStatusInfo(@RequestParam("replace") String replace);

    //推送充电站实时功率
    @GetMapping("/station/getSuperviseNotificationRealtimePowerInfo")
    R getSuperviseNotificationRealtimePowerInfo(@RequestParam("operatorIdEvcs")String operatorIdEvcs,@RequestParam("replace")String replace);

    //充电桩工作参数设置
    @PostMapping("/pile/{pileNo}/{powerNumber}/configSettings")
    R pileConfigSettings(@PathVariable("pileNo") @Param("pileNo")String pileNo,@PathVariable("powerNumber") @Param("powerNumber")String powerNumber);


}
