curaflow/backend/notificationManager.js

31 lines
858 B
JavaScript

/**
* NotificationManager: Handles mock WhatsApp notifications for Curio
*/
class NotificationManager {
constructor() {
this.notificationsSent = [];
}
sendRescheduleAlert(patientPhone, tenantName, oldTime, newTime) {
const message = `🔔 *Curio Alert*: A slot has just opened up at ${tenantName} for today at ${newTime}!
Would you like to move your ${oldTime} appointment to this earlier slot?
Reply:
1. Yes, move me!
2. No, keep my current time.`;
console.log(`[WhatsApp to ${patientPhone}]: ${message}`);
this.notificationsSent.push({ phone: patientPhone, message, timestamp: new Date() });
return { success: true, message: "Notification sent." };
}
getRecentNotifications() {
return this.notificationsSent;
}
}
module.exports = new NotificationManager();