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

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.dto.AccessCardPushRecordsDto;
import com.sptg.estate.api.entity.AccessCardPushRecords;
import com.sptg.estate.api.entity.AccessCardPushRecords;
import com.sptg.estate.api.feigns.AccessCardPushRecordsFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * title: AccessCardPushRecordsFeignFallbackFactory
 * package: com.sptg.estate.api.feigns.fallback
 * description: 授权记录 服务接口容错处理
 *
 *
 *
 */
@Component
@Slf4j
public class AccessCardPushRecordsFeignFallbackFactory implements FallbackFactory<AccessCardPushRecordsFeign> {

    @Override
    public AccessCardPushRecordsFeign create(Throwable cause) {
        return new AccessCardPushRecordsFeign(){

            @Override
            public ResultBean<Page<AccessCardPushRecords>> showAccessCardPushRecordsList(AccessCardPushRecordsDto accessCardPushRecordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> addAccessCardPushRecords(AccessCardPushRecordsDto recordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> addAccessCardPushRecordsByDevices(AccessCardPushRecordsDto recordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> addOrUpdateAccessCardPushRecords(AccessCardPushRecordsDto recordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public AccessCardPushRecords findAccessCardPushRecordsById(Long id) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public List<AccessCardPushRecords> findAccessCardPushRecordsByUserId(Long userId) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<Boolean> updateAccessCardPushRecords(AccessCardPushRecordsDto accessPushRecordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> deleteAccessCardPushRecords(AccessCardPushRecordsDto accessPushRecordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public Long getAccessCardPushRecordsCount(AccessCardPushRecordsDto accessPushRecordsDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<AccessCardPushRecords> getListByUserId(Long userId, Integer accessUserType, Integer specialDevice) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
