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

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.device.api.entity.Device;
import com.sptg.estate.api.dto.AccessBlackCardDto;
import com.sptg.estate.api.dto.AccessCardDto;
import com.sptg.estate.api.entity.AccessBlackCard;
import com.sptg.estate.api.entity.AccessCard;
import com.sptg.estate.api.feigns.AccessBlackCardFeign;
import com.sptg.estate.api.feigns.AccessCardFeign;
import com.sptg.estate.api.vo.DevicesAccessPushVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * title: UserCardFeignFallbackFactory
 * package: com.sptg.estate.api.feigns.fallback
 * description: 门禁卡黑名单 服务接口容错处理
 */
@Component
@Slf4j
public class AccessBlackCardFeignFallbackFactory implements FallbackFactory<AccessBlackCardFeign> {
    @Override
    public AccessBlackCardFeign create(Throwable cause) {
        return new AccessBlackCardFeign() {

            @Override
            public ResultBean<Page<AccessBlackCard>> showAccessBlackCardList(AccessBlackCardDto accessBlackCardDto) {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}