using NEG.UI.Area;
using NEG.UI.Popup;
using NEG.UI.UnityUi.Popup;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Assertions;
using UnityEngine.SceneManagement;
namespace NEG.UI.UnityUi
{
    /// 
    /// Implements ui using UnityUI and Unity Event System with New Input System.
    /// You have to provide prefabs with addresses:
    ///  - NEG/UI/PopupCanvas - prefab with canvas to create popups (will be created on every scene)
    ///  - NEG/UI/DefaultPopupPrefab - prefab of default popup with 2 options (has to have  component)
    /// 
    public class MonoUiManager : UiManager
    {
        private readonly MonoDefaultPopup defaultPopupPrefab;
        private readonly GameObject canvasPrefab;
        public MonoUiManager(IArea startArea) : base(startArea)
        {
            var prefabs =
                Addressables.LoadAssetsAsync(new List() { "NEG/UI/PopupCanvas", "NEG/UI/DefaultPopupPrefab" }, (_) => { }, Addressables.MergeMode.Union).WaitForCompletion();
      
            Assert.AreEqual(prefabs.Count, 2, "No prefabs was provided. Please check MonoUiManager class documentation");
            Assert.IsNotNull(prefabs[0].GetComponent