using Edge.Core.Domain.FccOrderInfo;
using HengshanPaymentTerminal.MessageEntity.Incoming;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HengshanPaymentTerminal.Http.Request
{
    public class HttpRequest
    {
    }

    /// <summary>
    /// 发送油枪信息到云端数据对象
    /// </summary>
    public class SendNozzleInfo : HttpRequest
    {
        /// <summary>
        /// 加油点
        /// </summary>
        public int PumpId { get; set; }

        /// <summary>
        /// 内部枪号
        /// </summary>
        public int InternalGunNumber { get; set; }

        /// <summary>
        /// 外部枪号
        /// </summary>
        public int ExternalGunNumber { get; set; }

        /// <summary>
        /// 油罐号
        /// </summary>
        public int TankNumber { get; set; }

        /// <summary>
        /// 油罐容量
        /// </summary>
        public decimal TankCapacity { get; set; }

        /// <summary>
        /// 油品名
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// 油品吗
        /// </summary>
        public int ProductCode { get; set; }

        /// <summary>
        /// 油品单价
        /// </summary>
        public decimal ProductPrice { get; set; }

        /// <summary>
        /// 1：创建；2：修改；3：删除
        /// </summary>
        public int type { get; set; }
    }

    /// <summary>
    /// fcc 发送订单给云端数据对象
    /// </summary>
    public class CreateTransaction : HttpRequest
    {
        public CreateTransaction(FccOrderInfo fccOrderInfo,string auserID) 
        {
            this.NozzleId = fccOrderInfo.NozzleNum;
            this.OriginalAmount = fccOrderInfo.Amount;
            this.ActualPaymentAmount = fccOrderInfo.AmountPayable;
            this.Qty = fccOrderInfo.Volume;
            this.FuelItemTransactionEndTime = fccOrderInfo.EndTime ?? DateTime.Now;
            this.TransactionTime = fccOrderInfo.PaymentTime;
            this.Product = fccOrderInfo.OilName;
            if(fccOrderInfo.CloundOrderId == null)
            {
                this.type = 2;
            } else
            {
                this.type = 1;
            }
            
            this.userid = auserID;
        }

        /// <summary>
        /// 油枪号
        /// </summary>
        public int NozzleId { get; set; }

        /// <summary>
        /// 实际加油金额
        /// </summary>
        public decimal OriginalAmount { get; set; }

        /// <summary>
        /// 实际支付金额
        /// </summary>
        public decimal? ActualPaymentAmount { get; set; }

        /// <summary>
        /// 升数
        /// </summary>
        public decimal Qty { get; set; }

        /// <summary>
        /// 挂枪时间
        /// </summary>
        public DateTime FuelItemTransactionEndTime { get; set; }

        /// <summary>
        /// 交易时间
        /// </summary>
        public DateTime? TransactionTime { get; set; }

        /// <summary>
        /// 油品名
        /// </summary>
        public string Product { get; set; }

        /// <summary>
        /// 1：预支付；2：后支付
        /// </summary>
        public int type { get; set; }

        /// <summary>
        /// 用户id,预支付时候传入
        /// </summary>
        public string? userid { get; set; }
    }

    /// <summary>
    /// 发送云端油枪状态数据对象
    /// </summary>
    public class SendNozzleStatu : HttpRequest
    {
        public SendNozzleStatu(HeartBeatNozzleState heartBeatNozzleState) 
        {
            this.NozzleId = heartBeatNozzleState.NozzleNum;
            this.Status = heartBeatNozzleState.STATU == 0x03 ? 1 : 2;
        }
        /// <summary>
        /// 油枪号
        /// </summary>
        public int NozzleId { get; set; }

        /// <summary>
        /// 状态：1：空闲；2：非空闲
        /// </summary>
        public int Status { get; set; }
    }
}
