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.system.Role;
import com.yida.data.system.feign.RemoteRoleService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

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

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

        return new RemoteRoleService() {
            @Override
            public ResultBean<List> listMenuByRole(Long[] roleIds) {
                return null;
            }

            @Override
            public ResultBean<List> listMenuByRoleName(String[] roleIds) {
                return null;
            }

            @Override
            public ResultBean<Role> getRoleByName(String roleName) {
                return null;
            }

            @Override
            public ResultBean<Role> getRoleByNameNoPermission(String roleName) {
                return null;
            }
        };
    }
}
