// engine/multi-channel-notifier.ts — Dispatches notifications to all configured channels (SPEC-446)
// Each channel is independent — failure of one doesn't affect others
// All fire-and-forget via void promise.catch(() => {})
const NOTIFY_TRANSITIONS = new Set(['review', 'approved', 'done', 'blocked']);
/**
 * Dispatches notifications to all configured channels (fire-and-forget, non-blocking).
 * Only fires for transitions that warrant notification (review, approved, done, blocked).
 */
export function dispatchMultiChannelNotify(specId, specTitle, newStatus, _projectId, projectPath) {
    if (!NOTIFY_TRANSITIONS.has(newStatus)) {
        return;
    }
    const message = buildNotificationMessage(specId, specTitle, newStatus);
    // Slack channel (uses projectPath-based config)
    /* c8 ignore next */
    void notifySlackChannel(message, projectPath).catch((_err) => {
        /* best-effort */
    });
}
function buildNotificationMessage(specId, specTitle, newStatus) {
    return `*${specId}*: ${specTitle} → \`${newStatus}\``;
}
async function notifySlackChannel(message, projectPath) {
    if (!projectPath) {
        return;
    }
    try {
        const { buildManualPayload, dispatchToSlack } = await import('./slack-dispatcher.js');
        const { getSlackConfig } = await import('../storage/slack-store.js');
        const config = await getSlackConfig(projectPath);
        if (!config?.webhookUrl || !config.enabled) {
            return;
        }
        const payload = buildManualPayload(message);
        await dispatchToSlack(config.webhookUrl, payload);
    }
    catch {
        /* best-effort — never throw */
    }
}
//# sourceMappingURL=multi-channel-notifier.js.map