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

import com.yuchen.saas.parking.api.dto.OwnedRegisterDTO;
import com.yuchen.saas.parking.api.dto.PmgBatParkCarPropertyQueryDTO;
import com.yuchen.saas.parking.api.entity.PmgBatParkCar;
import com.yuchen.saas.parking.api.util.SaasParkingFeignFallbackUtils;
import com.yuchen.saas.parking.api.vo.CountParkCompanyVo;
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;

import java.util.List;

/**
 * @ClassName PmgBatParkCarClient
 */
@Component
public class PmgBatParkCarClientFallback implements FallbackFactory<PmgBatParkCarClient> {
    @Override
    public PmgBatParkCarClient create(Throwable throwable) {
        return new PmgBatParkCarClient() {
            @Override
            public R countByParkCompany(CountParkCompanyVo countParkCompanyVo) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<PmgBatParkCar>> countByPhone(Long parkId, String phone) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> ownedRegister(OwnedRegisterDTO ownedRegisterDTO) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<PmgBatParkCar>> selectPropertyCar(PmgBatParkCarPropertyQueryDTO dto) {
                return SaasParkingFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
