package com.sptg.estate.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.dto.FaceChargeProjectResidentialUserDto;
import com.sptg.estate.api.entity.FaceChargeProjectResidentialUser;
import com.sptg.estate.api.feigns.FaceChargeProjectFeign;
import com.sptg.estate.api.feigns.FaceChargeProjectResidentialUserFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class FaceChargeProjectResidentialUserFeignFallbackFactory implements FallbackFactory<FaceChargeProjectResidentialUserFeign> {


    @Override
    public FaceChargeProjectResidentialUserFeign create(Throwable throwable) {
        return new FaceChargeProjectResidentialUserFeign() {

            @Override
            public ResultBean<Boolean> addFaceChargeProjectResidentialUser(FaceChargeProjectResidentialUserDto dto) {
                log.error(throwable.getMessage(),throwable);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<FaceChargeProjectResidentialUser> findFaceChargeProjectResidentialUser(FaceChargeProjectResidentialUserDto dto) {
                log.error(throwable.getMessage(),throwable);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
