package com.yuchen.saas.parking.api.feign.coupon;

import com.yuchen.saas.parking.api.dto.coupon.PayFlowUseCouponReqDTO;
import com.yuchen.saas.parking.api.dto.coupon.PaySuccessUseCouponReqDTO;
import com.yuchen.saas.parking.api.dto.coupon.UserPayUseCouponReqDTO;
import com.yuchen.saas.parking.api.feign.coupon.fallback.UseCouponPayClientFeignFallback;
import com.yuchen.saas.parking.api.vo.coupon.UserPayUseCouponDetailRespVO;
import com.yuchen.saas.parking.api.vo.coupon.UserPayUseCouponRespVO;
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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author zhouhanwei
 * @create 2023/6/12 9:57
 */
@FeignClient(
        value = AppNameConstant.SAAS_PARKING,
        fallbackFactory = UseCouponPayClientFeignFallback.class
)
public interface UseCouponPayClientFeign {

    /**
     * 使用优惠券
     */
    @PostMapping("/useCoupon/pay/useCouponToUserPay")
    R<UserPayUseCouponRespVO> useCouponToUserPay(@RequestBody UserPayUseCouponReqDTO reqDTO);

    /**
     * 查看可使用的优惠券列表
     */
    @PostMapping("/useCoupon/pay/findUserPayUseCouponList")
    R<List<UserPayUseCouponDetailRespVO>> findUserPayUseCouponList(@RequestBody UserPayUseCouponReqDTO reqDTO);

    /**
     * 查看不可使用的优惠券列表
     */
    @PostMapping("/useCoupon/pay/findUseToNoUseCouponList")
    R<List<UserPayUseCouponDetailRespVO>> findUseToNoUseCouponList(@RequestBody UserPayUseCouponReqDTO reqDTO);

    /**
     * 支付过程更改优惠券状态
     */
    @PostMapping("/useCoupon/pay/userPayToUpdateCouponInfo")
    R<Boolean> userPayToUpdateCouponInfo(@Validated @RequestBody PayFlowUseCouponReqDTO reqDTO);

    /**
     * 支付成功更新优惠券及更新额度
     */
    @PostMapping("/useCoupon/pay/paySuccessUpdateCouponInfo")
    R<Boolean> paySuccessUpdateCouponInfo(@Validated @RequestBody PaySuccessUseCouponReqDTO reqDTO);

    /**
     * 支付前获取优惠券状态
     */
    @PostMapping("/useCoupon/pay/getCouponInfoById/{couponRecordId}")
    R<Boolean> getCouponInfoById(@PathVariable Long couponRecordId);

    /**
     * 超时更新优惠券状态
     */
    @PostMapping("/useCoupon/pay/timeOutUpdateCoupon/{couponRecordId}")
    R<Boolean> timeOutUpdateCoupon(@PathVariable Long couponRecordId);
}
