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

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

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

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

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
                .addOption(new NumericOption("radius", Material.STICK, TranslatedComponent.byId("optionCommon#radius"), 20, 30, 50, 60))
                .addOption(new NumericOption("levels", Material.SCAFFOLDING, TranslatedComponent.byId("game_TntRun#levels"), 1, 2, 3, 4, 5));
    }

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