# `Mobus.Stepwise.Components.StepwiseAdvance`
[🔗](https://github.com/fosferon/mobus_stepwise/blob/main/lib/mobus/stepwise/components/stepwise_advance.ex#L1)

Advances (or reverses) the current step for stepwise workflows.

Step ordering is derived from `Mobus.Stepwise.SpecHelpers.ordered_steps/1`:
- `spec.steps` (list of step IDs), otherwise
- `states` with `step_number` (ascending)

Supported events:
- `:next` / `"next"`
- `:back` / `"back"`

# `call`

```elixir
@spec call(map(), map()) :: map()
```

Advances or reverses the current step based on the event.

This is an ALF pipeline stage. For `:next`/`"next"` events, moves to the next
step in order. For `:back`/`"back"`, moves to the previous step. For custom
events, looks up explicit transitions in `spec.transitions`. Updates history
and trace on successful transitions.

Skipped when `skip_transition: true` is set (projection-only mode) or on error status.

## Parameters

  * `event` — pipeline event map with `:spec`, `:runtime`, `:event`, `:payload`
  * `opts` — ALF stage options (unused)

## Returns

  * Updated event map with `:runtime` (potentially new `current_state`),
    `:previous_state`, and `:state_changed?` flag.

---

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