using System.Collections.Generic;
using System.Threading.Tasks;
using Abp.Domain.Services;
using YGNT.Infrastructure.Model;
using YGNT.QuestionLibrary.Core.Models;

namespace YGNT.QuestionLibrary.Core.Papers.Domain
{
    public interface IPaperManager : IDomainService
    {
        /// <summary>
        /// 创建试卷
        /// </summary>
        /// <param name="name"></param>
        /// <param name="examTime"></param>
        /// <param name="disciplines"></param>
        /// <param name="remark"></param>
        /// <returns></returns>
        Task<Paper> CreateAsync(string name,
            long examTime,
            List<int> disciplines,
            string remark = null);

        /// <summary>
        /// 创建默认排序设置
        /// </summary>
        /// <param name="paper"></param>
        /// <returns></returns>
        Task<List<PaperDisciplineQtSortSetting>> CreateDefaultSortSettingAsync(Paper paper);

        /// <summary>
        /// 创建默认试题设置
        /// </summary>
        /// <param name="paper"></param>
        /// <returns></returns>
        Task<List<PaperSetting>> CreateDefaultPaperSettingAsync(Paper paper);

        /// <summary>
        /// 添加试题
        /// </summary>
        /// <param name="paper"></param>
        /// <param name="questionId"></param>
        /// <param name="disciplineQuestionTypeId">细分题型id</param>
        /// <param name="singleScore"></param>
        /// <returns>如果试题已经存在 返回null</returns>
        Task<PaperQuestion> AddQuestion(Paper paper, long questionId, int disciplineQuestionTypeId,
            float singleScore);

        /// <summary>
        /// 移动试题排序位置
        /// </summary>
        /// <param name="question"></param>
        /// <param name="sort"></param>
        /// <returns></returns>
        Task MoveQuestionAsync(PaperQuestion question, SortType sort);

        /// <summary>
        /// 更新试题排序
        /// </summary>
        /// <param name="sortSetting"></param>
        /// <returns></returns>
        Task UpdatePaperQuestionSortAsync(PaperDisciplineQtSortSetting sortSetting);

        /// <summary>
        /// 排序试卷试题
        /// </summary>
        /// <param name="paper"></param>
        /// <returns></returns>
        Task SortPaperAsync(Paper paper);
    }
}