<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DSL: AshStateMachine
Provides tools for defining and working with resource-backed state machines.
## state_machine
### Nested DSLs
* [transitions](#state_machine-transitions)
* transition
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`initial_states`](#state_machine-initial_states){: #state_machine-initial_states .spark-required} | `list(atom)` | | The allowed starting states of this state machine. |
| [`deprecated_states`](#state_machine-deprecated_states){: #state_machine-deprecated_states } | `list(atom)` | `[]` | A list of states that have been deprecated but are still valid. These will still be in the possible list of states, but `:*` will not include them. |
| [`extra_states`](#state_machine-extra_states){: #state_machine-extra_states } | `list(atom)` | `[]` | A list of states that may be used by transitions to/from `:*`. See the docs on wildcards for more. |
| [`state_attribute`](#state_machine-state_attribute){: #state_machine-state_attribute } | `atom` | `:state` | The attribute to store the state in. |
| [`default_initial_state`](#state_machine-default_initial_state){: #state_machine-default_initial_state } | `atom` | | The default initial state |
## state_machine.transitions
### Wildcards
Use `:*` to represent "any action" when used in place of an action, or "any state" when used in place of a state.
For example:
```elixir
transition :*, from: :*, to: :*
```
The full list of states is derived at compile time from the transitions.
Use the `extra_states` to express that certain types should be included
in that list even though no transitions go to/from that state explicitly.
This is necessary for cases where there are states that use `:*` and no
transition explicitly leads to that transition.
### Nested DSLs
* [transition](#state_machine-transitions-transition)
## state_machine.transitions.transition
```elixir
transition action
```
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`action`](#state_machine-transitions-transition-action){: #state_machine-transitions-transition-action .spark-required} | `atom` | | The corresponding action that is invoked for the transition. Use `:*` to allow any update action to perform this transition. |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`from`](#state_machine-transitions-transition-from){: #state_machine-transitions-transition-from .spark-required} | `list(atom) \| atom` | | The states in which this action may be called. If not specified, then any state is accepted. Use `:*` to refer to all states. |
| [`to`](#state_machine-transitions-transition-to){: #state_machine-transitions-transition-to .spark-required} | `list(atom) \| atom` | | The states that this action may move to. If not specified, then any state is accepted. Use `:*` to refer to all states. |
### Introspection
Target: `AshStateMachine.Transition`
<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>