using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework.Entities
{
    // TODO, Comment
    public class NullComponents //: TypeRegisterlike<NullComponentlike>
    {
        public Dictionary<Type, NullComponentlike> nullComponents;

        public NullComponents()
        {
            this.nullComponents = new Dictionary<Type, NullComponentlike>();
        }

        public void Register<EntityComponentType>(NullComponentlike nullComponent) where EntityComponentType : CoreBehaviour
        {
            if(this.nullComponents.ContainsKey(typeof(EntityComponentType)))
            {
                throw new ArgumentException("Entity component: " + nullComponent.GetType().Name + " already registered with NullComponents.");
            }
            this.nullComponents.Add(typeof(EntityComponentType), nullComponent);
        }

        public EntityComponentType Get<EntityComponentType>() where EntityComponentType : CoreBehaviour
        {
            if (!this.nullComponents.ContainsKey(typeof(EntityComponentType)))
            {
                throw new ArgumentException("Entity component: " + typeof(EntityComponentType).Name + " has not yet been registered with NullComponents");
            }
            return (EntityComponentType)this.nullComponents[typeof(EntityComponentType)].Clone();
        }
    }
}
