# `SquidMesh.Runtime.Dispatcher`
[🔗](https://github.com/ccarvalho-eng/squid_mesh/blob/main/lib/squid_mesh/runtime/dispatcher.ex#L1)

Enqueues durable workflow step execution.

The workflow contract stays declarative while this module bridges runtime
intent into Oban-backed execution jobs.

# `dispatch_error`

```elixir
@type dispatch_error() :: Ecto.Changeset.t() | term()
```

# `dispatch_event`

```elixir
@type dispatch_event() ::
  {:run_dispatched, SquidMesh.Run.t(), Oban.Job.t(), atom(),
   pos_integer() | nil}
```

# `dispatch_opts`

```elixir
@type dispatch_opts() :: [{:schedule_in, pos_integer()}]
```

# `dispatch_target`

```elixir
@type dispatch_target() :: atom()
```

# `dispatch_run`

```elixir
@spec dispatch_run(SquidMesh.Config.t(), SquidMesh.Run.t(), dispatch_opts()) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()]} | {:error, dispatch_error()}
```

# `dispatch_run_with_events`

```elixir
@spec dispatch_run_with_events(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  dispatch_opts()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()], [dispatch_event()]}
  | {:error, dispatch_error()}
```

# `dispatch_steps`

```elixir
@spec dispatch_steps(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  [dispatch_target()],
  keyword()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()]} | {:error, dispatch_error()}
```

# `dispatch_steps_with_events`

```elixir
@spec dispatch_steps_with_events(
  SquidMesh.Config.t(),
  SquidMesh.Run.t(),
  [dispatch_target()],
  keyword()
) ::
  {:ok, Oban.Job.t() | [Oban.Job.t()], [dispatch_event()]}
  | {:error, dispatch_error()}
```

---

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