using DansoriEQ.Core.Eq;
using Xunit;

namespace DansoriEQ.Core.Tests;

public class ApoRendererEffectsTests
{
    [Fact]
    public void EqOnly_RendersPreampAndFilters()
    {
        var eq = new EqState { PreampDb = -6 };
        eq.Filters.Add(new Filter { Type = FilterType.Peaking, Fc = 1000, GainDb = 3, Q = 1 });
        var text = ApoRenderer.Render(eq);
        Assert.Contains("Preamp: -6.0 dB", text);
        Assert.Contains("Filter 1: ON PK Fc 1000 Hz Gain 3.0 dB Q 1.000", text);
    }

    [Fact]
    public void Balance_RendersPerChannelPreamp()
    {
        var eq = new EqState();
        var fx = new EffectsConfig { PreampLeftDb = -2, PreampRightDb = 0 };
        var text = ApoRenderer.Render(eq, fx);
        Assert.Contains("Channel: L", text);
        Assert.Contains("Preamp: -2.0 dB", text);
        Assert.Contains("Channel: all", text);
    }

    [Fact]
    public void BassBoost_RendersLowShelf()
    {
        var text = ApoRenderer.Render(new EqState(), new EffectsConfig { BassBoostDb = 4 });
        Assert.Contains("LSC Fc 100 Hz Gain 4.0 dB", text);
    }

    [Fact]
    public void Crossfeed_RendersCopy()
    {
        var text = ApoRenderer.Render(new EqState(), new EffectsConfig { CrossfeedLevel = 50 });
        Assert.Contains("Copy:", text);
    }
}
