package com.yanzhu.flowable.rpc;

import com.yanzhu.common.core.constant.SecurityConstants;
import com.yanzhu.common.core.constant.ServiceNameConstants;
import com.yanzhu.common.core.domain.R;
import com.yanzhu.system.api.domain.SysRole;
import com.yanzhu.system.api.domain.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * system rpc接口调用
 */
@FeignClient(value = ServiceNameConstants.SYSTEM_SERVICE)
public interface IRemoteSystemService {

    @GetMapping("/rpc/user/list")
    R<List<SysUser>> getUsers(@RequestParam Map<String, Object> paraMap, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/user/{userId}")
    R<SysUser> getUserById(@PathVariable(value = "userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/role/list")
    R<List<SysRole>> getRoles(@RequestParam Map<String, Object> paraMap, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/rpc/role/{roleId}")
    R<SysRole> getRoleById(@PathVariable(value = "roleId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
