import type { SubscriptionChannel } from "../types"; import { sendEmailNotifications, sendEmailVerification, validateEmailConfig, } from "./email"; import { sendSlackNotifications, validateSlackConfig } from "./slack"; import { sendWebhookNotifications, sendWebhookVerification, validateWebhookConfig, } from "./webhook"; export function getChannel(channelType: string): SubscriptionChannel | null { switch (channelType) { case "email": { return { id: "email", sendNotifications: sendEmailNotifications, sendVerification: sendEmailVerification, validateConfig: validateEmailConfig, }; } case "webhook": { return { id: "webhook", sendNotifications: sendWebhookNotifications, sendVerification: sendWebhookVerification, validateConfig: validateWebhookConfig, }; } case "slack": { return { id: "slack", sendNotifications: sendSlackNotifications, validateConfig: validateSlackConfig, }; } default: return null; } }