using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.src.Skyscraper.Scraper.Storage.Utilities
{
	public class DatabaseKeyRmtLinkage
	{
		public DatabaseKeyRmtLinkage(ushort transportStreamId, ushort originalNetworkId, ushort serviceId, byte linkageType, ushort interactiveNetworkId)
		{
			TransportStreamId = transportStreamId;
			OriginalNetworkId = originalNetworkId;
			ServiceId = serviceId;
			LinkageType = linkageType;
			InteractiveNetworkId = interactiveNetworkId;
		}

		public ushort TransportStreamId { get; }
		public ushort OriginalNetworkId { get; }
		public ushort ServiceId { get; }
		public byte LinkageType { get; }
		public ushort InteractiveNetworkId { get; }

		public override bool Equals(object obj)
		{
			return obj is DatabaseKeyRmtLinkage linkage &&
				   TransportStreamId == linkage.TransportStreamId &&
				   OriginalNetworkId == linkage.OriginalNetworkId &&
				   ServiceId == linkage.ServiceId &&
				   LinkageType == linkage.LinkageType &&
				   InteractiveNetworkId == linkage.InteractiveNetworkId;
		}

		public override int GetHashCode()
		{
			return HashCode.Combine(TransportStreamId, OriginalNetworkId, ServiceId, LinkageType, InteractiveNetworkId);
		}

		public override string ToString()
		{
			return String.Format("RMT Linkage: {4} -> {1},{0}, SID {2}, Type {3}", TransportStreamId, OriginalNetworkId, ServiceId, LinkageType, InteractiveNetworkId);
		}
	}
}
