# `ExGAM.Consequence.Validator`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/consequence/validator.ex#L1)

Closed registry of pure, portable consequence validators.

A `ExGAM.Surface` records one validator identifier for every declared
consequence class.  The identifier, rather than a module or callback, is
durable data: admission and an independent auditor can therefore replay the
same rule without executing application code from the ledger.

Ordinary application classes use `none/0`; their complete material shape is
still enforced by `ExGAM.Consequence.Contract`.  Validators in this module
exist only for core transitions whose validity depends on the current
projection or trusted time. Their immutable class binding comes from
`ExGAM.GovernedAct.Class`, not from a callback named in ledger data.

# `id`

```elixir
@type id() :: String.t()
```

# `default_for_class`

```elixir
@spec default_for_class(String.t()) :: id()
```

Returns the built-in default recorded for a class by a new Surface.

# `none`

```elixir
@spec none() :: id()
```

Identifier for classes whose contract needs no projection-dependent rule.

# `validate`

```elixir
@spec validate(id(), ExGAM.Candidate.t(), map(), integer()) :: :ok | {:error, term()}
```

Applies the validator selected by the active Surface.

# `validate_binding`

```elixir
@spec validate_binding(String.t(), term()) :: :ok | {:error, term()}
```

Validates the immutable class-to-validator binding recorded by a Surface.

# `validate_id`

```elixir
@spec validate_id(term()) :: :ok | {:error, term()}
```

Validates that an identifier names a deterministic built-in rule.

# `validate_transition`

```elixir
@spec validate_transition(
  id(),
  ExGAM.Candidate.t(),
  ExGAM.Decision.t(),
  ExGAM.Act.t(),
  ExGAM.GovernedAct.State.t()
) :: :ok | {:error, term()}
```

Checks an admitted intrinsic transition against a provisional projection.

---

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