'use strict';
import { sendEmail } from '../fd/fd-toolbox-web/mailing/fd-emails.js';
import { readFile } from 'node:fs/promises';
import { getRequiredStringEnvSetting } from '../../../fd-toolbox/infra/env-functions.js';
import { envSettingKeys } from '../../common/infra/env-setting-keys.js';
import { getHtmlTemplatesPath } from '../html/email.js';

var __defProp=Object['defineProperty'],__name=(_0x243f5b,_0x3842ac)=>__defProp(_0x243f5b,'name',{'value':_0x3842ac,'configurable':!![]});async function afterUpdate(_0x438d6c){if(_0x438d6c['crudUpdateConfig']['isCreate']){const _0x14e6a2=_0x438d6c['modifiedResource'];if(_0x14e6a2['isExternal']&&_0x14e6a2['user']['email']){const _0x28e467=getHtmlTemplatesPath('email-notification.html'),_0x256d65=await readFile(_0x28e467,{'encoding':'utf-8'}),_0x332564=_0x256d65['replace']('{{notificationMessage}}',_0x14e6a2['message']),_0x4049a0={'from':getRequiredStringEnvSetting(envSettingKeys['senderEmail']),'to':[_0x14e6a2['user']['email']],'subject':_0x14e6a2['description']??'','body':_0x332564};await sendEmail(_0x4049a0,!![]);}}}__name(afterUpdate,'afterUpdate');

export { afterUpdate as afterUpdateNotification };
