package com.bohuikeji.delivery.backstage.service;

import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.bohuikeji.delivery.backstage.constants.WxAppEm;
import com.bohuikeji.delivery.backstage.entity.TCustomer;
import com.bohuikeji.delivery.backstage.entity.TOrder;
import com.bohuikeji.delivery.backstage.entity.wx.TWxUser;
import com.bohuikeji.frame.module.admin.base.ServiceBase;

/**
 * 用户微信账号接口
 * @author 孙劲辉
 */
public interface IWxUserService extends ServiceBase<TWxUser> {

    /**
     * 获取授权用户信息
     * @param userId 用户ID
     * @param type 用户类型
     * @param app APP
     * @return
     */
    TWxUser getUserByType(Integer userId, String type, WxAppEm app);

    /**
     * 获取登陆用户授权用户信息
     * @param userId 用户ID
     * @param type 用户类型
     * @param app APP
     * @return
     */
    TWxUser getUserByLogin(Integer userId,String openId,String type, WxAppEm app);

    /**
     * 获取公众自动授权链接
     * <p>授权成功后用户授权信息保存于t_wx_user表中</p>
     * @param userId 用户ID
     * @param userType 用户类型
     * @param gzh 公众号APP
     * @return
     */
    String getGzhAutoUrl(Integer userId,String userType,String path,WxAppEm gzh);

    /**
     * 快手支付宝授权绑定账户
     * @param order
     * @return
     */
    TWxUser saveLoginWxUser(JSONObject res, WxAppEm app,Integer courierId);


    /**
     * 快手支付宝授权绑定账户
     * @param order
     * @return
     */
    TWxUser saveWxUser(TOrder order);

    /**
     * 登陆授权绑定openId
     * @param grantCode
     * @param loginType
     * @param customer
     * @return
     * @throws AlipayApiException
     */
    TWxUser saveCusOrWxUser(String grantCode,String loginType,TCustomer customer) throws AlipayApiException;

    //boolean getBinding(TOrder tOrder,TCustomer customer);

}
