#pragma once

#include <imgui.h>
#include <vector>

class AvatarCache;
struct CommitInfo;

class GraphRenderer {
public:
    explicit GraphRenderer(float scale) : scale_(scale) {}

    static ImU32 laneColor(int lane, int alpha = 255);
    static float requiredWidth(const std::vector<CommitInfo>& commits, float scale);

    void drawRow(int row, const CommitInfo& commit, const std::vector<CommitInfo>& commits,
        const std::vector<float>& row_heights, const std::vector<std::vector<int>>& parent_rows,
        AvatarCache* avatars, const ImVec2* ref_connector_start = nullptr) const;

private:
    float px(float value) const { return value * scale_; }
    float scale_ = 1.0f;
};
