add_imgui_app(agents_dashboard
    main.cpp
    # Registry functions (issue 0129):
    ${CMAKE_SOURCE_DIR}/functions/core/http_request.cpp
    ${CMAKE_SOURCE_DIR}/functions/core/http_get_json.cpp
    ${CMAKE_SOURCE_DIR}/functions/core/sse_client.cpp
    ${CMAKE_SOURCE_DIR}/functions/infra/secret_store.cpp
)

target_include_directories(agents_dashboard PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}/vendor      # nlohmann/json.hpp
)

# fn_table_viz: optional — guards keep the app compilable without it.
if(TARGET fn_table_viz)
    target_link_libraries(agents_dashboard PRIVATE fn_table_viz)
endif()

# fn_module_data_table: render_grid_stage0 + ColumnSpec + TableEvent (issue 0131)
# Module lives in cpp/modules/data_table/. Optional: #if __has_include guard applies.
if(TARGET fn_module_data_table)
    target_link_libraries(agents_dashboard PRIVATE fn_module_data_table)
endif()

if(WIN32)
    set_target_properties(agents_dashboard PROPERTIES WIN32_EXECUTABLE TRUE)
    # secret_store.cpp uses CryptProtectData / CryptUnprotectData (crypt32)
    target_link_libraries(agents_dashboard PRIVATE crypt32)
endif()
