using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// define a player
    /// attributes :
    ///     id : identifier in the database
    ///     nickname : nickname for the player
    ///     hashedPassword : hashed of the password of the player
    /// </summary>
    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; }
        }

        /// <summary>
        /// constructor of a player
        /// </summary>
        /// <param name="nickname">nickname of the player</param>
        /// <param name="hashedPassword">hash of the password of the player</param>
        /// <param name="id">id of the player</param>
        public Player(string nickname, string hashedPassword = "", int id = 0)
        {
            Nickname = nickname;
            HashedPassword = hashedPassword;
            Id = id;
        }
    }
}
