package eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.common;

import eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.IRestriction;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.Restriction;
import eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.RestrictionData;
import eu.mhsl.minenet.minigames.message.component.TranslatedComponent;

public class MinimalPlayeramountGameRestriction implements IRestriction {
    private final int min;

    public MinimalPlayeramountGameRestriction(int min) {
        this.min = min;
    }

    @Override
    public Restriction calculate(RestrictionData data) {
        return new Restriction(
                TranslatedComponent.byId("restriction#minPlayersInRoom"),
                TranslatedComponent.byId("restriction#minPlayersInRoomDescription"),
                null,
                data.room().getAllMembers().size() < this.min ? Restriction.Type.FAIL : Restriction.Type.OK
        );
    }
}
