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

import com.yuchen.saas.parking.api.dto.AuditDto;
import com.yuchen.saas.parking.api.dto.ParkingSharePlaceAuditDto;
import com.yuchen.saas.parking.api.entity.ParkingSharePlaceAudit;
import com.yuchen.saas.parking.api.util.SaasParkingFeignFallbackUtils;
import com.yuchen.saas.parking.api.vo.ParkingSharePlaceAuditVo;
import com.yuchen.saas.parking.api.vo.VehicleCardDataVo;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author yuanzhelin
 * @Date 2024/8/20 16:26
 * @Description TODO
 */
@Component
public class ParkingSharePlaceClientFallback implements FallbackFactory<ParkingSharePlaceClient> {
    @Override
    public ParkingSharePlaceClient create(Throwable throwable) {
        return new ParkingSharePlaceClient() {

            @Override
            public R applySharePlace(ParkingSharePlaceAudit param) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R delSharePlaceApplyAudit(Long id) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R cancelCardData(Long auditId) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R getSharePlaceAuditDetail(Long id) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<ParkingSharePlaceAuditVo>> getSharePlaceAuditPage(ParkingSharePlaceAuditDto param) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<VehicleCardDataVo> checkMonthlyCard(Long parkingId, String plateNo) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R auditSharePlace(AuditDto auditDto) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
