# SPDX-License-Identifier: MPL-2.0
#
# Brique client du Studio host : client C++ du protocole Studio - Core 0.2
# (docs/specs/protocole-studio-core-0.2.md §2, §3, §4 ; ADR 0006).
# Rôle, API et licences : voir README.md.

add_library(sequa_host_client
    src/client.cpp
    src/wire.cpp)
add_library(sequa::host_client ALIAS sequa_host_client)

target_include_directories(sequa_host_client
    PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(sequa_host_client PUBLIC cxx_std_20)

# nlohmann_json est PUBLIC : les charges utiles de l'API sont des nlohmann::json.
# ixwebsocket reste PRIVÉ : le transport ne fuit pas dans l'interface publique.
target_link_libraries(sequa_host_client
    PUBLIC nlohmann_json::nlohmann_json
    PRIVATE ixwebsocket::ixwebsocket)

sequa_target_defaults(sequa_host_client)

# --- Tests : faux serveur WebSocket local, sans dépendre de sequa_core_server -------------
if(SEQUA_BUILD_TESTS)
    add_executable(sequa_host_client_tests
        tests/main.cpp
        tests/test_wire.cpp
        tests/test_client.cpp)
    target_link_libraries(sequa_host_client_tests
        PRIVATE sequa::host_client doctest::doctest ixwebsocket::ixwebsocket)
    sequa_target_defaults(sequa_host_client_tests)
    doctest_discover_tests(sequa_host_client_tests)
endif()
