using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronIntel.Contractor.Machines
{
    public class OdometerInfo
    {
        public long AssetID { get; set; }
        public string DataSource { get; set; }
        public string SubSource { get; set; }
        public string DataSourceName { get; set; }
        public DateTime AsofTime { get; set; }
        public DateTime AsofTimeLocal { get; set; }
        public bool IsPrimary { get; set; }

        public string UOM { get; set; }

        private double _Odometer;
        public double Odometer
        {
            get
            {
                return _Odometer;
            }
            set
            {
                value = value > 0 ? value : 0;
                _Odometer = Math.Round(value, 2);
            }
        }

        private double _Corrected;
        public double Corrected
        {
            get
            {
                return _Corrected;
            }
            set
            {
                value = value > 0 ? value : 0;
                _Corrected = Math.Round(value, 2);
            }
        }
        public string ReceivedDateStr
        {
            get
            {
                return AsofTimeLocal.ToString();
            }
        }
    }

    public class AdjustOdometerInfo
    {
        public string CustomerID { get; set; }
        public long AssetID { get; set; }
        public DateTime OdometerDate { get; set; }
        public string UOM { get; set; }

        private double _Odometer;
        public double Odometer
        {
            get
            {
                return _Odometer;
            }
            set
            {
                value = value > 0 ? value : 0;
                _Odometer = Math.Round(value, 2);
            }
        }
        public string Notes { get; set; }

        /// <summary>
        /// 前端选择的时区的分钟偏移
        /// </summary>
        public int OffsetMinute { get; set; }
    }
    public class CalampOdometerInfo
    {
        public long AssetId { get; set; }
        public string DeviceAirId { get; set; }
        public DateTime AsofTime { get; set; }
        public string UOM { get; set; }
        public double Gps { get; set; }
        public double Gps_Calc { get; set; }
        public double VBUS { get; set; }
        public double VBUS_Calc { get; set; }
        public string EventTimeText
        {
            get
            {
                return AsofTime.ToString("MM/dd/yyyy HH:mm");
            }
        }
        public DateTime AsofTime_Local { get; set; }
        public string EventTimeLocalText
        {
            get
            {
                return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
            }
        }
    }


    public class PedigreeOdometerInfo
    {
        public long AssetId { get; set; }
        public string DeviceSN { get; set; }
        public DateTime AsofTime { get; set; }
        public string UOM { get; set; }
        public double Gps { get; set; }
        public double Gps_Calc { get; set; }
        public double VBUS { get; set; }
        public double VBUS_Calc { get; set; }
        public string EventTimeText
        {
            get
            {
                return AsofTime.ToString("MM/dd/yyyy HH:mm");
            }
        }
        public DateTime AsofTime_Local { get; set; }
        public string EventTimeLocalText
        {
            get
            {
                return AsofTime_Local.ToString("MM/dd/yyyy HH:mm");
            }
        }
    }

    public class PrimaryDataSourceInfo
    {
        public int Type { get; set; } //Odometer:0,EngineHours:1
        public string CustomerID { get; set; }
        public long AssetID { get; set; }
        public string DataSource { get; set; }
        public string SubSource { get; set; }
        public string Notes { get; set; }
    }

    public class AssetOdometerAdjustItem
    {
        public long LogId { get; set; }
        public long AssetId { get; set; }
        public DateTime AdjustmentTime { get; set; }
        public string AdjustmentTimeText { get { return AdjustmentTime.ToString("MM/dd/yyyy HH:mm"); } }
        public DateTime OdometerTime { get; set; }
        public string OdometerTimeText { get { return OdometerTime.ToString("MM/dd/yyyy HH:mm"); } }
        public DateTime AdjustmentLocalTime { get; set; }
        public string AdjustmentLocalTimeText { get { return AdjustmentLocalTime.ToString("MM/dd/yyyy HH:mm"); } }
        public DateTime OdometerLocalTime { get; set; }
        public string OdometerLocalTimeText { get { return OdometerLocalTime.ToString("MM/dd/yyyy HH:mm"); } }

        private double _Odometer;
        public double Odometer
        {
            get
            {
                return _Odometer;
            }
            set
            {
                value = value > 0 ? value : 0;
                _Odometer = Math.Round(value, 2);
            }
        }
        public string UOM { get; set; }
        public string Notes { get; set; }
        public string UserName { get; set; }
    }
}
