package com.yuchen.saas.manage.system.api.feign;

import com.yuchen.saas.manage.system.api.entity.RoleScope;
import com.yuchen.saas.manage.system.api.request.NestUserRoleScopeRequest;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/25 13:51
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class RoleScopeFeignFallback implements FallbackFactory<RoleScopeFeignServer> {

    @Override
    public RoleScopeFeignServer create(Throwable cause) {
        return new RoleScopeFeignServer() {

            @Override
            public R list(RoleScope roleScope) {
                return R.error("远程调用失败");
            }

            @Override
            public R list(List<Long> userRoleIdList, Integer scopeType) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<Long>> getUserScope(NestUserRoleScopeRequest nestUserRoleScopeRequest) {
                return null;
            }
        };
    }
}