# CS-06 notification service, built in steps. Each step is the whole
# program at that point in the study, and is built and tested on its own.
#   step-1  channels as adapters over fake providers, templates,
#           preferences, idempotent deliveries, and scheduled retries
#   step-2  change: quiet hours and rate limits
set(cs_notify_sources_1 adapters.cpp catalog.cpp notifier.cpp providers.cpp)
set(cs_notify_sources_2 ${cs_notify_sources_1} quiet_hours.cpp rate_limiter.cpp)
foreach(step IN ITEMS 1 2)
  list(TRANSFORM cs_notify_sources_${step} PREPEND step-${step}/ OUTPUT_VARIABLE sources)
  add_library(cs_notify_step${step} STATIC ${sources})
  target_include_directories(cs_notify_step${step} PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/step-${step})
  lld_add_test(cs_notify_step${step}_tests
    SOURCES step-${step}/tests/test_step${step}.cpp LABELS unit)
  target_link_libraries(cs_notify_step${step}_tests PRIVATE cs_notify_step${step})
  lld_add_example(cs_notify_step${step}_demo SOURCES step-${step}/main.cpp
    EXPECTED_OUTPUT step-${step}/expected_output.txt)
  target_link_libraries(cs_notify_step${step}_demo PRIVATE cs_notify_step${step})
endforeach()
