import fetch from 'node-fetch';

const BASE_URL = 'http://notifications-dev.madbean.ovh';
const PATH = '/notifications';

const notifyMatchedActivity = (user, activity, client) => {
  const message = {
    title: 'Nouveau match!',
    body: `Rencontrez vite ${client.displayName} pour l'activitée :${activity.name}`,
    email: user.email,
  };

  const options = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Accept: 'application/json',
    },
    body: JSON.stringify(message),
  };

  fetch(`${BASE_URL}${PATH}`, options)
    .catch(console.log);
};

export default {
  notifyMatchedActivity,
};
