# `Alternera.Plugin.Editor.HeaderSuggestions`
[🔗](https://github.com/10e-ab/alternera-sdk/blob/v0.9.0/alternera_plugin_editor/lib/alternera/plugin/editor/header_suggestions.ex#L1)

Header names and values as a `<.suggest_input>` offers them: the names
recorded in the source exchange first, then `Alternera.Plugin.HeaderCatalogue`'s,
and for a value field the catalogue's typical values of the header its
row names.

A recorded name keeps its recorded spelling and says
`"In the source exchange"` under it; a catalogue name that is already
recorded, ignoring case, is left out, so `content-type` and
`Content-Type` are not offered twice. A catalogue entry shows its
description under it.

A value field's list follows the name its row holds on the server, so
it changes on the re-render after the name's `phx-change`; a header
with no typical values (or a name not in the catalogue) gives `nil`,
and the input renders plain.

# `suggestion`

```elixir
@type suggestion() :: %{value: String.t(), description: String.t() | nil}
```

An entry as the `SuggestInput` hook reads it.

# `catalogue`

```elixir
@spec catalogue(Alternera.Plugin.HeaderCatalogue.side()) :: [suggestion()]
```

The catalogue's names of `side` as suggestions, with their descriptions.

# `merge`

```elixir
@spec merge([[suggestion()]]) :: [suggestion()]
```

The lists in order, each name kept the first time it appears, ignoring
case: so whatever comes first decides the spelling and the description.

# `names`

```elixir
@spec names(Alternera.Plugin.HeaderCatalogue.side(), [
  String.t() | {String.t(), term()}
]) :: [
  suggestion()
]
```

The header names `side` offers: `recorded` (names, or `{name, value}`
pairs as `PipelinesLive.NameHints` holds them) first, then the
catalogue's not among them.

# `names_json`

```elixir
@spec names_json(Alternera.Plugin.HeaderCatalogue.side(), [
  String.t() | {String.t(), term()}
]) ::
  String.t()
```

`names/2` as JSON, for a caller that shares one list between many inputs.

# `recorded`

```elixir
@spec recorded([String.t() | {String.t(), term()}]) :: [suggestion()]
```

The recorded names as suggestions, saying where they come from.

# `values`

```elixir
@spec values(Alternera.Plugin.HeaderCatalogue.side(), String.t() | nil) ::
  [suggestion()] | nil
```

The typical values of the header `name` in `side`, or nil when the
catalogue has none for it.

---

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