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

package com.hypixel.hytale.server.npc.corecomponents.world.builders;

import com.hypixel.hytale.server.npc.asset.builder.Builder;
import com.hypixel.hytale.server.npc.asset.builder.Feature;
import com.google.gson.JsonElement;
import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
import com.hypixel.hytale.server.npc.corecomponents.world.ActionSetLeashPosition;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;

public class BuilderActionSetLeashPosition extends BuilderActionBase
{
    protected boolean toTarget;
    protected boolean toCurrent;
    
    @Nonnull
    @Override
    public ActionSetLeashPosition build(@Nonnull final BuilderSupport builderSupport) {
        builderSupport.setRequireLeashPosition();
        return new ActionSetLeashPosition(this);
    }
    
    @Nonnull
    @Override
    public String getShortDescription() {
        return "Sets the NPCs current position to the spawn/leash position";
    }
    
    @Nonnull
    @Override
    public String getLongDescription() {
        return "Sets the NPCs current position to the spawn/leash position to be used with the Leash Sensor.";
    }
    
    @Nonnull
    @Override
    public BuilderDescriptorState getBuilderDescriptorState() {
        return BuilderDescriptorState.Stable;
    }
    
    @Nonnull
    @Override
    public BuilderActionSetLeashPosition readConfig(@Nonnull final JsonElement data) {
        this.getBoolean(data, "ToCurrent", b -> this.toCurrent = b, false, BuilderDescriptorState.Stable, "Set to the NPCs current position.", null);
        this.getBoolean(data, "ToTarget", b -> this.toTarget = b, false, BuilderDescriptorState.Stable, "Set to the target position.", null);
        this.validateAny("ToCurrent", this.toCurrent, "ToTarget", this.toTarget);
        this.requireFeatureIf("ToTarget", true, this.toTarget, Feature.AnyEntity);
        return this;
    }
    
    public boolean isToTarget() {
        return this.toTarget;
    }
    
    public boolean isToCurrent() {
        return this.toCurrent;
    }
}
