Problem statement
Design the object model and public APIs for the reminder engine a booking product uses to fire notifications at configured offsets before each appointment, across multiple channels, surviving reschedules and avoiding duplicate sends.
Operating context. Each appointment has a start time and a reminder schedule: fire at offsets before it (24 hours, 1 hour) over chosen channels (email, SMS, push). A dispatcher wakes due reminders and hands each to its channel. When an appointment is rescheduled, its pending reminders shift to the new time; when cancelled, they are dropped. A reminder must be sent at most once even under retries, and each channel may fail and need bounded retry. Single-process scheduler, one wall clock.
Out of scope. The concrete channel providers' network calls (model only the send interface), template rendering, the REST surface, and persistence (assume in-memory for v1).
What to produce. The class hierarchy (Appointment, reminder rule, scheduled reminder, channel strategy, dispatcher service), each class's public API, and the reminder state machine (scheduled → due → sent / failed / cancelled). Be explicit about: how due reminders are found without scanning every appointment each tick, how a reschedule moves pending reminders without duplicating them, and how channels and the retry policy are pluggable.
Requirements
The requirements come with Premium
PremiumThe statement above is free to read.