using System;
using System.Collections.Generic;

namespace skyscraper5.Skyscraper.Scraper.Storage.Utilities
{
    public class DatabaseKeyInt : IEquatable<DatabaseKeyInt>
    {
        public DatabaseKeyInt(uint id)
        {
            Id = id;
        }

        public uint Id { get; }

        public override bool Equals(object obj)
        {
            return Equals(obj as DatabaseKeyInt);
        }

        public bool Equals(DatabaseKeyInt other)
        {
            return other is not null &&
                   Id == other.Id;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(Id);
        }

        public static bool operator ==(DatabaseKeyInt left, DatabaseKeyInt right)
        {
            return EqualityComparer<DatabaseKeyInt>.Default.Equals(left, right);
        }

        public static bool operator !=(DatabaseKeyInt left, DatabaseKeyInt right)
        {
            return !(left == right);
        }
    }
}
