# `ExWapp.Session.Outbound.Fanout`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/session/outbound/fanout.ex#L1)

Resolves direct-message fanout targets.

This module owns the pure decision layer for recipient devices, linked
devices, self-chat payload selection, and soft cached targets. Store reads,
cache eviction, logging, encryption, and transport remain at the worker
boundary.

# `context`

```elixir
@type context() :: %{
  signal_sessions: ExWapp.Signal.SessionStore.t() | nil,
  jid: String.t(),
  prekey_bundles: term(),
  target_hints: map(),
  own_base_jid: String.t(),
  own_lid_jid: String.t(),
  own_device_id: integer(),
  lid_mapping: map(),
  self_chat_mode: term()
}
```

# `payload_kind`

```elixir
@type payload_kind() :: :recipient | :own
```

# `resolution`

```elixir
@type resolution() :: %{
  target_specs: [target_spec()],
  recipient_targets: [String.t()],
  own_targets: [String.t()],
  all_usync_devices: term(),
  cached_eviction_batches: [[String.t()]],
  family_rejections: [String.t()],
  self_chat?: boolean()
}
```

# `target_spec`

```elixir
@type target_spec() :: %{jid: String.t(), payload_kind: payload_kind()}
```

# `resolve`

```elixir
@spec resolve(context()) :: resolution()
```

Resolves all encrypted target specifications from a prepared session context.

Cached-only targets are included only when a prekey bundle proves them
reachable. Unreachable cached targets are returned as eviction batches so
the worker can apply the storage effect after this pure decision.

# `resolve_soft_targets`

```elixir
@spec resolve_soft_targets(
  ExWapp.Signal.SessionStore.t() | nil,
  term(),
  term(),
  term(),
  term()
) ::
  {[String.t()], [String.t()]}
```

Resolves live and cached target candidates without applying cache effects.

The second tuple element contains cached targets that the caller should
evict. Returning that decision keeps persistence outside this module.

# `self_chat_destination?`

```elixir
@spec self_chat_destination?(term(), term(), term(), term()) :: boolean()
```

Returns whether the destination belongs to the local account identity.

Both phone-number and LID identities are considered.

---

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