using SRDebugger.Services;
using SRF.Service;
namespace SRDebugger
{
    using UnityEngine;
    public static class AutoInitialize
    {
        /// 
        /// Initialize the console service before the scene has loaded to catch more of the initialization log.
        /// 
        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
        public static void OnLoadBeforeScene()
        {
            // Populate service manager with types from SRDebugger assembly (asmdef)
            SRServiceManager.RegisterAssembly();
            if (Settings.Instance.IsEnabled)
            {
                // Initialize console if it hasn't already initialized.
                SRServiceManager.GetService();
            }
        }
        /// 
        /// Initialize SRDebugger after the scene has loaded.
        /// 
        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
        public static void OnLoad()
        {
            if (Settings.Instance.IsEnabled)
            {
                SRDebug.Init();
            }
        }
    }
}