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.
3.01-QCM_MuscuMaths/WebApi/ManagerInterfaces/ILobbyManager.cs

81 lines
2.8 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 lobbies
/// /!\ all methods returns a task
/// </summary>
/// <typeparam name="T">a DTO, Entity or Model lobby</typeparam>
public interface ILobbyManager<T>
{
/// <summary>
/// get the number of lobbies
/// </summary>
/// <returns>the number of lobbies</returns>
public int getNbLobbies();
/// <summary>
/// add a lobby
/// </summary>
/// <param name="lobby">the lobby to add</param>
/// <returns>the lobby added</returns>
public Task<T> addLobby(T lobby);
/// <summary>
/// delete a lobby
/// </summary>
/// <param name="lobby">the lobby to remove</param>
/// <returns>
/// the lobby deleted or
/// null if there isn't any
/// </returns>
public Task<T?> removeLobby(T lobby);
/// <summary>
/// delete a lobby with an id
/// </summary>
/// <param name="id">the id of the lobby</param>
/// <returns>
/// the lobby deleted that corresponde
/// to the id or null if there isn't any
/// </returns>
public Task<T?> removeLobby(int id);
/// <summary>
/// get a part of all lobbies
/// </summary>
/// <param name="nb">the actual page</param>
/// <param name="count">number of lobbies in a page</param>
/// <param name="orderCriteria">the order criteria</param>
/// <returns>
/// a set of the number of page and
/// all lobbies 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>? lobbies)> getLobbies(int nb, int count, LobbyOrderCriteria orderCriteria = LobbyOrderCriteria.ById);
/// <summary>
/// get a lobby with an id
/// </summary>
/// <param name="id">the id of the lobby</param>
/// <returns>
/// the lobby that corresponde
/// to the id or null if there isn't any
/// </returns>
public Task<T?> getLobby(int id);
/// <summary>
/// get a lobby with a name and a creator id
/// </summary>
/// <param name="name">name of the lobby</param>
/// <param name="idCreator">the id of the creator of the lobby</param>
/// <returns>
/// the lobby that corresponde
/// to the id or null if there isn't any
/// </returns>
public Task<T?> getLobby(string name, int? idCreator);
}
}