using LittleTown.Core;
using LittleTown.Core.Ports;

namespace LittleTown.Blazor.Client.Services
{
    public class MatchService : IMatchService
    {
        private readonly IStaticDataGetter _staticDataGetter;
        private Match? _currentMatch;

        public MatchService(IStaticDataGetter staticDataGetter)
        {
            _staticDataGetter = staticDataGetter;
        }

        /// <inheritdoc/>>
        public Match GetMatch()
        {
            if (null == _currentMatch)
            {
                _currentMatch = new Match(_staticDataGetter);
            }
            return _currentMatch;
        }
    }
}
