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

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.UseCouponPayClientFeign;
import com.yuchen.saas.parking.api.util.SaasParkingFeignFallbackUtils;
import com.yuchen.saas.parking.api.vo.coupon.UserPayUseCouponDetailRespVO;
import com.yuchen.saas.parking.api.vo.coupon.UserPayUseCouponRespVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhouhanwei
 * @create 2023/6/12 9:58
 */
@Component
public class UseCouponPayClientFeignFallback implements FallbackFactory<UseCouponPayClientFeign> {

    @Override
    public UseCouponPayClientFeign create(Throwable throwable) {

        return new UseCouponPayClientFeign() {

            @Override
            public R<UserPayUseCouponRespVO> useCouponToUserPay(UserPayUseCouponReqDTO reqDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<UserPayUseCouponDetailRespVO>> findUserPayUseCouponList(UserPayUseCouponReqDTO reqDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<UserPayUseCouponDetailRespVO>> findUseToNoUseCouponList(UserPayUseCouponReqDTO reqDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> userPayToUpdateCouponInfo(PayFlowUseCouponReqDTO reqDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> paySuccessUpdateCouponInfo(PaySuccessUseCouponReqDTO reqDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> getCouponInfoById(Long couponRecordId) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> timeOutUpdateCoupon(Long couponRecordId) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
