//
// Created by slinky on 5/11/26.
//

#include "UIMenuBar.h"
#include "UIManager.h"

#include "imgui.h"
#include "UISceneGraph.h"

void UIMenuBar::update(EditorContext &context) {
    if (ImGui::BeginMainMenuBar()) {
        if (ImGui::BeginMenu("File")) {
            if (ImGui::MenuItem("New Scene")) {
            }
            if (ImGui::MenuItem("Open Scene")) {
            }
            ImGui::Separator(); // Adds a visual line between sections
            if (ImGui::MenuItem("Save", "Ctrl+S")) {
            }
            if (ImGui::MenuItem("Exit", "Alt+F4")) {
            }
            ImGui::EndMenu();
        }

        if (ImGui::BeginMenu("Scene")) {
            if (ImGui::MenuItem("New Scene Object")) {
                const auto* sceneGraph = dynamic_cast<UISceneGraph*>(UIManager::get_ui_panel("scene_graph").get());
                if (sceneGraph) {
                    create_entity(context.selectedEntity);
                }
            }
            ImGui::EndMenu();
        }
        ImGui::EndMainMenuBar();
    }
}
