using System;

namespace skyscraper5.Skyscraper.Scraper.Storage.Utilities
{
    public class DatabaseKeyPatEntry
    {
        public int CurrentNetworkId { get; }
        public int CurrentTransportStreamId { get; }
        public ushort ProgramId { get; }

        public DatabaseKeyPatEntry(int currentNetworkId, int currentTransportStreamId, ushort programId)
        {
            CurrentNetworkId = currentNetworkId;
            CurrentTransportStreamId = currentTransportStreamId;
            ProgramId = programId;
        }

        protected bool Equals(DatabaseKeyPatEntry other)
        {
            return CurrentNetworkId == other.CurrentNetworkId && CurrentTransportStreamId == other.CurrentTransportStreamId && ProgramId == other.ProgramId;
        }

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

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