namespace Theriapolis.Core.Rules.Stats;

/// <summary>
/// Standard d20 proficiency-bonus-by-level table:
///   1-4   → +2
///   5-8   → +3
///   9-12  → +4
///   13-16 → +5
///   17-20 → +6
/// Phase 5 only ever evaluates level 1, but the full table ships so
/// future leveling work doesn't have to revisit this file.
/// </summary>
public static class ProficiencyBonus
{
    public const int MinLevel = 1;
    public const int MaxLevel = 20;

    public static int ForLevel(int level)
    {
        if (level < MinLevel || level > MaxLevel)
            throw new ArgumentOutOfRangeException(nameof(level), $"Level must be {MinLevel}..{MaxLevel}, got {level}");

        return level switch
        {
            >= 17 => 6,
            >= 13 => 5,
            >=  9 => 4,
            >=  5 => 3,
            _     => 2,
        };
    }
}
