using System;
using System.Reflection;

namespace Txgy.RBS.Framework.Models
{
    public class MsEventModel
    {
        public int ProjectId { get; set; }
        public string ProjectName { 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 PhasesCount {  get; set; }   
        public int AmpsCount { get; set; }
        public int EarthquakeSource { get; set; }

        public bool IsSend { get => isSend; set => isSend = value; }
        public MsEventModel(string message)
        {
            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;
        private bool isSend = false;

        public override string ToString()
        {
            return eventMessage;
        }
    }
}
