using System;

namespace skyscraper5.Skyscraper.Scraper.Storage.Utilities
{
	public class DatabaseKeyAprsPosition
	{
		public DateTime Timestamp { get; }
		public string Sender { get; }
		public double Longitude { get; }
		public double Latitude { get; }

		public DatabaseKeyAprsPosition(DateTime timestamp, string sender, double longitude, double latitude)
		{
			Timestamp = timestamp;
			Sender = sender;
			Longitude = longitude;
			Latitude = latitude;
		}

		protected bool Equals(DatabaseKeyAprsPosition other)
		{
			return Timestamp.Equals(other.Timestamp) && Sender == other.Sender && Longitude.Equals(other.Longitude) && Latitude.Equals(other.Latitude);
		}

		public override bool Equals(object obj)
		{
			if (ReferenceEquals(null, obj)) return false;
			if (ReferenceEquals(this, obj)) return true;
			if (obj.GetType() != this.GetType()) return false;
			return Equals((DatabaseKeyAprsPosition)obj);
		}

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