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 administrators
    /// /!\ all methods returns a task
    /// </summary>
    /// <typeparam name="T">a DTO, Entity or Model administrator</typeparam>
    public interface IAdministratorManager<T>
    {
        /// <summary>
        /// get the number of T element
        /// </summary>
        /// <returns>the number of T element</returns>
        public int getNbElements();
        /// <summary>
        /// add a T element
        /// </summary>
        /// <param name="admin">the administrator to add</param>
        /// <returns>
        /// the T element that corresponde to
        /// the administrator added or the administrator equal to this
        /// administrator if this administrator was already added
        /// </returns>
        public Task<T> addAdmin(T admin);
        /// <summary>
        /// remove a T element
        /// </summary>
        /// <param name="admin">the administrator to remove</param>
        /// <returns>the administrator removed or null if there isn't any</returns>
        public Task<T?> removeAdmin(T admin);
        /// <summary>
        /// remove a T element
        /// </summary>
        /// <param name="id">the id of the administrator to remove</param>
        /// <returns>the administrator removed or null if there isn't any</returns>
        public Task<T?> removeAdmin(int id);
        /// <summary>
        /// get a part of all administrators
        /// </summary>
        /// <param name="page">the actual page</param>
        /// <param name="count">number of T element in a page</param>
        /// <param name="orderCriteria">the order criteria</param>
        /// <returns>
        /// a set of the number of page and
        /// all T element 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>? administrators)> getAdministrators(int page, int count, AdministratorOrderCriteria orderCriteria = AdministratorOrderCriteria.ById);
        /// <summary>
        /// get an administrator by his identifier
        /// </summary>
        /// <param name="id">the identifier of the administrator</param>
        /// <returns>the administrator that corresponde or null if there isn't any</returns>
        public Task<T?> getAdministrator(int id);
        /// <summary>
        /// get an administrator by his username
        /// </summary>
        /// <param name="username">the username of the administrator</param>
        /// <returns>the administrator that corresponde or null if there isn't any</returns>
        public Task<T?> getAdministratorByUsername(string username);
        /// <summary>
        /// set the password of an administrator
        /// </summary>
        /// <param name="username">the username of the administrator</param>
        /// <param name="newHashedPassword">the hash of the new password</param>
        /// <returns>
        /// true if the password was sucessful change
        /// false otherwise (no administrator with this username
        /// </returns>
        public Task<bool> setPassword(string username, string newHashedPassword);
        /// <summary>
        /// upadte an administrator
        /// </summary>
        /// <param name="id">the id of the administrator to update</param>
        /// <param name="admin">the admin that contains all properties to modify</param>
        /// <returns>the administrator updated or null if he don't exist</returns>
        public Task<T?> updateAdministrator(int id, T admin);
    }
}
