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

import eu.mhsl.minenet.minigames.instance.game.Game;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.ConfigManager;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.Option;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.common.NumericOption;
import eu.mhsl.minenet.minigames.instance.room.Room;
import eu.mhsl.minenet.minigames.message.component.TranslatedComponent;
import net.minestom.server.item.Material;

import java.util.Map;

public class TurtleGameFactory implements GameFactory {

    @Override
    public TranslatedComponent name() {
        return TranslatedComponent.byId("game_TurtleGame#name");
    }

    @Override
    public TranslatedComponent description() {
        return TranslatedComponent.byId("game_TurtleGame#description");
    }

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
            .addOption(new NumericOption("radius", Material.HEART_OF_THE_SEA, TranslatedComponent.byId("optionCommon#radius"), 10, 20, 30, 40))
            .addOption(new NumericOption("startSpeed", Material.LEATHER_BOOTS, TranslatedComponent.byId("game_TurtleGame#startSpeed"), 2, 3, 4, 6, 8));
    }

    @Override
    public Game manufacture(Room parent, Map<String, Option<?>> configuration) throws Exception {
        return new TurtleGame(configuration.get("radius").getAsInt(), configuration.get("startSpeed").getAsInt()).setParent(parent);
    }

    @Override
    public Material symbol() {
        return Material.TURTLE_EGG;
    }
}
