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

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 MinerunFactory implements GameFactory {
    @Override
    public TranslatedComponent name() {
        return TranslatedComponent.byId("game_Minerun#name");
    }

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
                .addOption(new NumericOption("width", Material.OAK_FENCE, TranslatedComponent.byId("optionCommon#width"), 10, 30, 50, 100))
                .addOption(new NumericOption("length", Material.ZOMBIE_HEAD, TranslatedComponent.byId("optionCommon#length"), 50, 100, 150, 200))
                .addOption(new NumericOption("percentage", Material.LIGHT_WEIGHTED_PRESSURE_PLATE, TranslatedComponent.byId("game_Minerun#optionPercentageMines"), 30, 40, 50, 60, 70));
    }

    @Override
    public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
        return new Minerun(configuration.get("width").getAsInt(), configuration.get("length").getAsInt(), configuration.get("percentage").getAsInt()).setParent(parent);
    }

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

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