using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
///
/// define an administrator
/// attributes :
/// id : identifier in the database
/// username : username for a administrator
/// hashedPassword : hash of the password of the administrator
///
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; }
}
///
/// constructor of an administrator
///
/// the username of the administrator
/// the hash of the password of the administrator
/// the id in the database
public Administrator(string username, string hashedPassword, int id = 0)
{
this.Username = username;
this.HashedPassword = hashedPassword;
this.Id = id;
}
}
}