using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RankSystem : MonoBehaviour
{
    public enum Rank
    {
        Bronze,
        Silver,
        Gold,
        Platinum,
        Diamond,
        Master,
        ApexPredator
    }

    private Dictionary<int, Rank> rankData;

    public RankSystem()
    {
        rankData = new Dictionary<int, Rank>()
        {
            { 1, Rank.Bronze },
            { 2, Rank.Bronze },
            { 3, Rank.Bronze },
            { 4, Rank.Bronze },
            { 5, Rank.Silver },
            { 6, Rank.Silver },
            { 7, Rank.Silver },
            { 8, Rank.Silver },
            { 9, Rank.Gold },
            { 10, Rank.Gold },
            { 11, Rank.Gold },
            { 12, Rank.Gold },
            { 13, Rank.Platinum },
            { 14, Rank.Platinum },
            { 15, Rank.Platinum },
            { 16, Rank.Platinum },
            { 17, Rank.Diamond },
            { 18, Rank.Diamond },
            { 19, Rank.Diamond },
            { 20, Rank.Diamond },
            { 21, Rank.Master },
            { 22, Rank.Master },
            { 23, Rank.Master },
            { 24, Rank.Master },
            { 25, Rank.ApexPredator }
        };
    }

    public Rank GetRank(int level)
    {
        if (rankData.ContainsKey(level))
        {
            return rankData[level];
        }
        else if (level > 25)
        {
            int additionalLevels = level - 25;
            int maxAdditionalLevels = Mathf.Min(additionalLevels, 20); // Maximum additional levels for Apex Predator rank
            return Rank.ApexPredator;
        }
        else
        {
            return Rank.Bronze;
        }
    }
}

