import 'server-only'; import { EmailNotificationProvider } from './email-provider'; import type { NotificationChannel, NotificationProvider } from '../types'; export function getNotificationProvider( channel: NotificationChannel, providerKey?: string, ): NotificationProvider { if (channel === 'email') { const provider = new EmailNotificationProvider(); if (providerKey && provider.key !== providerKey) { throw new Error(`Unsupported email provider: ${providerKey}`); } return provider; } throw new Error(`Notification provider for channel ${channel} is not implemented yet.`); }