import { formatNumber } from "@/lib/formatters"
import { getWoolGamesPrestige, getWoolGamesXPForLevel } from "@/lib/hypixel/woolgames/general"
import { GenericProgress } from "../../_components/GenericProgress"

export default function WoolGamesProgress({ xp, level }: { xp: number, level: number }) {
    const pres = getWoolGamesPrestige(Math.floor(level))
    const next = getWoolGamesPrestige(Math.floor(level) + 1)
    const percent = (level - Math.floor(level)) * 100

    const xpProgress = formatNumber(Math.floor(xp - getWoolGamesXPForLevel(Math.floor(level))))
    const ceilingXp = formatNumber(Math.floor(getWoolGamesXPForLevel(Math.floor(level) + 1) - getWoolGamesXPForLevel(Math.floor(level))))

    return (
        <div className="flex gap-2">
            <p className={`text-mc-${pres.color}`}>{Math.floor(level)}</p>
            <GenericProgress
                tooltipId="woolgamesprogress"
                tooltipContent={`${xpProgress}/${ceilingXp} XP`}
                percent={percent}
                className="bg-mc-red"
            />
            <p className={`text-mc-${next.color}`}>{Math.floor(level) + 1}</p>
        </div>
    )
}
