namespace RolemasterDb.ImportTool.Tests;

internal sealed class SequenceRandom(params int[] values) : Random
{
    private readonly Queue<int> values = new(values);

    public override int Next(int minValue, int maxValue)
    {
        if (values.Count == 0)
        {
            throw new InvalidOperationException("No queued random values remain.");
        }

        var value = values.Dequeue();
        if (value < minValue || value >= maxValue)
        {
            throw new InvalidOperationException($"Queued random value {value} is outside the requested range [{minValue}, {maxValue}).");
        }

        return value;
    }
}
