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.estate.api.dto.ApplyUserDto;
import com.sptg.estate.api.entity.ApplyUser;
import com.sptg.estate.api.feigns.ApplyUserFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * title: ApplyUserFeignFallbackFactory
 * package: com.sptg.estate.biz.security
 * description: 住户申请 服务接口容错处理
 *
 *               
 *                      
 */
@Component
@Slf4j
public class ApplyUserFeignFallbackFactory implements FallbackFactory<ApplyUserFeign> {
    @Override
    public ApplyUserFeign create(Throwable cause) {
        return new ApplyUserFeign(){

            @Override
            public ResultBean<Boolean> checkByNameAndRoomId(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> authentication(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Page<ApplyUser>> showApplyUserList(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

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

            @Override
            public ResultBean<Boolean> updateCheckState(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public List<ApplyUser> getAllApplyUserByMemberId(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public Page<ApplyUser> pagingByMemberId(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }
            @Override
            public Page<ApplyUser> pagingByRoomId(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public List<ApplyUser> getAllApplyUserByRoomId(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public Map<String, Object> applyUserCountForCheckState(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public Long getApplyUserCount(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<Boolean> addApplyUser(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Long> addApplyUserReturnUser(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> updateApplyUserById(ApplyUser applyUser) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public Integer getApplyUserCountByState(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return 0;
            }

            @Override
            public ResultBean<Page> getApplyUserPage(PageBean<ApplyUser, ApplyUserDto> pageBean) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public List<ApplyUser> getApplyUserByCondition(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<Page<ApplyUser>> getAuthRoomByMemberId(ApplyUserDto applyUserDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public boolean updateApplyUserList(List<ApplyUser> applyUserList) {
                log.error(cause.getMessage(),cause);
                return false;
            }

            @Override
            public boolean deleteApplyUser(ApplyUserDto applyUserDto) {
                return false;
            }
        };
    }
}
