# ListNotificationChannels

## Overview

ListNotificationChannels returns every NotificationChannel row registered in the channel registry. An optional `enabledOnly` filter narrows the result to channels whose admin kill-switch is on. Admin UIs use the unfiltered form to render the channel-management screen; the dispatcher uses the `enabledOnly = true` form to enumerate the channels currently eligible for fan-out.

## Business Rules

- Accepts optional filter parameter: `{ enabledOnly? }`, plus standard pagination inputs (`limit`, `offset`, `orderBy`, `orderDirection`)
- When `enabledOnly` is true, returns only rows where `enabled = true`
- When `enabledOnly` is false or omitted, returns every registered channel including disabled and reserved ones
- Returns an empty list when no rows match (no channels registered, or none enabled when `enabledOnly = true`)
- Each row carries `channelId`, `displayName`, capability flags (`supportsHtmlBody`, `supportsAttachments`, `supportsRichActions`), and the `enabled` flag

## Process Flow

```mermaid
flowchart TD
    A[Receive optional enabledOnly] --> B[Build NotificationChannel query]
    B --> C{enabledOnly = true?}
    C -->|Yes| D[Filter rows where enabled = true]
    C -->|No or omitted| E[No filter]
    D --> F[Return channel list]
    E --> F
```

## External Dependencies

- None

## Error Scenarios

- **NO_MATCH**: No matching row exists for the supplied input; null or empty result is returned

> Returning `NO_MATCH` is a normal empty/null result rather than a thrown error — the query returns the null/empty value and does not raise `NoMatchError`.

## Test Cases

- returns every registered NotificationChannel when no filter is supplied
- returns only `enabled = true` channels when `enabledOnly = true`
- returns disabled channels when `enabledOnly` is omitted or false
- returns reserved channels (SMS, PUSH, SLACK, TEAMS) when they exist in the registry
- returns an empty list when no channels match the filter
