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

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

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

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

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