# `ExGAM.Canonical.Record`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/canonical/record.ex#L1)

Strict restoration boundary for durable ExGAM records.

Ledger values are canonical, string-keyed maps. A transition restores such a
value through the record module's `from_canonical/1` callback exactly once;
governed code then works with the returned struct. This module intentionally
provides no atom-or-string field lookup and no fallback constructor.

Record modules are passed explicitly because the set of governed event types
is closed by `ExGAM.Domain.Event`; discovering an arbitrary decoder must
never extend kernel authority.

# `restored`

```elixir
@type restored() :: %{:ref =&gt; String.t(), optional(atom()) =&gt; term()}
```

# `decode`

```elixir
@spec decode(module(), term()) :: {:ok, struct()} | {:error, term()}
```

Restores a record using its strict canonical decoder.

# `match_identity`

```elixir
@spec match_identity(String.t(), restored() | String.t()) ::
  :ok | {:error, :domain_event_identity_mismatch}
```

Requires an event identity to equal its restored record reference.

# `ref`

```elixir
@spec ref(restored()) :: String.t()
```

Returns the already-restored record reference.

---

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