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

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

import javax.annotation.Nonnull;
import com.hypixel.hytale.server.npc.asset.builder.ComponentContext;
import com.hypixel.hytale.server.npc.asset.builder.InstructionType;
import java.util.EnumSet;

public class InstructionContextValidator extends Validator
{
    private final EnumSet<InstructionType> instructionTypes;
    private final EnumSet<ComponentContext> componentContexts;
    
    private InstructionContextValidator(final EnumSet<InstructionType> instructionTypes, final EnumSet<ComponentContext> componentContexts) {
        this.instructionTypes = instructionTypes;
        this.componentContexts = componentContexts;
    }
    
    @Nonnull
    public static String getErrorMessage(@Nonnull final String value, @Nonnull final InstructionType instructionContext, final boolean instructionMatched, @Nonnull final ComponentContext componentContext, final boolean extraMatched, final String breadcrumbs) {
        final StringBuilder sb = new StringBuilder(value).append(" not valid");
        if (!instructionMatched) {
            sb.append(" in instruction ").append(instructionContext.get());
        }
        if (!extraMatched) {
            sb.append(" in context ").append(componentContext.get());
        }
        sb.append(" at: ").append(breadcrumbs);
        return sb.toString();
    }
    
    @Nonnull
    public static InstructionContextValidator inInstructions(final EnumSet<InstructionType> instructionTypes, final EnumSet<ComponentContext> componentContexts) {
        return new InstructionContextValidator(instructionTypes, componentContexts);
    }
}
