using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
///
/// define a player
/// attributes :
/// id : identifier in the database
/// nickname : nickname for the player
/// hashedPassword : hashed of the password of the player
///
public class Player
{
private int id;
private string? nickname;
private string? hashedPassword;
// getters and setters for attributes
public int Id
{
get => id;
private set { id = value; }
}
public string Nickname
{
get => nickname == null ? "" : nickname;
private set { nickname = value == "" ? null : nickname; }
}
public string HashedPassword
{
get => hashedPassword == null ? "" : hashedPassword;
set { hashedPassword = value == "" ? null : value; }
}
///
/// constructor of a player
///
/// nickname of the player
/// hash of the password of the player
/// id of the player
public Player(string nickname, string hashedPassword = "", int id = 0)
{
Nickname = nickname;
HashedPassword = hashedPassword;
Id = id;
}
}
}