using System;

namespace Minesweeper.Core
{
    public sealed class GamePauseService : IGamePauseService
    {
        public event Action<bool> PauseChanged;

        public bool IsPaused { get; private set; }

        public void Pause()
        {
            if (IsPaused)
            {
                return;
            }

            IsPaused = true;
            PauseChanged?.Invoke(IsPaused);
        }

        public void Resume()
        {
            if (!IsPaused)
            {
                return;
            }

            IsPaused = false;
            PauseChanged?.Invoke(IsPaused);
        }
    }
}
