'use strict';

function sendNotificationsChange(emailAddress) {
    
    var Mail = require('dw/net/Mail');
    var Site = require('dw/system/Site');
    var Template = require('dw/util/Template');
    var HashMap = require('dw/util/HashMap');

    var context = new HashMap();
    var email = new Mail();
    var template = new Template('notificationchangeemail');

    email.addTo(emailAddress);
    email.setFrom(Site.current.getCustomPreferenceValue('customerServiceEmail') || 'no-reply@salesforce.com');
    email.setSubject('Notification Settings Changed');
    email.setContent(template.render(context).text, 'text/html', 'UTF-8');
    email.send();
}

module.exports = {
    sendNotificationsChange: sendNotificationsChange
};