using OrderCriterias;
using System.Collections.ObjectModel;

namespace ManagerInterfaces
{
    /// <summary>
    /// All methods to handle answers
    /// /!\ all methods returns a task
    /// </summary>
    /// <typeparam name="T">a DTO, Entity or Model answer</typeparam>
    public interface IAnswerManager<T>
    {
        /// <summary>
        /// get the number of T element
        /// </summary>
        /// <returns>the number of T element</returns>
        public int getNbElements();
        /// <summary>
        /// get a part of all answers
        /// </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>? answers)> getAnswers(int nb, int count, AnswerOrderCriteria orderCriteria = AnswerOrderCriteria.ById);
        /// <summary>
        /// get some answers that answer to a question
        /// </summary>
        /// <param name="id">the id of the question</param>
        /// <returns>
        /// a set of all T answers that answer to this question
        /// </returns>
        public Task<IEnumerable<T>?> getAnswersByIdQuestion(uint id);
        /// <summary>
        /// modified a T element with an id
        /// </summary>
        /// <param name="id">the id of the T element</param>
        /// <param name="answer">an answer 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?> updateAnswer(uint id, T answer);
        /// <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?> removeAnswer(uint id);
        /// <summary>
        /// delete a T element
        /// </summary>
        /// <param name="answer">the T element to delete</param>
        /// <returns>the answer removed or null if there wasn't any</returns>
        public Task<T?> removeAnswer(T answer);
        /// <summary>
        /// add a T element
        /// </summary>
        /// <param name="answer">the answer to add</param>
        /// <returns>
        /// the T element that corresponde to
        /// the answer added or the answer equal to this
        /// answer if this answer was already added
        /// </returns>
        public Task<T> addAnswer(T answer);
        /// <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?> getAnswer(uint id);
    }
}