package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.school.EduYidaAppAccount;
import com.yida.data.system.feign.RemoteYidaAppAccountService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteYidaAppAccountService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteYidaAppAccountServiceFallback implements FallbackFactory<RemoteYidaAppAccountService> {

    @Override
    public RemoteYidaAppAccountService create(Throwable throwable) {
        log.error("RemoteYidaAppAccountService fallback reason:{}", throwable.getMessage());

        return new RemoteYidaAppAccountService() {
            @Override
            public ResultBean<EduYidaAppAccount> getAccountByAccountId(String accountId) {
                return null;
            }

            @Override
            public ResultBean<EduYidaAppAccount> getAccountByType(Long schoolId, Integer type) {
                return null;
            }

            @Override
            public ResultBean<EduYidaAppAccount> getAccountByTypeNoPermission(Long schoolId, Integer type) {
                return null;
            }
        };
    }
}
