namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory.Model
{
    internal class Scte35SpliceCoordinate
    {
        public int CurrentNetworkId { get; }
        public int CurrentTransportStreamId { get; }
        public ushort ProgramNumber { get; }
        public uint SpliceInsertSpliceEventId { get; }

        public Scte35SpliceCoordinate(int currentNetworkId, int currentTransportStreamId, ushort programNumber, uint spliceInsertSpliceEventId)
        {
            CurrentNetworkId = currentNetworkId;
            CurrentTransportStreamId = currentTransportStreamId;
            ProgramNumber = programNumber;
            SpliceInsertSpliceEventId = spliceInsertSpliceEventId;
        }

        protected bool Equals(Scte35SpliceCoordinate other)
        {
            return CurrentNetworkId == other.CurrentNetworkId && CurrentTransportStreamId == other.CurrentTransportStreamId && ProgramNumber == other.ProgramNumber && SpliceInsertSpliceEventId == other.SpliceInsertSpliceEventId;
        }

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

        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = CurrentNetworkId;
                hashCode = (hashCode * 397) ^ CurrentTransportStreamId;
                hashCode = (hashCode * 397) ^ ProgramNumber.GetHashCode();
                hashCode = (hashCode * 397) ^ (int)SpliceInsertSpliceEventId;
                return hashCode;
            }
        }
    }
}
