using Senparc.Weixin.MP.AdvancedAPIs.OAuth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using YBDevice.Entity;

namespace YBDevice.NApi
{
    public interface IOrderService
    {
        /// <summary>
        /// 更新八电极推送的消息数据记录
        /// </summary>
        /// <param name="resultid"></param>
        /// <param name="userinfo"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        Task UpdateBodyResultAsync(Guid resultid, OAuthUserInfo userinfo, OrderInfo order);
        /// <summary>
        /// 获取可用的订单
        /// </summary>
        /// <param name="equ">设备信息</param>
        /// <param name="userinfo">用户资料</param>
        /// <param name="isdefault">1-获取小程序,2-链接,3-小程序,0-全部</param>
        /// <param name="isbind">是否为绑定处理,true-是</param>
        /// <param name="scantype">1-带测量参数的二维码,2-固定贴纸</param>
        /// <returns></returns>
        Task<OrderInfo> GetAsync(YB_Device equ, OAuthUserInfo userinfo, int isdefault = 0, bool isbind = false,int scantype=1);
        /// <summary>
        /// 获取固定贴纸订单
        /// </summary>
        /// <param name="equ">设备信息</param>
        /// <param name="userinfo">用户资料</param>
        /// <param name="ordertype">1-获取小程序,2-链接,3-小程序,0-全部</param>
        /// <returns></returns>
        Task<OrderInfo> GetOrderByStickerAsync(YB_Device equ, OAuthUserInfo userinfo, int ordertype = 0);
        /// <summary>
        /// 插入带测量参数扫码测量记录
        /// </summary>
        /// <param name="equ"></param>
        /// <param name="userinfo"></param>
        /// <param name="height"></param>
        /// <param name="weight"></param>
        /// <param name="type">1-单电阻,2-八电极</param>
        /// <param name="bodyimp"></param>
        /// <param name="leftfootimp"></param>
        /// <param name="rightfootimp"></param>
        /// <param name="lefthandimp"></param>
        /// <param name="righthandimp"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        Task InsertResultAsync(YB_Device equ, OAuthUserInfo userinfo, OrderInfo order, decimal height, decimal weight, int type = 1, decimal bodyimp = 0, decimal leftfootimp = 0, decimal rightfootimp = 0, decimal lefthandimp = 0, decimal righthandimp = 0);
        /// <summary>
        /// 插入固定二维码扫码记录
        /// </summary>
        /// <param name="equ"></param>
        /// <param name="userinfo"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        Task InsertResultAsync(YB_Device equ, OAuthUserInfo userinfo, OrderInfo order);

        /// <summary>
        /// 获取设备绑定的商户端小程序
        /// </summary>
        /// <param name="equ"></param>
        /// <param name="userinfo"></param>
        /// <returns></returns>
        Task<OrderInfo> GetDevMagOrderAsync(YB_Device equ, OAuthUserInfo userinfo);

        /// <summary>
        /// 获取带测量参数的二维码订单
        /// </summary>
        /// <param name="equ">设备信息</param>
        /// <param name="userinfo">用户资料</param>
        /// <param name="ordertype">1-设备管理,2-用户测量,3-用户绑定</param>
        /// <returns></returns>
        Task<OrderInfo> GetOrderByTrendAsync(YB_Device equ, OAuthUserInfo userinfo, int ordertype = 2);

        /// <summary>
        /// 处理固定贴纸图文链接
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="openid"></param>
        /// <param name="type"></param>
        /// <param name="fansid"></param>
        /// <param name="resultid"></param>
        /// <returns></returns>
        Task<OrderInfo> HandlerStickySubscribeAsync(string appid, string openid, int type, string fansid, Guid? resultid);

        /// <summary>
        /// 处理带参数二维码图文链接
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="openid"></param>
        /// <param name="type"></param>
        /// <param name="fansid"></param>
        /// <param name="resultid"></param>
        Task<OrderInfo> HandlerResultSubscribeAsync(string appid, string openid, int type, string fansid, Guid? resultid);

        /// <summary>
        /// 获取八电极小程序订单
        /// </summary>
        /// <returns></returns>
        Task<OrderInfo> GetBodyOrderAsync(YB_Device equ, OAuthUserInfo userinfo);
    }
}
