/**
 * NotificationWorker - Processes queued notifications
 *
 * This worker dequeues notification messages and sends them using the Notification service.
 * Use with Queue.dequeue() in a background process or cron job.
 */
import { Notification } from '../../../src/index.js';
import { createQueueWorker } from './createQueueWorker.js';
export const NotificationWorker = Object.freeze({
    ...createQueueWorker({
        kindLabel: 'notification',
        defaultQueueName: 'notifications',
        maxAttempts: 3,
        getLogFields: (payload) => ({
            recipient: payload.recipient,
            queuedAt: payload.timestamp,
        }),
        handle: async (payload) => {
            await Notification.send(payload.recipient, payload.message, payload.options);
        },
    }),
});
export default NotificationWorker;
