<?php

namespace App\Lib;

use App\Models\Level;

class RewardLib
{
    public static function rewards()
    {
        foreach (Level::all() as $level) {
            $rewards[$level->level] = [
                'time' => $level->eligibility_duration,
                'member' => pow(4, $level->level),
                'reward' => $level->reward_amount,
                'currentMember' => 0
            ];
        }

        return $rewards;
    }

    public static function getLevelReward(int $level)
    {

        $level = Level::where('level', $level)->first();

        return [
            'time' => $level->eligibility_duration,
            'member' => pow(4, $level->level),
            'reward' => $level->reward_amount
        ];
    }
}
