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

import eu.mhsl.minenet.minigames.message.component.TranslatedComponent;

public record Restriction(TranslatedComponent name, TranslatedComponent description, TranslatedComponent warnMessage,
                          eu.mhsl.minenet.minigames.instance.game.stateless.config.restriction.Restriction.Type type) {
    public Restriction(TranslatedComponent name, TranslatedComponent description, TranslatedComponent warnMessage, Type type) {
        this.name = name;
        this.description = description;
        this.warnMessage = warnMessage;
        this.type = type;

        if (this.warnMessage == null && this.type.equals(Type.WARN)) {
            throw new IllegalStateException("warnMessage cannot be null when RestrictionType is WARN");
        }
    }

    public enum Type {
        OK,
        WARN,
        FAIL,
    }
}

