using System;
using skyscraper5.Skyscraper.Drawing;

namespace skyscraper5.Skyscraper.Gps
{
	public class SatelliteBeamFootprint
	{
		public int BeamId { get; }
		public DateTime ProcessTimestamp { get; }
		public string Name { get; }
		public DateTime DateAdded { get; }
		public string PolygonId { get; }
		public Polygon Polygon { get; private set; }

		public SatelliteBeamFootprint(int beamId, DateTime processTimestamp, string name, string polygon, DateTime dateAdded, string polygonId)
		{
			BeamId = beamId;
			ProcessTimestamp = processTimestamp;
			Name = name;
			DateAdded = dateAdded;
			PolygonId = polygonId;
			Polygon = new Polygon(polygon);
		}

		protected bool Equals(SatelliteBeamFootprint other)
		{
			return BeamId == other.BeamId && ProcessTimestamp.Equals(other.ProcessTimestamp) && Name == other.Name && PolygonId == other.PolygonId;
		}

		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((SatelliteBeamFootprint)obj);
		}

		public override int GetHashCode()
		{
			return HashCode.Combine(BeamId, ProcessTimestamp, Name, PolygonId);
		}

		public override string ToString()
		{
			return $"{nameof(BeamId)}: {BeamId}, {nameof(Name)}: {Name}";
		}
	}
}
