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

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

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
            .addOption(new NumericOption("width", Material.HEART_OF_THE_SEA, TranslatedComponent.byId("optionCommon#width"), 20, 30, 40, 50, 60, 70, 80))
            .addOption(new NumericOption("powerUpCount", Material.DIAMOND, TranslatedComponent.byId("game_SpaceSnake#powerUpCount"), 50, 100, 200, 300));
    }

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

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

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