using Domain;

namespace Presenter {
	public class ExpressionClick {
		private readonly Score _score;
		private readonly IExpressionInput _view;
		private readonly IRoseSpawner _spawner;

		private bool CanSpawn => _score.Value % (_score.GrowIterations * _score.SpawnRate) == 0;

		public ExpressionClick(Score score, IExpressionInput view, IRoseSpawner spawner) {
			_score = score;
			_view = view;
			_spawner = spawner;
		}

		public void Execute() {
			_score.Add();
			_view.UpdateView(_score.Value, _score.GrowPercentage);

			if (CanSpawn)
				_spawner.SpawnRose();
		}

	}
}