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

namespace Model
{
    /// <summary>
    /// define an administrator
    /// attributes :
    ///     id : identifier in the database
    ///     username : username for a administrator
    ///     hashedPassword : hash of the password of the administrator
    /// </summary>
    public class Administrator
    {
        private int id;
        private string? username;
        private string? hashedPassword;
        //      getters and setters for attributes
        public int Id
        {
            get => id;
            private set { id = value; }
        }
        public string Username
        {
            get { return username == null ? "" : username; }
            private set { username = value == "" ? null : value; }
        }
        public string HashedPassword
        {
            get => hashedPassword == null ? "" : hashedPassword;
            set { hashedPassword = value == "" ? null : value; }
        }

        /// <summary>
        /// constructor of an administrator
        /// </summary>
        /// <param name="username">the username of the administrator</param>
        /// <param name="hashedPassword">the hash of the password of the administrator</param>
        /// <param name="id">the id in the database</param>
        public Administrator(string username, string hashedPassword, int id = 0)
        {
            this.Username = username;
            this.HashedPassword = hashedPassword;
            this.Id = id;
        }
    }
}
