You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.6 KiB
133 lines
4.6 KiB
using OrderCriterias;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ManagerInterfaces
|
|
{
|
|
|
|
/// <summary>
|
|
/// All methods to handle players
|
|
/// /!\ all methods returns a task
|
|
/// </summary>
|
|
/// <typeparam name="T">a DTO, Entity or Model player</typeparam>
|
|
public interface IPlayerManager<T>
|
|
{
|
|
/// <summary>
|
|
/// get the number of players
|
|
/// </summary>
|
|
/// <returns>the number of players</returns>
|
|
public int getNbPlayers();
|
|
/// <summary>
|
|
/// add a player
|
|
/// </summary>
|
|
/// <param name="player">the player to add</param>
|
|
/// <returns>
|
|
/// the player that corresponde to
|
|
/// the player added or the player equal to this
|
|
/// player if this player was already added
|
|
/// </returns>
|
|
public Task<T> addPlayer(T player);
|
|
/// <summary>
|
|
/// remove a player
|
|
/// </summary>
|
|
/// <param name="player">the player to remove</param>
|
|
/// <returns>
|
|
/// the player removed or null if
|
|
/// the player does not exist
|
|
/// </returns>
|
|
public Task<T?> removePlayer(T player);
|
|
/// <summary>
|
|
/// remove a player
|
|
/// </summary>
|
|
/// <param name="id">the identifier of the player to remove</param>
|
|
/// <returns>
|
|
/// the player removed or null if
|
|
/// the player does not exist
|
|
/// </returns>
|
|
Task<T?> removePlayer(int id);
|
|
/// <summary>
|
|
/// get a part of all players
|
|
/// </summary>
|
|
/// <param name="nb">the actual page</param>
|
|
/// <param name="count">number of players in a page</param>
|
|
/// <param name="orderCriteria">the order criteria</param>
|
|
/// <returns>
|
|
/// a set of the number of page and
|
|
/// all players in the database for
|
|
/// the page nb (or null if the page
|
|
/// does not exist (<=> (nb-1)*count outside
|
|
/// boundaries (0, getNbElement()-1)))
|
|
/// </returns>
|
|
public Task<(int nbPages, IEnumerable<T>? players)> getPlayers(int nb, int count, PlayerOrderCriteria orderCriteria = PlayerOrderCriteria.ById);
|
|
/// <summary>
|
|
/// get a player
|
|
/// </summary>
|
|
/// <param name="id">identifier of the player</param>
|
|
/// <returns>
|
|
/// the player with this id
|
|
/// or null if no player match
|
|
/// with this id
|
|
/// </returns>
|
|
public Task<T?> getPlayer(int id);
|
|
/// <summary>
|
|
/// get a player
|
|
/// </summary>
|
|
/// <param name="nickname">nickname of the player</param>
|
|
/// <returns>
|
|
/// the player with this nickname
|
|
/// or null if no player match
|
|
/// with this nickname
|
|
/// </returns>
|
|
public Task<T?> getPlayer(string nickname);
|
|
/// <summary>
|
|
/// get players in a lobby
|
|
/// </summary>
|
|
/// <param name="idLobby">the id of the lobby they are inside</param>
|
|
/// <returns>
|
|
/// a set of all players in this lobby
|
|
/// (we know that the lobby is at less
|
|
/// used by the creator) or null (and
|
|
/// delete the lobby) if it is used by
|
|
/// no player
|
|
/// </returns>
|
|
public Task<IEnumerable<T>?> getPlayersInALobby(int idLobby);
|
|
/// <summary>
|
|
/// get the max score of a player in a chapter
|
|
/// </summary>
|
|
/// <param name="id">identifier of the player</param>
|
|
/// <param name="idChapter">identifier of the chapter</param>
|
|
/// <returns>
|
|
/// the max score of the player
|
|
/// or null if the player or
|
|
/// the chapter does not exist
|
|
/// </returns>
|
|
public Task<int?> getMaxScorePlayer(int id, int idChapter);
|
|
/// <summary>
|
|
/// get the global max score of a player
|
|
/// </summary>
|
|
/// <param name="id">identifier of the player</param>
|
|
/// <returns>
|
|
/// the max score of the player
|
|
/// or null if the player does not exist
|
|
/// </returns>
|
|
public Task<int?> getMaxScorePlayer(int id);
|
|
|
|
/// <summary>
|
|
/// update a player
|
|
/// </summary>
|
|
/// <param name="id">the id of the player to update</param>
|
|
/// <param name="player">a player class which contains all properties to changes</param>
|
|
/// <returns>
|
|
/// the player changed or null
|
|
/// if the id doesn't exist or
|
|
/// if the player nickname is
|
|
/// already used
|
|
/// </returns>
|
|
public Task<T?> updatePlayer(int id, T player);
|
|
}
|
|
}
|