#include "dashboard_panel.h"
#include <imgui.h>

bool dashboard_panel_begin(const char* title, float min_width, float min_height) {
    ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
    ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
    ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.12f, 0.15f, 1.0f));

    ImVec2 size(min_width > 0.0f ? min_width : 0.0f,
                min_height > 0.0f ? min_height : 0.0f);

    ImGui::BeginChild(title, size, ImGuiChildFlags_Borders | ImGuiChildFlags_AutoResizeY);

    ImGui::TextUnformatted(title);
    ImGui::Separator();

    return true;
}

void dashboard_panel_end() {
    ImGui::EndChild();
    ImGui::PopStyleColor(1);
    ImGui::PopStyleVar(2);
}
