package com.xhpc.common.api;

import com.xhpc.common.api.factory.PileOrderFallbackFactory;
import com.xhpc.common.core.constant.ServiceNameConstants;
import com.xhpc.common.core.domain.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * 桩订单回调
 * @author yuyang
 * @date 2021/8/15 16:54
 */
@FeignClient(contextId ="pileOrderService",value = ServiceNameConstants.XHPC_ORDER, fallbackFactory = PileOrderFallbackFactory.class)
public interface PileOrderService {

    /**
     * 桩启动回调接口
     * @param orderNo  订单号
     * @param status   1 成功 2失败
     * @param remark   备注
     * @return
     */
    @GetMapping("/chargeOrder/pileStartup")
    R pileStartup(@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "status") Integer status, @RequestParam(value = "remark") String remark);

    /**
     * 桩停止回调接口
     *
     * @param orderNo 订单号
     * @param status  1 成功 2失败 3数据中断 4恢复数据
     * @param remark  备注
     * @return
     */
    @GetMapping("/chargeOrder/pileStop")
    R pileStop(@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "status") Integer status, @RequestParam(value = "remark") String remark);


    /**
     * 桩订单结束回调接口
     * @param orderNo  订单号
     * @return
     */
    @GetMapping("/chargeOrder/pileEndOrder")
    R pileEndOrder(@RequestParam(value = "orderNo") String orderNo);


    /**
     * 桩订单实时订单回调接口
     * @param orderNo  订单号
     * @return
     */
    @GetMapping("/chargeOrder/pileRimeOrder")
    R pileRimeOrder(@RequestParam(value = "orderNo") String orderNo);


    /**
     * 订单异常回调接口
     *
     * @param orderNo 订单号
     * @return
     */
    @PostMapping("/chargeOrder/abnormalOrder")
    R abnormalOrder(@RequestParam(value = "orderNo") String orderNo);


    @GetMapping(value = "/chargeOrder/pileStartUpBy3rd")
    R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String internetSerialNumber,
                       @RequestParam(value = "driverId", required = false) String driverId,
                       @RequestParam(value = "chargingAmt", required = false, defaultValue = "500") Integer chargingAmt,
                       @RequestParam(value = "plateNum", required = false) String plateNum,
                       @RequestParam(value = "status") Integer status,
                       @RequestParam(value = "connectorId") String connectorId);

    /**
     * VIN启动
     * @param serialNumber
     * @param vinNumber
     * @return
     */
    @GetMapping("/api/chargeOrder/pileVin")
    R pileVin(@RequestParam(value = "serialNumber") String serialNumber,@RequestParam(value = "vinNumber") String vinNumber);


    /**
     * 桩订单实时订单BMS回调接口
     * @param orderNo  订单号
     * @return
     */
    @GetMapping("/chargeOrder/pileRimeOrderBms")
    R pileRimeOrderBms(@RequestParam(value = "orderNo") String orderNo);


    /**
     * soc达到系统设置值
     * @param orderNo  订单号
     * @return
     */
    @GetMapping("/api/chargeOrder/constantSoc")
    R constantSoc(@RequestParam(value = "orderNo") String orderNo,@RequestParam(value = "soc") String soc);


    /**
     * 川逸充启动充电
     */
    @GetMapping("/api/chargeOrder/cycStartUp")
    R cycStartUp(@RequestParam(value = "userId") Long userId, @RequestParam(value = "serialNumber") String serialNumber, @RequestParam(value = "type") Integer type, @RequestParam(value = "source") Integer source, @RequestParam(value = "money") BigDecimal money, @RequestParam(value = "phone") String phone, @RequestParam(value = "PlateNum") String PlateNum);



    /**
     * 占位费计算
     * @param gunNumber  订单号
     * @return
     */
    @GetMapping("/placeholderOrder/getxhpcPlaceholderOrderTime")
    R getXhpcPlaceholderOrderTime(@RequestParam(value = "gunNumber") String gunNumber);


    /**
     * 新电途查询占位费规则
     */
    @GetMapping("/placeholderOrder/getPlaceholderIDs")
    R getPlaceholderIDs(@RequestParam(value = "stationIDs") String [] stationIDs);


    @GetMapping("/placeholderOrder/getReturnGunRecord")
    R getReturnGunRecord(@RequestParam(value = "serialNumber") String serialNumber,@RequestParam(value = "startTime") String startTime,@RequestParam(value = "endTime") String endTime);
}
