using System;

namespace skyscraper5.Skyscraper.Scraper.Storage.Utilities
{
	public class DatabaseKeyDsmCcModule
	{
		public int CurrentNetworkId { get; }
		public int CurrentTransportStreamId { get; }
		public int ElementaryPid { get; }
		public ushort ModuleId { get; }
		public byte ModuleVersion { get; }

		public DatabaseKeyDsmCcModule(int currentNetworkId, int currentTransportStreamId, int elementaryPid, ushort moduleId, byte moduleVersion)
		{
			CurrentNetworkId = currentNetworkId;
			CurrentTransportStreamId = currentTransportStreamId;
			ElementaryPid = elementaryPid;
			ModuleId = moduleId;
			ModuleVersion = moduleVersion;
		}

		protected bool Equals(DatabaseKeyDsmCcModule other)
		{
			return CurrentNetworkId == other.CurrentNetworkId && CurrentTransportStreamId == other.CurrentTransportStreamId && ElementaryPid == other.ElementaryPid && ModuleId == other.ModuleId && ModuleVersion == other.ModuleVersion;
		}

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

		public override int GetHashCode()
		{
			return HashCode.Combine(CurrentNetworkId, CurrentTransportStreamId, ElementaryPid, ModuleId, ModuleVersion);
		}
	}
}
