using OrderCriterias;
using System;
using System.Collections;
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 questions
    /// /!\ all methods returns a task
    /// </summary>
    /// <typeparam name="T">a DTO, Entity or Model question</typeparam>
    public interface IQuestionManager<T>
    {
        /// <summary>
        /// get the number of T element
        /// </summary>
        /// <returns>the number of T element</returns>
        public int getNbElements();
        /// <summary>
        /// add a question
        /// </summary>
        /// <param name="question">the question to add</param>
        /// <returns>the question added</returns>
        public Task<T> addQuestion(T question);
        /// <summary>
        /// delete a T element
        /// </summary>
        /// <param name="question">the question to remove</param>
        /// <returns>
        /// the T element deleted or
        /// null if there isn't any
        /// </returns>
        public Task<T?> removeQuestion(T question);
        /// <summary>
        /// delete a T element with an id
        /// </summary>
        /// <param name="id">the id of the T element</param>
        /// <returns>
        /// the T element deleted that corresponde
        /// to the id or null if there isn't any
        /// </returns>
        public Task<T?> removeQuestion(uint id);
        /// <summary>
        /// get a part of all questions
        /// </summary>
        /// <param name="nb">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>? questions)> getQuestions(int nb, int count, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById);
        /// <summary>
        /// get a T element with an id
        /// </summary>
        /// <param name="id">the id of the T element</param>
        /// <returns>
        /// the T element that corresponde
        /// to the id or null if there isn't any
        /// </returns>
        public Task<T?> getQuestion(uint id);
        /// <summary>
        /// modified a T element with an id
        /// </summary>
        /// <param name="id">the id of the T element</param>
        /// <param name="question">an question that contains all modified properties</param>
        /// <returns>
        /// the T element (modified) that corresponde
        /// to the id or null if there isn't any
        /// </returns>
        public Task<T?> updateQuestion(uint id, T question);
        /// <summary>
        /// increase nbFalls of a question by 1
        /// (and change the difficulty of the question)
        /// </summary>
        /// <param name="id">the id of the question</param>
        /// <returns>
        /// the T element (modified) that corresponde
        /// to the id or null if there isn't any
        /// </returns>
        public Task<T?> updateQuestionNbFalls(uint id);
        /// <summary>
        /// add some questions
        /// </summary>
        /// <param name="questions">a set of questions to add</param>
        /// <returns>questions added</returns>
        public Task<IEnumerable<T>> addQuestions(IEnumerable<T> questions);
        /// <summary>
        /// get a part of all questions for a given chapter and a given difficulty
        /// </summary>
        /// <param name="idChapter">the id of the chapter</param>
        /// <param name="difficulty">the difficulty</param>
        /// <param name="nb">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)))
        /// or null if the chapter does not exist
        /// or the difficulty is not between 1 and 3
        /// </returns>
        public Task<(int nbPages, IEnumerable<T>? questions)?> getQuestionsByChapterAndDifficulty(int idChapter, int difficulty, int nb, int count, QuestionOrderCriteria orderCriteria = QuestionOrderCriteria.ById);

    }
}
