using skyscraper5.Mhp.Si.Model;

namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory.Model
{
    internal class AitApplicationCoordinate
    {
        public uint OrganisationId { get; }
        public ushort ApplicationId { get; }
        public AitApplication PointingTo { get; set; }

        public AitApplicationCoordinate(uint organisationId, ushort applicationId)
        {
            OrganisationId = organisationId;
            ApplicationId = applicationId;
        }

        protected bool Equals(AitApplicationCoordinate other)
        {
            return OrganisationId == other.OrganisationId && ApplicationId == other.ApplicationId;
        }

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

        public override int GetHashCode()
        {
            unchecked
            {
                return ((int)OrganisationId * 397) ^ ApplicationId.GetHashCode();
            }
        }
    }
}
