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 org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/25 13:51
 * @Description: TODO
 * @Version: 1.0
 */
@FeignClient(
        value = AppNameConstant.SAAS_SYSTEM,
        fallbackFactory = RoleScopeFeignFallback.class
)
public interface RoleScopeFeignServer {

    @RequestMapping("/role-scope/list")
    R<List<RoleScope>> list(@SpringQueryMap RoleScope roleScope);

    @RequestMapping("/role-scope/listByRoleIds")
    R<List<RoleScope>> list(@RequestParam("userRoleIdList") List<Long> userRoleIdList,@RequestParam("scopeType") Integer scopeType);

    /**
     * 获取用户权限(根据orgUserId和deptId获取角色默认权限和自定义权限)
     * @param nestUserRoleScopeRequest
     * @return
     */
    @GetMapping("/nestUserRoleScope/getUserScope")
    R<List<Long>> getUserScope(NestUserRoleScopeRequest nestUserRoleScopeRequest);
}
