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

namespace YGNT.QuestionLibrary.Core.Chapters.Domain
{
    public interface IChapterManager : IDomainService
    {
        /// <summary>
        /// 检查章节名称是否占用
        /// </summary>
        /// <param name="name"></param>
        /// <param name="textbookId"></param>
        /// <returns></returns>
        Task CheckNameAsync(string name, int textbookId);

        /// <summary>
        /// 创建章节
        /// </summary>
        /// <param name="name">章节名</param>
        /// <param name="textbookId">教材id</param>
        /// <param name="parentId">父章节名称</param>
        /// <param name="remark"></param>
        /// <returns></returns>
        Task<Chapter> CreateAsync(string name, int textbookId, long? parentId = null, string remark = null);

        /// <summary>
        /// 排序
        /// </summary>
        /// <param name="chapter"></param>
        /// <param name="sortType"></param>
        /// <returns></returns>
        Task SortAsync(Chapter chapter, SortType sortType);

        /// <summary>
        /// 删除章节
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task DeleteAsync(long id);
    }
}