using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Model { /// /// define a lobby for QMC rapidity fight /// attributes : /// id : identifier of the lobby in the database /// name : name of the lobby /// password : password require to access at the lobby /// idCreator : identifier of the creator player /// creator : the creator player /// public class Lobby { private uint id; private string? name; private string? password; private uint nbPlayers; private uint? idCreator; private Player creator; // getters and setters of attributes public uint Id { get => id; private set { id = value; } } public string Name { get => name == null ? "" : name; private set { name = value == "" ? null : value; } } public string Password { get => password == null ? "" : password; private set { password = value == "" ? null : value; } } public uint NbPlayers { get => nbPlayers; set { nbPlayers = value; } } public uint? IdCreator { get => idCreator; private set { idCreator = value; } } public Player Creator { get => creator; set { creator = value; idCreator = value.Id; } } /// /// constructor of a lobby /// /// the name of the lobby /// the creator /// the password require to access to the lobby /// the number of players in the lobby /// the id of the lobby public Lobby(string name, Player creator, string password = "", uint nbPlayers = 0, uint id = 0) { Name = name; Creator = creator; Password = password; NbPlayers = nbPlayers; Id = id; } } }