using Intrepid.Integration.Persistence.Events;
using Intrepid.SimpleEvents;
using Intrepid.Utilities;
using UnityEngine;

namespace Intrepid.Integration.Persistence.UI
{
    public class SavingConfirmationUI : EventListener
    {
        [GroupInjections, SerializeField] private Window.Window window;
        
        protected override void InitializeVariables()
        {
        }

        protected override void OnBootstrap()
        {
        }

        protected override void Subscriptions()
        {
            Subscribe<SavingGameDataBeginEvent>(WhenSavingGameDataBegin);
            Subscribe<SavingGameDataEndEvent>(WhenSavingGameDataEnd);
        }

        private void WhenSavingGameDataBegin(SavingGameDataBeginEvent e)
        {
            window.Open();
        }

        private void WhenSavingGameDataEnd(SavingGameDataEndEvent e)
        {
            window.Close();
        }
    }
}