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

import eu.mhsl.minenet.minigames.instance.game.Game;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.GameFactory;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.ConfigManager;
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 TrafficLightRaceFactory implements GameFactory {
    @Override
    public TranslatedComponent name() {
        return TranslatedComponent.byId("game_TrafficlightRace#name");
    }

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

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
                .addOption(new NumericOption("width", Material.OAK_FENCE, TranslatedComponent.byId("game_TrafficlightRace#width"), 20, 30, 40))
                .addOption(new NumericOption("length", Material.BLACK_CONCRETE_POWDER, TranslatedComponent.byId("game_TrafficlightRace#length"), 50, 80, 100, 120, 150));
    }

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

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