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

namespace skyscraper8.Skyscraper.Scraper.Storage.Utilities
{
	public class DatabaseKeyNipService
	{
		public DatabaseKeyNipService(BroadcastMediaStreamType mediaStreamType)
		{
			this.LinkId = mediaStreamType.NIPLinkID;
			this.CarrierId = mediaStreamType.NIPCarrierID;
			this.NetworkId = mediaStreamType.NIPNetworkID;
			this.ServiceId = mediaStreamType.NIPServiceID;
		}

		public string LinkId { get; }
		public string CarrierId { get; }
		public ushort NetworkId { get; }
		public ushort ServiceId { get; }

		public override bool Equals(object? obj)
		{
			return obj is DatabaseKeyNipService service &&
				   LinkId == service.LinkId &&
				   CarrierId == service.CarrierId &&
				   NetworkId == service.NetworkId &&
				   ServiceId == service.ServiceId;
		}

		public override int GetHashCode()
		{
			return HashCode.Combine(LinkId, CarrierId, NetworkId, ServiceId);
		}
	}
}
