package electrosphere.menu.debug;

import electrosphere.engine.Globals;
import electrosphere.renderer.ui.imgui.ImGuiWindow;
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
import electrosphere.server.ai.AI;
import imgui.ImGui;

/**
 * AI debug menus
 */
public class ImGuiAI {
    
    //window for viewing information about the ai state
    protected static ImGuiWindow aiWindow;

    /**
     * Creates the windows in this file
     */
    protected static void createAIWindows(){
        createAIDebugWindow();
    }

    /**
     * Client scene entity view
     */
    protected static void createAIDebugWindow(){
        aiWindow = new ImGuiWindow("AI");
        aiWindow.setCallback(new ImGuiWindowCallback() {
            @Override
            public void exec() {
                //ui framework text
                ImGui.text("AI");

                //ai manager stuff
                ImGui.text("AI Manager active: " + Globals.aiManager.isActive());
                if(ImGui.button("Toggle AI Manager")){
                    Globals.aiManager.setActive(!Globals.aiManager.isActive());
                }

                if(ImGui.collapsingHeader("Statuses")){
                    for(AI ai : Globals.aiManager.getAIList()){
                        ImGui.text(ai.getParent().getId() + " - " + ai.getStatus());
                    }
                }
                
            }
        });
        aiWindow.setOpen(false);
        Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(aiWindow);
    }

}
