package com.yuchen.saas.payment.api.feign;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.payment.api.entity.PmgBatParkPay;
import com.yuchen.saas.payment.api.param.*;
import com.yuchen.saas.payment.api.vo.BillSearchVo;
import com.yuchen.saas.payment.api.vo.PmgBatParkPayVo;
import com.yuchen.saas.payment.api.vo.orderCenter.OrderFlagVO;
import com.yuchen.saas.payment.api.vo.orderCenter.UnPaidOrderDataVO;
import io.swagger.annotations.ApiOperation;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName ParkPayFeignService
 * @Description 支付远程接口
 * @Author 张逸飞
 * @Date 2022年11月19日 14:34:04
 */
@FeignClient(
        value = AppNameConstant.SAAS_PAYMENT,
        fallbackFactory = ParkPayFeignServiceFallback.class
)
public interface ParkPayFeignService {

    /**
     * 创建支付订单
     *
     * @param payParam
     * @return
     */
    @PostMapping("/pay/createPay")
    R createPay(@RequestBody CreatePayParam payParam);

    /**
     * 结算中心-创建单个订单
     */
    @PostMapping("/pay/verifyOnePayCost")
    R<Long> verifyOnePayCost(@Validated @RequestBody VerifyOnePayCostReqDTO reqDTO);

    /**
     * 结算中心-创建合并订单前判断账单金额是否更新,只支持停车和占位费
     */
    @PostMapping("/pay/verifyMergePayCost")
    R<Long> verifyMergePayCost(@Validated @RequestBody VerifyMergePayCostReqDTO reqDTO);

    /**
     * 结算中心-创建单个订单
     */
    @PostMapping("/pay/createOrder")
    R createOrder(@RequestBody CreateOrderPayParam payParam);

    /**
     * 结算中心-创建合并订单
     */
    @PostMapping("/pay/createMergeOrderPay")
    R createMergeOrderPay(@RequestBody CreateMergeOrderPayParam payParam);

    /**
     * 结算中心-创建订单前判断订单是否已经生成，生成则进入待支付页面
     * 1:进入支付页面，2：进入待支付页面
     */
    @PostMapping("/pay/selectUnpaidByBillIds")
    R<OrderFlagVO> selectUnpaidByBillIds(@Validated @RequestBody UnpaidOrderDataStateReqDTO reqDTO);

    /**
     * 获取待支付信息-用于支付
     */
    @PostMapping("/pay/getUnPaidOrderData")
    R<List<UnPaidOrderDataVO>> getUnPaidOrderData(@Validated @RequestBody UnpaidOrderDataReqDTO reqDTO);

    /**
     * 结算中心-订单去支付
     */
    @PostMapping("/pay/orderGoToPay")
    R orderGoToPay(@Validated @RequestBody PayMoreOrderDataReqDTO reqDTO);


    /**
     * 结算中心-待支付列表的待支付订单去支付
     */
    @PostMapping("/pay/unPaidOrderGoToPay")
    R unPaidOrderGoToPay(@Validated @RequestBody UnPaidOrderGoToPayReqDTO reqDTO);

    /**
     * 获取账单分页信息
     *
     * @param billSearchVo 账单搜索条件
     * @return
     */
    @PostMapping("/pay/getParkBillPage")
    R getParkBillPage(@RequestBody BillSearchVo billSearchVo);

    /**
     * 根据ID获取支付单
     *
     * @param id 支付单ID
     * @return
     */
    @GetMapping("/pay/getPayById")
    PmgBatParkPay getPayById(@RequestParam Long id);

    /**
     * 查询停车账单支付表数据
     *
     * @param parkPay
     * @return
     */
    @PostMapping("/pay/getParkPayPage")
    R<List<PmgBatParkPayVo>> getParkPayList(@RequestBody ParkPay parkPay);

    /**
     * 根据条件获取支付单列表
     *
     * @param payUserId       用户ID
     * @param invoicingStatus 发票状态
     * @param ids             ID逗号分割
     * @return
     */
    @GetMapping("/pay/getParkBillList")
    List<PmgBatParkPay> getParkBillList(@RequestParam String payUserId, @RequestParam String invoicingStatus,
                                        @RequestParam String ids);

    /**
     * 更新支付单发票状态
     *
     * @param ids             支付单ID
     * @param invoicingStatus 发票状态
     * @return
     */
    @GetMapping("/pay/updateInvoicingStatus")
    Boolean updateInvoicingStatus(@RequestParam String ids, @RequestParam int invoicingStatus);


    /**
     * 停车账单表,查询支付订单
     *
     * @param billSysCodes
     * @return
     */
    @PostMapping("/pay/getParkPayListByCode")
    R<List<PmgBatParkPay>> getParkPayListByCode(@RequestBody List<Long> billSysCodes);


    /**
     * 根据订单号获取支付订单
     * @param orderNumber
     * @return
     */
    @GetMapping("/pay/getPayByOrderNumber")
    R<PmgBatParkPay> getPayByOrderNumber(@RequestParam String orderNumber);

    /**
     * 根据code 查询支付单
     *
     * @param billSysCodes 订单唯一编号
     * @return
     */
    @PostMapping("/pay/getPayListByCode")
    R<List<PmgBatParkPay>> getPayListByCode(@RequestBody List<Long> billSysCodes);

    /**
     * 根据code 查询支付单
     *
     * @param billCode 订单唯一编号
     * @return
     */
    @GetMapping("/pay/getPmgBatParkPayByBillCode/{billCode}")
    R<PmgBatParkPay> getPmgBatParkPayByBillCode(@PathVariable String billCode);

}
