package com.ozs.account.api;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.ozs.account.dto.UserDTO;

/**
 * @ClassName: AccountInfoAPI
 * @Description: 用户登录接口
 * @author: IF
 * @date: 2018年6月8日 下午6:09:40
 */
public interface AccountInfoAPI {

	/**
	 * 登录验证
	 * 
	 * @param loginInfo
	 * @return
	 */
	@GetMapping("/accountChecking/login")
	Object login(@RequestBody UserDTO user, HttpServletResponse response) throws Exception;

	/**
	 * 通过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);

	@GetMapping("/account/getUserType")
	Integer getUserType(@RequestParam(value = "userId") String userId);

}
