using System.Runtime.Serialization;

namespace Models
{
    [DataContract]
    public class User
    {
        [DataMember]
        public Uri ProfilePicture { get; init; }
        [DataMember]
        public string Name { get; init; }
        [DataMember]
        public Guid Id { get; init; }

        public User(Uri profilePicture, string name, Guid id)
        {
            ProfilePicture = profilePicture;
            Name = name;
            Id = id;
        }

        public override bool Equals(object? other)
        {
            if (this == other) 
                return true;

            User? otherUser = other as User;
            return otherUser != null && Id.Equals(otherUser.Id);
        }

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