importScripts('https://www.gstatic.com/firebasejs/10.14.1/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/10.14.1/firebase-messaging-compat.js');

firebase.initializeApp({
  apiKey: "AIzaSyD2qHjGcEkHpPJKtj6moHgWxOF9bgiPzo4",
  projectId: 'fest-6f8db',
  messagingSenderId: '1058806233312',
  appId: '1:1058806233312:web:ad9f595d3e47a1cec3b885',
});

const messaging = firebase.messaging();

// Notifica in background (browser chiuso)
messaging.onBackgroundMessage((payload) => {
  self.registration.showNotification(payload.notification.title, {
    body: payload.notification.body,
    icon: '/assets/img/favicon/favicon.png',
    data: payload.data,
  });
});
