package cn.pluss.platform.wx;

import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * 微信公共service
 *@author: bzg
 *@time: 2021/11/29 15:21
 */
public interface WxCommonService {

    String WX_ACCESS_TOKEN_PREFIX_CODE = "accesstoken:";

    String WX_OAUTH2_ACCESS_TOKEN_PREFIX_CODE = "accesstoken:oauth2:";

    String WX_JSAPI_TICKET_PREFIX_CODE = "jsapi:ticket:";

    /**
     * 获取accesstoken
     * @date: 2021/11/29 18:18
     * @param request:
     * @param refresh:
     * @return java.lang.String
     */
    String getAccessToken(WxAccessTokenRequest request,Boolean refresh);


    /**
     * 获取H5网页授权信息
     * @date: 2021/11/29 18:18
     * @param request:
     * @return java.lang.String
     */
    WxOauth2AccessTokenResponse getOauth2Info(WxAccessTokenRequest request);

    /**
     * 获取openid
     * @date: 2021/11/29 18:18
     * @param request:
     * @return java.lang.String
     */
    WxOpenidResponse getWxOpenId(WxAccessTokenRequest request);

    /**
     * 发送模板消息
     * @date: 2021/11/29 18:19
     * @param request:
     * @param tokenRequest:
     */
    void sendTemplateMsg(WxTemolateRequest request,WxAccessTokenRequest tokenRequest);

    /**
     * 获取微信用户信息
     * @date: 2021/11/30 13:49
     * @param request:
     * @param openid:
     * @return cn.pluss.platform.wx.WxUserInfoResponse
     */
    WxUserInfoResponse getWxUserInfo(WxAccessTokenRequest request,String openid);

    /**
     * 获取微信带参数的二维码
     * @date: 2021/12/9 11:21
     * @param tokenRequest:
     * @param qrCodeRequest:
     * @return cn.pluss.platform.wx.WxCreateQrCodeResponse
     */
    WxCreateQrCodeResponse getWxQrCode(WxAccessTokenRequest tokenRequest,WxCreateQrCodeRequest qrCodeRequest);

    /**
     * 获取ticket
     * @date: 2022/1/19 14:01
     * @param request:
     * @param type:
     * @return java.lang.String
     */
    String getJsapiTicket(WxAccessTokenRequest request,String type);

    /**
     * 获取微信jsapi校验参数
     * @date: 2022/3/10 15:27
     * @param request:
     * @return com.alibaba.fastjson.JSONObject
     */
    JSONObject getJsApiConfigParam(HttpServletRequest request);

    /**
     * 获取小程序 scheme 码
     * @param request
     * @return
     */
    WxUrlschemeResponse getUrlecheme(WxAccessTokenRequest request,WxJumpWxa wxJumpWxa);
}
