package com.ozs.rpm.util;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import io.swagger.annotations.ApiOperation;

/**
 * 
 * @ClassName: AccountApi
 * @Description:
 * @author: Zhao You Kai
 * @date: Mar 6, 2019 10:35:33 AM
 */
@FeignClient(value = "account")
public interface AccountApi {

	/**
	 * 通过token解析userId
	 * 
	 * @param jwt
	 * @return
	 */
	@GetMapping("/account/parseTokenId")
	public String parseTokenId(@RequestParam("jwt") String jwt);

	/**
	 * 通过token解析第二参数，预留
	 * 
	 * @param jwt
	 * @return
	 */
	@GetMapping("/account/parseTokenSubject")
	public String parseTokenSubject(@RequestParam("jwt") String jwt);

	/**
	 * 保存token
	 * 
	 * @param id
	 * @param token
	 * @param minute
	 * @return
	 */
	@GetMapping("/account/saveToken")
	public String saveToken(@RequestParam("id") String id, @RequestParam("token") String token,
			@RequestParam("minute") int minute);

	/**
	 * 删除token
	 * 
	 * @param id
	 * @return
	 */
	@GetMapping("/account/deleteToken")
	public String deleteToken(@RequestParam("id") String id);

	/**
	 * 根据userId获取token
	 * 
	 * @param accountId
	 * @return
	 */
	@GetMapping("/account/getTokenByAccountId")
	public String getTokenByAccountId(@RequestParam(value = "accountId", required = true) String accountId);

	/**
	 * 刷新token
	 * 
	 * @param accountId
	 * @param minute
	 * @return
	 */
	@GetMapping("/account/refreshToken")
	public String refreshToken(@RequestParam(value = "accountId", required = true) String accountId,
			@RequestParam(value = "minute", required = true) int minute);

	/**
	 * 获取用户类型 1前台用户 2后端管理用户
	 * 
	 * @param userId
	 * @return
	 */
	@GetMapping("/account/getUserType")
	public Integer getUserType(@RequestParam("userId") String userId);
}
