using System;

namespace Valg.EVA.Skanning.Diagnostics
{
    public class DefaultMeasurementEventData : IMeasurementEventData
    {
        private TimeSpan timingResult;

        public DefaultMeasurementEventData(string eventGeoOrigin, int eventId, string eventName, string targetEnvironment)
        {
            EventGeoOrigin = eventGeoOrigin;
            EventTime = DateTime.Now;
            EventId = eventId;
            EventName = eventName;
            EventMachineOrigin = Environment.MachineName;
            TargetEnvironment = targetEnvironment;
        }

        public TimeSpan TimingResult
        {
            get { return timingResult; }
            set
            {
                timingResult = value;
                ElapsedTimeInMs = timingResult.TotalMilliseconds;
            }
        }

        public double ElapsedTimeInMs { get; private set; }
        public DateTime EventTime { get; }
        public int EventId { get; }
        public string EventName { get; }
        public string EventGeoOrigin { get; }
        public string EventMachineOrigin { get; }
        public string TargetEnvironment { get; }
    }
}
