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.AccessFacePushRecordsDto;
import com.sptg.estate.api.entity.AccessFacePushRecords;
import com.sptg.estate.api.feigns.AccessFacePushRecordsFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

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

            @Override
            public ResultBean<Page<AccessFacePushRecords>> showAccessFacePushRecordsList(AccessFacePushRecordsDto recordsDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

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

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

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

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

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

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

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

            @Override
            public Long getAccessFacePushRecordsCount(AccessFacePushRecordsDto recordsDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

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