You are implementing part of a marketing engine for an event marketplace.
Assume the following data is available:
-
Customer
:
id
,
city
,
birth_month
,
birth_day
,
latitude
,
longitude
-
Event
:
id
,
title
,
city
,
start_time
,
latitude
,
longitude
-
NotificationService.send(customer_id, message)
sends a notification to a customer
Implement a MarketingEngine with a method such as send_customer_notifications(customer, events, today).
The engine should support multiple campaigns:
-
Notify the customer about all upcoming events in the same city as the customer.
-
Notify the customer about the single upcoming event whose date is closest to the customer's next birthday after
today
.
-
Notify the customer about the 5 upcoming events closest to the customer by geographic distance. For this interview, you may use Euclidean distance on latitude and longitude.
Design the code so that new campaigns can be added without changing the core engine. Also explain how you would handle ties, fewer than 5 matching events, and notification formatting.