using Abp.Dependency;
using Abp.UI;
using YGNT.QuestionLibrary.Core.Models;

namespace YGNT.QuestionLibrary.Core.Papers.Domain.AutoPaper
{
    public class AutoPaperManagerFactory : IAutoPaperManagerFactory
    {
        private readonly IIocResolver _iocResolver;

        public AutoPaperManagerFactory(IIocResolver iocResolver)
        {
            _iocResolver = iocResolver;
        }

        /// <summary>
        /// 获取自动组卷服务
        /// </summary>
        /// <param name="paperCompositionModel"></param>
        /// <returns></returns>
        public IAutoPaperManager Create(PaperCompositionModel paperCompositionModel)
        {
            switch (paperCompositionModel)
            {
                case PaperCompositionModel.知识点组卷:
                    return _iocResolver.Resolve<IAutoPaperManager>(typeof(AutoPaperByKnowledgePointManager));
                case PaperCompositionModel.章节组卷:
                    return _iocResolver.Resolve<IAutoPaperManager>(typeof(AutoPaperByChapterManager));
            }
            throw new UserFriendlyException("暂不支持当前组卷模式");
        }
    }
}