# `PhoenixKitCatalogue.Export.Destination`
[🔗](https://github.com/BeamLabEU/phoenix_kit_catalogue/blob/v0.19.0/lib/phoenix_kit_catalogue/export/destination.ex#L1)

Behaviour for export destinations (e.g. PRO100, Universal).

Each destination module defines a key, a human-readable label, the list of
format options it supports, and a `render/2` function that produces the
file content for a given format key and export context.

## Adding a new destination

1. Create a module that `@behaviour PhoenixKitCatalogue.Export.Destination`.
2. Implement all four callbacks.
3. Register it in `PhoenixKitCatalogue.Export.destinations/0`.

# `formats`

```elixir
@callback formats() :: [{atom(), String.t()}]
```

Supported formats as `[{key, label}]` pairs.
`key` is an atom used when calling `render/2`; `label` is the display string.

# `key`

```elixir
@callback key() :: atom()
```

Machine key for the destination (e.g. `:pro100`).

# `label`

```elixir
@callback label() :: String.t()
```

Human-readable label shown in the UI select.

# `render`

```elixir
@callback render(format_key :: atom(), ctx :: map()) ::
  {filename :: String.t(), iodata :: iodata(), mime :: String.t()}
```

Renders the export content.

`format_key` must be one of the atoms from `formats/0`.
`ctx` is a map with keys: `:items`, `:index`, `:catalogues`.

Returns `{filename, iodata, mime_type}`.

---

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