# `ExWapp.AppState.Engine.Dispatch`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/appstate/engine/dispatch.ex#L1)

Applies decoded app-state mutations to local contact and chat state.

The decoder turns WhatsApp patch payloads into normalized mutation maps; this
module is the bridge that translates those maps into the project's local
`ExWapp.Contact` and `ExWapp.Chat` updates.

# `action_value`

```elixir
@type action_value() :: WAWebProtobufSyncAction.SyncActionValue.t() | nil
```

# `patch_info`

```elixir
@type patch_info() :: %{
  type: String.t(),
  mutations: [map()],
  timestamp: integer() | nil
}
```

# `apply_outgoing_patch`

```elixir
@spec apply_outgoing_patch(struct(), patch_info()) :: :ok
```

Replays the local side effects of an outgoing patch after server ack.

# `apply_outgoing_patch`

```elixir
@spec apply_outgoing_patch(struct(), patch_info(), keyword()) :: :ok
```

# `dispatch_mutation`

```elixir
@spec dispatch_mutation(struct(), [String.t()], action_value()) :: :ok | :ignored
```

Backwards-compatible helper that treats the mutation as a SET operation.

# `dispatch_mutation`

```elixir
@spec dispatch_mutation(struct(), non_neg_integer(), [String.t()], action_value()) ::
  :ok | :ignored
```

Dispatches one decoded mutation into the appropriate local store update.

# `dispatch_mutation`

```elixir
@spec dispatch_mutation(
  struct(),
  non_neg_integer(),
  [String.t()],
  action_value(),
  keyword()
) ::
  :ok | :ignored
```

Dispatches one decoded mutation with feature-specific persistence options.

The `:max_records` option controls call-log retention when the mutation
carries a `CallLogRecord`; other mutation types ignore it.

---

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