namespace Mapbox.Unity.Location
{
	using Mapbox.Utils;
    using System.Diagnostics;
    /// 
    /// Location contains heading, latitude, longitude, accuracy and a timestamp.
    /// 
    [DebuggerDisplay("{LatitudeLongitude,nq} {Accuracy}m hdg:{UserHeading} orientation:{DeviceOrientation}")]
	public struct Location
	{
		/// 
		/// The location, as descibed by a . 
		/// Location.x represents Latitude.
		/// Location.y represents Longitude.
		/// 
		public Vector2d LatitudeLongitude;
		/// 
		/// Heading represents a angle of direction during movement, generally between 0-359.
		///Initially 0 this property gets populated after the device has moved far enough to determine a direction
		///If the device stops moving last heading is kept till a new one can be caluculated. Check 
		///Also needs location services enabled via Input.location.Start()
		///related 
		/// 
		public float UserHeading;
		/// 
		///Orientation (where the device is looking).
		///Uses device compass
		///related 
		/// 
		public float DeviceOrientation;
		/// 
		/// UTC Timestamp (in seconds since 1970) when location was last updated.
		/// 
		public double Timestamp;
		/// 
		/// UTC Timestamp (in seconds since 1970) of the device when OnLocationUpdated was fired.
		/// 
		public double TimestampDevice;
		/// 
		/// Horizontal Accuracy of the location.
		/// 
		public float Accuracy;
		/// 
		/// Is the location service currently initializing?
		/// 
		public bool IsLocationServiceInitializing;
		/// 
		/// Has the location service been enabled by the user?
		/// 
		public bool IsLocationServiceEnabled;
		/// 
		/// Has the location changed since last update?
		/// 
		public bool IsLocationUpdated;
		/// 
		/// Has the location been aquired via a GPS fix. 'Null' if not supported by the active location provider or GPS not enabled.
		/// 
		public bool? HasGpsFix;
		/// 
		/// How many satellites were in view when the location was acquired. 'Null' if not supported by the active location provider or GPS not enabled.
		/// 
		public int? SatellitesInView;
		/// 
		/// How many satellites were used for the location. 'Null' if not supported by the active location provider or GPS not enabled.
		/// 
		public int? SatellitesUsed;
		/// 
		/// Speed in [meters/second]. 'Null' if not supported by the active location provider.
		/// 
		public float? SpeedMetersPerSecond;
		/// 
		/// Speed in [km/h]. 'Null' if not supported by the active location provider.
		/// 
		public float? SpeedKmPerHour
		{
			get
			{
				if (!SpeedMetersPerSecond.HasValue) { return null; }
				return SpeedMetersPerSecond * 3.6f;
			}
		}
		/// 
		/// Name of the location provider. GPS or network or 'Null' if not supported by the active location provider.
		/// 
		public string Provider;
		/// 
		/// Name of the location provider script class in Unity
		/// 
		public string ProviderClass;
		/// 
		/// Has the heading changed since last update?
		/// 
		public bool IsUserHeadingUpdated;
	}
}