using System;

namespace skyscraper5.Skyscraper.Scraper.Storage.Utilities
{
    public class DatabaseKeySdtService
    {
        public ushort TransportStreamId { get; }
        public ushort OriginalNetworkId { get; }
        public ushort ServiceId { get; }

        public DatabaseKeySdtService(ushort transportStreamId, ushort originalNetworkId, ushort serviceId)
        {
            TransportStreamId = transportStreamId;
            OriginalNetworkId = originalNetworkId;
            ServiceId = serviceId;
        }

        protected bool Equals(DatabaseKeySdtService other)
        {
            return TransportStreamId == other.TransportStreamId && OriginalNetworkId == other.OriginalNetworkId && ServiceId == other.ServiceId;
        }

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

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