using Nirvana.Common.ApiBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using YBDevice.Entity;

namespace YBDevice.NApi
{
    /// <summary>
    /// 小程序管理
    /// </summary>
    public interface IWxOpenService
    {
        /// <summary>
        /// wx.login登陆成功之后发送的请求
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> OnLoginAsync(WXOpenLoginSubmitModel model);

        /// <summary>
        /// 检查登录状态是否已失效
        /// </summary>
        /// <param name="sessionId"></param>
        /// <returns></returns>
        Task<ResultInfo> CheckStatusAsync(string sessionId);

        /// <summary>
        /// 解密用户资料,如果未注册则自动进行注册,否则更新资料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DecryptDataAsync(WxOpenDecryptSubmitModel model);

        /// <summary>
        /// 解密用户资料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DecryptUserInfoAsync(WxOpenDecryptSubmitModel model);

        /// <summary>
        /// 手机号授权,如果未注册会自动进行注册
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DecryptPhoneAsync(WxOpenDecryptSubmitModel model);

        /// <summary>
        /// 根据手机号进行注册
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> RegisterAsync(RegModel model);
        /// <summary>
        /// 检查登录状态
        /// </summary>
        /// <param name="sessionId"></param>
        /// <returns></returns>
        Task<ResultInfo> CheckLoginAsync(string sessionId);

        #region 新版用户注册流程,2021/11/26
        /// <summary>
        /// 解密用户资料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DeUserInfoAsync(WxOpenDecryptSubmitModel model);
        /// <summary>
        /// 解密手机号
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DeUserPhone(WxOpenDecryptSubmitModel model);
        /// <summary>
        /// 根据手机号进行注册
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<ResultInfo> DeRegisterAsync(RegModel model);
        /// <summary>
        /// 获取小程序升级信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<ResultInfo> UpgradeAsync(WxOpenUpgradeC2SDto input);
        #endregion
    }
}
