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

namespace IronIntel.Contractor.OTRConfig
{
    public class HarshDrivingItem
    {
        public long LogID { get; set; }
        public long AssetID { get; set; }
        public string Name { get; set; }
        public string Name2 { get; set; }
        public string VIN { get; set; }
        public int MakeID { get; set; }
        public int TypeID { get; set; }
        public int ModelID { get; set; }
        public string MakeName { get; set; }
        public string ModelName { get; set; }
        public string TypeName { get; set; }

        public DateTime AsofTime { get; set; }
        public string AsofTimeStr { get { return AsofTime == DateTime.MinValue ? "" : AsofTime.ToString(); } }
        public DateTime AsofTimeLocal { get; set; }
        public string AsofTimeLocalStr { get { return AsofTimeLocal == DateTime.MinValue ? "" : AsofTimeLocal.ToString(); } }
        public string EventType { get; set; }
        public string Street { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string PostalCode { get; set; }
        public string Country { get; set; }
        public double StartingSpeed { get; set; }
        public string SpeedUnits { get; set; }
        public double Duration { get; set; }
        public string DurationUnits { get; set; }
        public double Magnitude { get; set; }
        public string MagnitudeUnits { get; set; }
        public bool Excluded { get; set; }

        public HarshDrivingEvents HarshDringEvent { get; set; }
        public SpeedingBehaviors SpeedingBehavior { get; set; }
        public string ShowName
        {
            get
            {
                string name = Name2;
                if (string.IsNullOrWhiteSpace(name))
                    name = Name;
                if (string.IsNullOrWhiteSpace(name))
                    name = VIN;
                if (string.IsNullOrWhiteSpace(name))
                    name = AssetID.ToString();
                return name;
            }
        }
        public string EventDesc
        {
            get
            {
                string desc = EventType;
                if (string.Compare(desc, "ACCEL", true) == 0)
                    desc = "Hard Acceleration";
                else if (string.Compare(desc, "DECEL", true) == 0)
                    desc = "Hard Brake";
                else if (string.Compare(desc, "HARD_CORNERING_LEFT", true) == 0 || string.Compare(EventType, "HARD_CORNERING_RIGHT", true) == 0)
                    desc = "Hard Turn";
                return desc;
            }
        }
    }
    public class HarshDrivintClient
    {
        public long LogID { get; set; }
        public long AssetID { get; set; }
        public bool Excluded { get; set; }
        public string Notes { get; set; }
    }

    public enum HarshDrivingEvents
    {
        None = 0,
        HardAccelerationEvent = 1,
        HardBrakeEvent = 2,
        HardTurnEvent = 3
    }

    public enum SpeedingBehaviors
    {
        None = 0,
        MinorSpeeding = 1,
        SevereSpeeding = 2
    }
}
