using System;

namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory.Model
{
    internal struct InMemoryPatEntry : IEquatable<InMemoryPatEntry>
    {
        public InMemoryPatEntry(int networkId, int transportStreamId, int pmtPid, ushort programId)
        {
            this.networkId = networkId;
            this.transportStreamId = transportStreamId;
            this.pmtPid = pmtPid;
            this.programId = programId;
        }

        public int networkId, transportStreamId, pmtPid;
        public ushort programId;

        public bool Equals(InMemoryPatEntry other)
        {
            return networkId == other.networkId && transportStreamId == other.transportStreamId && pmtPid == other.pmtPid && programId == other.programId;
        }

        public override bool Equals(object obj)
        {
            return obj is InMemoryPatEntry other && Equals(other);
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(networkId, transportStreamId, pmtPid, programId);
        }

        public static bool operator ==(InMemoryPatEntry left, InMemoryPatEntry right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(InMemoryPatEntry left, InMemoryPatEntry right)
        {
            return !left.Equals(right);
        }
    }
}
