const admin = require("firebase-admin");

exports.sendPushNotification = async (deviceToken, title, body , data) => {
    try {
      const message = {
        token: deviceToken, // FCM device token from the mobile app
        notification: {
          title: title,
          body: body,
        },
        data:data
      };
  
      const response = await admin.messaging().send(message);
      console.log("Successfully sent message:", response);
    } catch (error) {
      console.error("Error sending push notification:", error);
    }
  };
  