// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.npc.asset.builder.validators;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class StringsAtMostOneValidator extends Validator
{
    private final String[] attributes;
    
    private StringsAtMostOneValidator(final String[] attributes) {
        this.attributes = attributes;
    }
    
    public static boolean test(@Nullable final String string1, @Nullable final String string2) {
        return string1 == null || string1.isEmpty() || string2 == null || string2.isEmpty();
    }
    
    @Nonnull
    public static String errorMessage(final String string1, final String string2, final String context) {
        return errorMessage(string1, "Value1", string2, "Value2", context);
    }
    
    @Nonnull
    public static String errorMessage(final String string1, final String attribute1, final String string2, final String attribute2, final String context) {
        return String.format("Both %s and %s are set to values. At most only 1 of the variables should be set in %s.", attribute1, attribute2, context);
    }
    
    @Nonnull
    public static StringsAtMostOneValidator withAttributes(final String attribute1, final String attribute2) {
        return new StringsAtMostOneValidator(new String[] { attribute1, attribute2 });
    }
    
    @Nonnull
    public static StringsAtMostOneValidator withAttributes(final String[] attributes) {
        return new StringsAtMostOneValidator(attributes);
    }
}
