package com.keao.edu.auth.api.client;

import java.util.List;

import com.keao.edu.auth.api.client.fallback.SysUserFeignServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.keao.edu.auth.api.entity.SysUser;
import com.keao.edu.common.config.FeignConfiguration;

@FeignClient(contextId = "sysUserFeignService", name = "auth-server", configuration = { FeignConfiguration.class }, fallback = SysUserFeignServiceFallback.class)
public interface SysUserFeignService {

	@GetMapping(value = "user/queryUserById/{userId}")
	public SysUser queryUserById(@PathVariable("userId") Integer userId);

	@GetMapping(value = "user/queryUserByPhone")
	public SysUser queryUserByMobile(@RequestParam("mobile") String mobile);

	@PostMapping(value = "user/add", consumes = MediaType.APPLICATION_JSON_VALUE)
	public Object addUser(SysUser user);

	@GetMapping(value = "queryUserInfo")
	public SysUser queryUserInfo();

	@GetMapping(value = "role/queryRoleCodeListByUserId")
	public List<String> queryRoleCodeListByUserId(@RequestParam("userId") Integer userId);
	
	@PostMapping(value = "user/updateSysUser", consumes = MediaType.APPLICATION_JSON_VALUE)
	public Boolean updateSysUser(SysUser user);
}
