# `ASM.Extensions.Routing.Router`
[🔗](https://github.com/nshkrdotcom/agent_session_manager/blob/v0.9.2/lib/asm/extensions/routing/router.ex#L1)

Extension-owned routing process for provider selection and failover.

# `health_status`

```elixir
@type health_status() :: ASM.Extensions.Routing.HealthTracker.health_status()
```

Provider health information for routing decisions.

# `provider_id`

```elixir
@type provider_id() :: ASM.Extensions.Routing.HealthTracker.provider_id()
```

Unique provider candidate identifier used by this router instance.

# `selection`

```elixir
@type selection() :: %{id: provider_id(), provider: atom(), provider_opts: keyword()}
```

Provider selection result returned by `select_provider/2`.

# `t`

```elixir
@type t() :: %ASM.Extensions.Routing.Router{
  candidates: [candidate()],
  clock: clock_fun(),
  health_tracker: ASM.Extensions.Routing.HealthTracker.t(),
  strategy: strategy_module(),
  strategy_state: ASM.Extensions.Routing.Strategy.state()
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `health_snapshot`

```elixir
@spec health_snapshot(pid()) ::
  {:ok, %{required(provider_id()) =&gt; health_status()}} | {:error, ASM.Error.t()}
```

# `provider_health`

```elixir
@spec provider_health(pid(), provider_id()) ::
  {:ok, health_status()} | {:error, ASM.Error.t()}
```

# `report_failure`

```elixir
@spec report_failure(pid(), selection() | provider_id(), term()) ::
  :ok | {:error, ASM.Error.t()}
```

# `report_success`

```elixir
@spec report_success(pid(), selection() | provider_id()) ::
  :ok | {:error, ASM.Error.t()}
```

# `select_provider`

```elixir
@spec select_provider(
  pid(),
  keyword()
) :: {:ok, selection()} | {:error, ASM.Error.t()}
```

# `start_link`

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

---

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