package com.github.wxiaoqi.security.auth.service;


import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.auth.util.user.JwtAuthenticationRequest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

public interface AuthService {
    String login(JwtAuthenticationRequest authenticationRequest) throws Exception;
    ObjectRestResponse loginSmall(JwtAuthenticationRequest authenticationRequest) throws Exception;
    String refresh(String oldToken) throws Exception;
    void validate(String token) throws Exception;
    JSONObject sendsms(String username, Integer type) throws Exception;
    JSONObject register(String username, String mobilecode, String  password,String code) throws Exception;
    JSONObject wxregister( String  username, String mobilecode, String  password, String  nickname, String  headimgurl, String  openid, String  unionid, Integer  type,Integer  isQQ,String code) throws Exception;
    JSONObject checkBindWechat(String username) throws Exception;
    JSONObject wxlogin(String openid,Integer isQQ,String code) throws Exception;
    JSONObject tlogin(String username, String  password,String mobilecode,Integer  type,String code) throws Exception;
    String getToken(String username,Integer id) throws Exception;
    JSONObject reset(String username, String mobilecode, String  password) throws Exception;

    /**
     * 使用用户id登录 Unbelievable ! ! !
     * @param userid
     * @return
     */
    JSONObject appletLoginByUserId(Integer userid);

    /**
     * 通过小程序注册
     * @param username
     * @param headimgurl
     * @param nickname
     * @return
     */
    JSONObject appletRegistry(String username,String headimgurl,String nickname,Integer  userid);

    String loginImiWithToken();

    ObjectRestResponse checkToken(String token);

    ObjectRestResponse updUsername(String username, String mobilecode, String token);
}
