package eu.mhsl.minenet.minigames.instance.game.stateless.types.trafficlightrace;

import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
import net.minestom.server.timer.TaskSchedule;

import java.util.Random;

enum LightPhase {
    RED(Material.RED_WOOL, 1000, 5000),
    YELLOW(Material.YELLOW_WOOL, 500, 1500),
    GREEN(Material.GREEN_WOOL, 2000, 5000);

    public final ItemStack item;
    private final int minDuration;
    private final int maxDuration;
    private static final Random rnd = new Random();

    LightPhase(Material material, int minDuration, int maxDuration) {
        this.item = ItemStack.of(material);
        this.minDuration = minDuration;
        this.maxDuration = maxDuration;
    }

    public TaskSchedule taskScheduleRandomDuration() {
        return TaskSchedule.millis(rnd.nextLong(minDuration, maxDuration));
    }

}
