using Managing.Domain.Candles;
using Managing.Domain.Shared.Rules;

namespace Managing.Domain.Strategies.Rules
{
    public class CloseHigherThanThePreviousHigh : IValidationRule
    {
        private readonly Candle _previousCandles;
        private readonly Candle _currentCandle;

        public CloseHigherThanThePreviousHigh(Candle previousCandles, Candle currentCandle)
        {
            _previousCandles = previousCandles;
            _currentCandle = currentCandle;
        }

        public string Message => $"Current candle did close higher than the previous high close candle";

        public bool IsValid()
        {
            return _previousCandles != null ? _currentCandle.Close > _previousCandles.High : false;
        }
    }
}
