using System;
using System.Reflection;
using System.Windows.Forms;

namespace StartServerWPF.Modules.Main.Models
{
    public class MsEventModel
    {
        public int ID { get; set; }
        public DateTime CurrentTime { get; set; }
        public DateTime OriginTime { get; set; }
        public double EastCoordinate { get; set; }
        public double NorthCoordinate { get; set; }
        public double Depth { get; set; }    

        public double ML { get; set; }
        public double Energy { get; set; }

        public int EarthquakeSource { get; set; }

        public bool IsSend { get; set; } = false;

        public MsEventModel(string message)
        {
            this.eventMessage = message;
            string[] evtS = message.Trim(' ').Split(new char[] { ' ' });
            CurrentTime = DateTime.Now;
            OriginTime = DateTime.Parse(evtS[0]);
            EastCoordinate = double.Parse(evtS[2]);
            NorthCoordinate = double.Parse(evtS[1]);
            Depth = double.Parse(evtS[3]);
            ML = (evtS.Length == 7) ?- 10: double.Parse(evtS[5]);
        }
        private  string eventMessage;
        public override string ToString()
        {       
            return eventMessage;
        }
    }
}
