# `Obscura.Profile.Preparer`
[🔗](https://github.com/hfiguera/obscura/blob/v0.2.0/lib/obscura/profile/preparer.ex#L1)

Supervised asynchronous preparation and ownership of a reusable profile runtime.

Add the preparer to an application supervision tree, then query `status/1`
or call `await/2` before accepting work which requires the model-backed
profile. The process prepares exactly once and retains the runtime for reuse.
`status/1` exposes the latest report-safe preparation event while large model
assets download or load. Download authorization and offline behavior come
from the `:prepare_options` passed to `start_link/1`.

# `server`

```elixir
@type server() :: GenServer.server()
```

# `status`

```elixir
@type status() :: :preparing | :ready | :failed
```

# `await`

```elixir
@spec await(server(), timeout()) ::
  {:ok, Obscura.Profile.Runtime.t()} | {:error, Obscura.Diagnostic.t()}
```

Waits for preparation and returns the reusable runtime or diagnostic.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `runtime`

```elixir
@spec runtime(server()) ::
  {:ok, Obscura.Profile.Runtime.t()}
  | {:error, :not_ready | Obscura.Diagnostic.t()}
```

Returns the reusable runtime when preparation is complete.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts a supervised profile preparer.

# `status`

```elixir
@spec status(server()) :: map()
```

Returns readiness and the latest safe progress event.

# `subscribe`

```elixir
@spec subscribe(server()) :: :ok
```

Subscribes the caller to progress and completion messages.

---

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