#pragma once
#include <cstdint>

struct GraphData; // forward declare

struct GraphRendererConfig {
    float node_outline     = 1.5f;   // outline width in pixels
    float edge_width       = 1.0f;   // edge line width
    float edge_alpha       = 0.4f;   // edge transparency
    uint32_t bg_color      = 0xFF1A1A1E; // ABGR background
    bool edge_fade_alpha   = true;   // fade edge alpha by distance to camera
    // Default palette for communities (when node.color == 0)
    // 10 distinct colors, ABGR packed
};

struct GraphRenderer;

// Lifecycle
GraphRenderer* graph_renderer_create(int width, int height, const GraphRendererConfig& config = {});
void graph_renderer_destroy(GraphRenderer* r);
void graph_renderer_resize(GraphRenderer* r, int width, int height);

// Render graph to internal FBO.
// cam_x, cam_y: camera center in graph space
// cam_zoom: zoom level (1.0 = 1:1 pixel mapping)
// Returns OpenGL texture ID suitable for ImGui::Image().
unsigned int graph_renderer_draw(GraphRenderer* r, const GraphData& graph,
                                  float cam_x, float cam_y, float cam_zoom);
