# `PhoenixKit.Notifications.Types`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.102/lib/phoenix_kit/notifications/types.ex#L1)

Registry of notification types for the per-user preferences UI.

A type is a named group of related activity actions that a user can toggle
as one unit. Core types (`"account"`, `"posts"`, `"comments"`) ship with
PhoenixKit; external modules contribute additional types via the optional
`notification_types/0` callback on `PhoenixKit.Module` (same pattern the
integrations system uses for `integration_providers/0`).

Shape of a type:

    %{
      key: "posts",
      label: "Posts",
      description: "Likes, comments, mentions on your posts",
      actions: ["post.liked", "post.commented", "post.mentioned"],
      default: true
    }

The `maybe_create_from_activity/1` pipeline resolves the activity's action
back to a type via `type_for_action/1` and asks `Prefs.user_wants?/2`
whether the recipient has that type enabled.

Actions not matched by any registered type are treated as fail-open — the
notification still fires. New action types can ship without a UI update
while remaining visible to users.

# `t`

```elixir
@type t() :: %{
  key: String.t(),
  label: String.t(),
  description: String.t(),
  actions: [String.t()],
  default: boolean()
}
```

# `default_for`

```elixir
@spec default_for(String.t()) :: boolean()
```

Returns the default-enabled flag for a type key. Missing types default to `true`.

# `find`

```elixir
@spec find(String.t()) :: t() | nil
```

Look up a type by its key. Returns `nil` when not registered.

# `list`

```elixir
@spec list() :: [t()]
```

Full list of types — core plus module-contributed, stable order.

# `type_for_action`

```elixir
@spec type_for_action(String.t()) :: String.t() | nil
```

Resolves an action string to the key of its owning type.

Returns `nil` when no type claims the action — the caller treats that as
fail-open and still delivers the notification.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
