using System;

namespace Minesweeper.Core
{
    public sealed class GameStateService : IGameStateService
    {
        public event Action<GameState> StateChanged;

        public GameState Current { get; private set; } = GameState.FieldSelection;

        public void SetState(GameState state)
        {
            if (Current == state)
            {
                return;
            }

            Current = state;
            StateChanged?.Invoke(Current);
        }
    }
}
