package se.urmo.game.util;

import lombok.Getter;
import se.urmo.game.graphics.SpriteLocation;
import se.urmo.game.graphics.SpriteSheetManager;

import java.awt.image.BufferedImage;
import java.util.Arrays;

@Getter
public enum FruitType {
    CHERRY(1, SpriteSheetManager.get(SpriteLocation.ITEM).getSprite(0,0), 100),
    CHERRY2(2, SpriteSheetManager.get(SpriteLocation.ITEM).getSprite(0,0), 100),
    CHERRY3(3, SpriteSheetManager.get(SpriteLocation.ITEM).getSprite(0,0), 100);

    private final int level;
    private final BufferedImage sprite;
    private final int score;

    FruitType(int level, BufferedImage sprite, int score) {
        this.level = level;
        this.sprite = sprite;
        this.score = score;
    }

    public static FruitType forLevel(int i) {
        return Arrays.stream(values())
                .filter(fruitType -> fruitType.level ==i)
                .findFirst().orElse(null);
    }
}
