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

import java.util.ArrayList;
import java.util.List;

@Component
@Slf4j
public class FaceChargeProjectFeignFallbackFactory implements FallbackFactory<FaceChargeProjectFeign> {


    @Override
    public FaceChargeProjectFeign create(Throwable throwable) {
        return new FaceChargeProjectFeign() {
            @Override
            public ResultBean<Page<FaceChargeProject>> showFaceChargeProjectList(FaceChargeProjectDto faceChargeProjectDto) {
                log.error(throwable.getMessage(),throwable);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public List<FaceChargeProject> getListByResidentialId(Long residentialId) {
                log.error(throwable.getMessage(),throwable);
                return new ArrayList<>(0);
            }

            @Override
            public List<FaceChargeProject> getListByResidentialIdAndDate(Long residentialId) {
                log.error(throwable.getMessage(),throwable);
                return new ArrayList<>(0);
            }
            @Override
            public ResultBean<FaceChargeProject> selectByResidentialId(Long residentialId) {
                log.error(throwable.getMessage(),throwable);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public List<FaceChargeProject> getList(FaceChargeProjectDto dto) {
                log.error(throwable.getMessage(),throwable);
                return new ArrayList<>(0);
            }

            @Override
            public ResultBean<FaceChargeProject> getOneFaceChargeProject(FaceChargeProjectDto dto) {
                log.error(throwable.getMessage(),throwable);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public FaceChargeProject getOneNotInId(FaceChargeProjectDto dto) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

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

            @Override
            public FaceChargeProject getFaceChargeProjectById(Long id) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

            @Override
            public ResultBean<Boolean> updateFaceChargeProject(FaceChargeProjectDto dto) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

            @Override
            public ResultBean<Boolean> deleteFaceChargeProject(FaceChargeProjectDto dto) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

            @Override
            public FaceChargeProject getByOldId(String oldId) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

            @Override
            public Boolean updateBathFaceChargeProject(List<FaceChargeProject> faceChargeProjectList) {
                log.error(throwable.getMessage(),throwable);
                return null;
            }

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