package com.ym.mec.auth.api.client;

import java.util.List;

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.ym.mec.auth.api.client.fallback.SysUserFeignServiceFallback;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.common.config.FeignConfiguration;
import com.ym.mec.common.entity.HttpResponseResult;

@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 HttpResponseResult<Integer> 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);

	@PostMapping(value = "exit/{clientId}/{phone}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
	public HttpResponseResult<String> exitByPhone(@PathVariable("clientId") String clientId, @PathVariable("phone") String phone);
}
