using System.Runtime.Serialization;
namespace Models
{
///
/// Publics informations of a user
///
[DataContract]
public class User
{
///
/// The profile picture
///
[DataMember]
public Uri ProfilePicture { get; init; }
///
/// The username
///
[DataMember]
public string Name { get; init; }
///
/// An unique identifier
///
[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();
}
}
}