package com.vctgo.system.api.factory;

import com.vctgo.common.core.domain.R;
import com.vctgo.common.core.web.domain.AjaxResult;
import com.vctgo.system.api.RemoteAreaService;
import com.vctgo.system.api.RemoteBranchKindergartenService;
import com.vctgo.system.api.RemoteTenantService;
import com.vctgo.system.api.domain.SysAreaSetting;
import com.vctgo.system.api.domain.SysTenant;
import com.vctgo.system.api.domain.dto.SysAreaSettingDto;
import com.vctgo.system.api.domain.dto.SysBranchKindergartenDto;
import com.vctgo.system.api.domain.dto.SysGardenManageDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 *
 * @author vctgo
 */
@Component
public class RemoteBranchKindergartenFallbackFactory implements FallbackFactory<RemoteBranchKindergartenService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteBranchKindergartenFallbackFactory.class);

    @Override
    public RemoteBranchKindergartenService create(Throwable throwable) {
        log.error("区域服务调用失败:{}", throwable.getMessage());

        return new RemoteBranchKindergartenService() {
            @Override
            public R<SysBranchKindergartenDto> allBranchKindergartenList(Long id) {
                return R.fail("获取幼儿园管理基本信息详细信息失败:" + throwable.getMessage());
            }

            @Override
            public R<List<SysBranchKindergartenDto>> branchKindergartenAllList(String belongRegion) {
                return R.fail("获取幼儿园管理基本信息列表失败:" + throwable.getMessage());
            }

            @Override
            public R<SysBranchKindergartenDto> getKindergartenInfo(Long id) {
                return R.fail("获取幼儿园管理基本信息详细信息失败:" + throwable.getMessage());
            }

            @Override
            public R<List<Long>> getKindergartenIdList(SysBranchKindergartenDto sysBranchKindergartenDto) {
                return R.fail("获取幼儿园Id列表失败:" + throwable.getMessage());
            }

            @Override
            public R<List<SysBranchKindergartenDto>> getKindergartenListByGardenId(Long gardenId) {
                return R.fail("根据幼儿园集团ID获取幼儿园列表失败:" + throwable.getMessage());
            }

            @Override
            public R<List<SysGardenManageDto>> gardenManageList() {
                return R.fail("获取幼儿园集团管理列表失败:" + throwable.getMessage());
            }

            @Override
            public R<SysGardenManageDto> getGardenManageInfo(Long id) {
                return R.fail("获取幼儿园集团管理详细信息失败:" + throwable.getMessage());
            }

            @Override
            public R<List<Long>> getGardenManageIdList(SysGardenManageDto sysGardenManageDto) {
                return R.fail("获取幼儿园集团Id列表失败:" + throwable.getMessage());
            }

            @Override
            public R<List<SysBranchKindergartenDto>> get(String provinceId, String cityId, String districtId) {
                return R.fail("幼儿园列表失败:" + throwable.getMessage());
            }

            @Override
            public R<Integer> add(SysBranchKindergartenDto sysBranchKindergartenDto) {
                return R.fail("添加园所失败:" + throwable.getMessage());
            }

            @Override
            public R<SysBranchKindergartenDto> getById(Long id) {
                return R.fail("获取幼儿园详情信息失败:" + throwable.getMessage());
            }


        };
    }
}
