# Each shape lives in its own library, so each boundary's code can link
# only the shapes it is allowed to know.
add_library(arch_map_api STATIC api/dto.cpp)                  # client shapes
target_include_directories(arch_map_api PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/api)

add_library(arch_map_persistence STATIC persistence/record.cpp)  # stored shapes
target_include_directories(arch_map_persistence PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/persistence)

# The mapping knows all three shapes; the domain (the aggregate page's
# library, unchanged) knows none of the other two.
add_library(arch_map_mapping STATIC mapping/mapping.cpp)
target_include_directories(arch_map_mapping PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/mapping)
target_link_libraries(arch_map_mapping PUBLIC arch_agg_domain arch_map_api arch_map_persistence)

add_library(arch_map_app STATIC app/enrollment_api.cpp)
target_include_directories(arch_map_app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/app)
target_link_libraries(arch_map_app PRIVATE arch_map_mapping)

lld_add_example(arch_enrollment_mapping SOURCES main.cpp EXPECTED_OUTPUT expected_output.txt)
target_link_libraries(arch_enrollment_mapping PRIVATE arch_map_app)

lld_add_test(arch_map_record_tests SOURCES tests/test_record.cpp)
target_link_libraries(arch_map_record_tests PRIVATE arch_map_persistence)

lld_add_test(arch_map_mapping_tests SOURCES tests/test_mapping.cpp)
target_link_libraries(arch_map_mapping_tests PRIVATE arch_map_mapping)

lld_add_test(arch_map_api_tests SOURCES tests/test_api.cpp)
target_link_libraries(arch_map_api_tests PRIVATE arch_map_app)
