using Xunit;
using QuantEngine.Core.Domain;

namespace QuantEngine.Core.Tests
{
    public class PullbackTriggerCalculatorTests
    {
        [Theory]
        [InlineData(100000, 100000, 3000, "PULLBACK_ZONE", "PASS")]       // close <= ma20*1.03
        [InlineData(105000, 100000, 3000, "ABOVE_PULLBACK_ZONE", "BLOCKED")] // close > ma20*1.03
        public void ComputePullbackTrigger_Prices_ReturnExpectedVerdictAndState(
            double close,
            double ma20,
            double atr20,
            string expectedVerdict,
            string expectedState)
        {
            var res = PullbackTriggerCalculator.ComputePullbackTrigger(close, ma20, atr20);
            Assert.Equal(expectedVerdict, res.PullbackEntryVerdict);
            Assert.Equal(expectedState, res.PullbackState);
        }

        [Fact]
        public void ComputePullbackTrigger_TriggerPrice_CalculatesCorrectly()
        {
            // triggerPrice = ma20 - 0.5 * atr20 = 100000 - 1500 = 98500
            var res = PullbackTriggerCalculator.ComputePullbackTrigger(100000, 100000, 3000);
            Assert.Equal(98500, res.PullbackEntryTriggerPrice);
        }
    }
}
