# `StatifierUI.Fixtures.Source`
[🔗](https://github.com/riddler/statifier-ui/blob/v0.11.0/lib/statifier_ui/fixtures/source.ex#L1)

Behaviour for a host-application module that supplies fixture data.

A host implements `scenarios/0` and `example_events/0`; `StatifierUI.Fixtures.from_source/1`
calls both and routes the results through the same validation `new/1` applies
to a JSON sidecar, so the two delivery paths in ADR-0003 converge on one
struct. `datasets/0` and `expressions/0` are optional (ADR-0006): a host
with no expressions to evaluate need not implement either.

`use StatifierUI.Fixtures.Source` injects empty defaults for all four
callbacks, so a host that only has scenarios (or only events, or only
datasets, or only expressions) can implement just the one it has.

# `datasets`

```elixir
@type datasets() :: %{optional(String.t()) =&gt; map()}
```

A named example datamodel for evaluating expressions, as `datasets/0` returns it.

# `example_events`

```elixir
@type example_events() :: %{optional(String.t()) =&gt; term()}
```

A named example event payload, as `example_events/0` returns it.

# `expressions`

```elixir
@type expressions() :: %{optional(String.t()) =&gt; map()}
```

A named free-standing expression fixture, as `expressions/0` returns it.

# `scenarios`

```elixir
@type scenarios() :: %{optional(String.t()) =&gt; map()}
```

A named example datamodel, as `scenarios/0` returns it.

# `datasets`
*optional* 

```elixir
@callback datasets() :: datasets()
```

Named example datamodels for evaluating expressions against (ADR-0006): a
dataset name mapped to a situation, which may be as small as an expression
needs.

# `example_events`

```elixir
@callback example_events() :: example_events()
```

Example event payloads: an event name mapped to a sample `_event.data`
value.

# `expressions`
*optional* 

```elixir
@callback expressions() :: expressions()
```

Named free-standing expression fixtures (ADR-0006): an expression name
mapped to a predicator `"source"` string and an optional `"expect"` map of
expected results keyed by dataset name.

# `scenarios`

```elixir
@callback scenarios() :: scenarios()
```

Named example datamodels: a scenario name mapped to a complete example
datamodel for that situation.

---

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