using Guru.UI;
using UnityEngine;

namespace Guru

{
    public class GuruApp
    {
        private static GuruApp _instance;
        public static GuruApp Instance
        {
            get
            {
                if (_instance == null) Install();
                return _instance;
            }
        }

        public static void Install()
        {
            _instance = new GuruApp();
            _instance.Init();
        }
        
        
        private GuruContext _context;
        private GuruUIController _uiController;
        
    
        private void Init()
        {
            _context = GuruContext.Instance;
            _uiController = _context.GetController<GuruUIController>();
        }

        public void Dispose()
        {
            _context.Dispose();
        }





        public class GuruApp_UI
        {
            private static GuruUIController _uiController;

            internal static GuruUIController Controller_
            {
                get
                {
                    if(_uiController == null) _uiController = GuruApp.Instance._uiController;
                    return _uiController;
                }
                
            }


            public static RectTransform AddNode(string nodePath = "", Transform parent = null)
            {
                return Controller_.AddNode(nodePath, parent);
            }


        }





    }
}