/* eslint-disable no-restricted-globals */
/* eslint-disable no-undef */
// Service worker — اسکریپت‌های Firebase لوکال (بدون gstatic CDN)

importScripts("/vendor/firebase/firebase-app.js");
importScripts("/vendor/firebase/firebase-messaging.js");

const firebaseConfig = {
  apiKey: "API_KEY",
  authDomain: "AUTH DOMAIN",
  projectId: "PROJECT ID",
  storageBucket: "STORAGE BUCKET",
  messagingSenderId: "MESSAGING SENDER ID",
  appId: "APP ID",
  measurementId: "MEASUREMENT ID",
};

firebase.initializeApp(firebaseConfig);

const messaging = firebase.messaging();

messaging.onBackgroundMessage(function (payload) {
  const notificationTitle = payload.notification.title;
  const notificationOptions = {
    body: payload.notification.body,
  };

  self.registration.showNotification(notificationTitle, notificationOptions);
});
