using Darkmatter.Libs.Installers;
using UnityEngine;
using VContainer;
using VContainer.Unity;

namespace Darkmatter.App.LifetimeScopes
{
    public abstract class BaseLifetimeScope : LifetimeScope
    {
        [SerializeField] private MonoBehaviour[] serviceModules;

        protected override void Configure(IContainerBuilder builder)
        {
            foreach (var module in serviceModules)
            {
                if (module is IModule serviceModule)
                    serviceModule.Register(builder);
            }
        }
    }
}