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

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.game.stateless.config.restriction.RestrictionHandler;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.common.MaximalPlayeramountGameRestriction;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.common.MinimalPlayeramountGameRestriction;
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 StickFightFactory implements GameFactory {
    @Override
    public TranslatedComponent name() {
        return TranslatedComponent.byId("game_Stickfight#name");
    }

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

    @Override
    public ConfigManager configuration() {
        return new ConfigManager()
                .addOption(new NumericOption("length", Material.SANDSTONE, TranslatedComponent.byId("optionCommon#length"), 5, 7, 9, 11));
    }

    @Override
    public RestrictionHandler globalRestrictions() {
        return new RestrictionHandler()
                .addRestriction(new MinimalPlayeramountGameRestriction(2))
                .addRestriction(new MaximalPlayeramountGameRestriction(4));
    }

    @Override
    public Game manufacture(Room parent, Map<String, Option<?>> configuration) {
        return new Stickfight().setParent(parent);
    }

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