using System; using System.Collections.Generic; using System.Collections; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Runtime.CompilerServices; namespace MCTGLib { /// /// A user is an entity with a name, a surname, mail, profilePict and a list of priority. /// This user can login with a Id and password /// public class User { #region Private Attributes private string name; private string surname; private string mail; #endregion #region Properties private string picture; /// /// For now, we define the ProfilPict as a string which is "PhotoParDefaut" /// when the value is null. /// public string ProfilPict { get => picture; set { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException("Erreur pour la photo d'utilisateur!"); } } /// /// Property to get Name of users and a setter /// /// Setter have Exception which is trigger when Name is null public string Name { get { return name; } private set { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException("Il y a une erreur de Nom d'utilisateur!"); } name = value; } } /// /// Property to get Surname of users and a setter /// /// Setter have Exception which is trigger when Surname is null public string Surname { get { return surname; } private set { if (string.IsNullOrWhiteSpace(value)) { throw new ArgumentNullException("Il y a une erreur de Prénom d'utilisateur"); } surname = value; } } public string Mail { get { return mail; } private set { mail = value; } } private List priorities; public List Priorities { get => priorities; set=> priorities = value; } #endregion #region Constructors /// /// Construtors of user. /// public User(string name, string surname, string mail) { Name = name; Surname = surname; Mail = mail; priorities = new List { Priority.Gourmet, Priority.Economic, Priority.Fast, Priority.Light, Priority.Easy}; ProfilPict = picture; } #endregion } }