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

package com.hypixel.hytale.builtin.portals.utils.posqueries;

import com.hypixel.hytale.math.vector.Vector3d;
import java.util.logging.Level;
import com.hypixel.hytale.logger.HytaleLogger;
import java.util.Stack;

public class SpatialQueryDebug
{
    private final StringBuilder builder;
    private String indent;
    private Stack<String> scope;
    
    public SpatialQueryDebug() {
        this.builder = new StringBuilder();
        this.indent = "";
        this.scope = new Stack<String>();
        this.appendLine("SPATIAL QUERY DEBUG");
    }
    
    public SpatialQueryDebug appendLine(final String string) {
        HytaleLogger.getLogger().at(Level.INFO).log(this.indent + "| " + string);
        return this;
    }
    
    public SpatialQueryDebug indent(final String scopeReason) {
        HytaleLogger.getLogger().at(Level.INFO).log(this.indent + "\u2b91 " + scopeReason);
        this.indent += "  ";
        this.scope.add(scopeReason);
        return this;
    }
    
    public SpatialQueryDebug unindent() {
        if (this.indent.length() >= 2) {
            this.indent = this.indent.substring(0, this.indent.length() - 2);
        }
        if (!this.scope.isEmpty()) {
            final String scopeReason = this.scope.pop();
            HytaleLogger.getLogger().at(Level.INFO).log(this.indent + "\u2b90 (DONE) " + scopeReason);
        }
        return this;
    }
    
    public String fmt(final Vector3d point) {
        return "(" + String.format("%.1f", point.x) + ", " + String.format("%.1f", point.y) + ", " + String.format("%.1f", point.z);
    }
    
    @Override
    public String toString() {
        return this.builder.toString();
    }
}
