using System;
using System.Globalization;

namespace skyscraper5.Skyscraper.Gps
{
	public struct GpsCoordinate
	{
		public GpsCoordinate(float lon, float lat)
		{
			this.Latitude = lat;
			this.Longitude = lon;
		}

		public float Latitude { get; set; }

		public float Longitude { get; set; }

		public bool Equals(GpsCoordinate other)
		{
			return Latitude.Equals(other.Latitude) && Longitude.Equals(other.Longitude);
		}

		public override bool Equals(object obj)
		{
			return obj is GpsCoordinate other && Equals(other);
		}

		public override int GetHashCode()
		{
			return HashCode.Combine(Latitude, Longitude);
		}

		public override string ToString()
		{
			return String.Format("{0}, {1}", Latitude.ToString(CultureInfo.InvariantCulture), Longitude.ToString(CultureInfo.InvariantCulture));
		}

		public GpsCoordinate Clone()
		{
			GpsCoordinate copy = new GpsCoordinate();
			copy.Latitude = this.Latitude;
			copy.Longitude = this.Longitude;
			return copy;
		}
	}
}
