using System.Data;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;

namespace Milimoe.FunGame.Core.Api.Utility
{
    public class Factory
   {
        /// <summary>
        /// 获取一个可能为NULL的实例
        /// <para>Item默认返回PassiveItem</para>
        /// <para>Skill默认返回PassiveSkill</para>
        /// <para>若无法找到T，返回唯一的空对象</para>
        /// </summary>
        /// <typeparam name="T">Entity类</typeparam>
        /// <param name="DataSet">使用DataSet构造对象（真香）</param>
        /// <returns></returns>
        public static T GetInstance<T>(DataSet? DataSet)
        {
            object instance = General.EntityInstance;
            if (typeof(T) == typeof(User))
            {
                instance = Api.Factory.UserFactory.GetInstance(DataSet);
            }
            else if (typeof(T) == typeof(Skill))
            {

            }
            return (T)instance;
        }
    }
}
