namespace mgaia.Utils.DependencyInjection
{
    /// <summary>
    /// Factory abstrata que constrói objetos com injeção de dependencia para disparo de eventos
    /// </summary>
    /// <owner>Victor</owner>
    public abstract class BaseDependencyInjectionFactory
    {
        public T Create<T, TEvents>(TEvents caller)
            where T : ICaller<TEvents>
            where TEvents : IEvents
        {
            T entity = Load<T, TEvents>();
            entity.Listener = caller;

            return entity;
        }

        protected abstract T Load<T, TEvents>()
            where T : ICaller<TEvents>
            where TEvents : IEvents;
    }
}