# `Spectre.GAM.Surface`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/surface.ex#L1)

Versioned declaration of the consequence classes governed by a domain.

Classification is a lookup, not an authority decision.  Missing classes are
reported as `:unknown_class`; callers must never turn that result into an
executable empty row. Application classes remain open and contract-driven;
`Spectre.GAM.GovernedAct.Class` fixes metadata only for the small set of runtime
transitions whose semantics must replay identically everywhere.

# `class`

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

# `definition_report`

```elixir
@type definition_report() :: %{
  definition_ref: String.t(),
  surface_ref: String.t(),
  templates: %{required(String.t()) =&gt; template_check()}
}
```

Authoring report pinned to the two immutable declarations; never an admission.

# `t`

```elixir
@type t() :: %Spectre.GAM.Surface{
  consequence_contracts: %{
    optional(class()) =&gt; Spectre.GAM.Consequence.Contract.t()
  },
  consequence_validators: %{
    optional(class()) =&gt; Spectre.GAM.Consequence.Validator.id()
  },
  declarations: %{required(class()) =&gt; Spectre.GAM.Row.t()},
  fallbacks: %{optional(class()) =&gt; Spectre.GAM.Fallback.Policy.t()},
  presentation_required_classes: [class()],
  ref: String.t(),
  revision: pos_integer(),
  schema_version: 1
}
```

# `template_check`

```elixir
@type template_check() :: %{checked: [atom()], deferred: [atom()], errors: [term()]}
```

Static fields submitted to checks, fields still deferred, and detected errors.

# `canonical`

```elixir
@spec canonical(t()) :: map()
```

Returns the plain, string-keyed ledger representation.

# `classify`

```elixir
@spec classify(t(), class()) :: {:ok, Spectre.GAM.Row.t()} | {:error, :unknown_class}
```

Looks up the declared row for a class.

# `content_ref`

```elixir
@spec content_ref(t()) :: String.t()
```

Returns the content-derived reference, independent of an assigned `ref`.

# `digest`

```elixir
@spec digest(t()) :: String.t()
```

Returns the stable digest of the complete surface.

# `fallback`

```elixir
@spec fallback(t(), class()) ::
  {:ok, Spectre.GAM.Fallback.Policy.t()} | {:error, :unknown_class}
```

Returns the declared refusal policy, defaulting to explicit silence.

# `from_canonical`

```elixir
@spec from_canonical(map()) :: {:ok, t()} | {:error, term()}
```

Restores a surface from its canonical map.

# `new`

```elixir
@spec new(map() | keyword() | t()) :: {:ok, t()} | {:error, term()}
```

Builds and validates a governed surface.

# `presentation_required?`

```elixir
@spec presentation_required?(t(), class()) :: boolean()
```

Returns whether the declared class requires materially bound consent.

# `validate_consequence`

```elixir
@spec validate_consequence(t(), Spectre.GAM.Candidate.t()) :: :ok | {:error, term()}
```

Validates one Candidate against the class's closed consequence contract.

# `validate_facts`

```elixir
@spec validate_facts(t(), Spectre.GAM.Candidate.t(), map(), integer()) ::
  :ok | {:error, term()}
```

Validates projection- and time-dependent facts through the active Surface table.

# `validate_transition`

```elixir
@spec validate_transition(
  t(),
  Spectre.GAM.Candidate.t(),
  Spectre.GAM.Decision.t(),
  Spectre.GAM.Act.t(),
  map()
) :: :ok | {:error, term()}
```

Validates an admitted intrinsic transition before it can enter a Domain batch.

# `verify_definition`

```elixir
@spec verify_definition(t(), Spectre.GAM.Definition.t()) ::
  {:ok, definition_report()} | {:error, term()}
```

Reports that checking executable authoring requires an explicit diagnostic
adapter. The extracted kernel does not depend on an Agent DSL grammar.

Use `verify_definition/3` with the verifier for the application's authoring
format. This static diagnostic never admits a Candidate, proves consent,
activates a Definition, or checks live authority and available resources.

# `verify_definition`

```elixir
@spec verify_definition(t(), Spectre.GAM.Definition.t(), module()) ::
  {:ok, definition_report()} | {:error, term()}
```

Checks an authoring Definition through an explicit diagnostic adapter.

The verifier implements `Spectre.GAM.Definition.Verifier` and receives validated
immutable records. Reports should pin both refs and distinguish checked,
deferred and invalid template fields. Missing occurrence facts stay deferred;
they must not be invented to make a static check pass. Admission and replay
never call this adapter and never treat its report as authority.

---

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