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

Durable result of evaluating a candidate at one authority revision.

The four outcomes are intentionally disjoint.  Only `:admitted` may be paired
with an Act; refusal, inability to decide and an unknown surface class must
never be collapsed into one generic error. `recognition_refs` identifies the
evaluated Conditions; `recognition_evidence_refs` separately freezes the
Evidence basis that actually reached the Recognition stage.

# `outcome`

```elixir
@type outcome() :: :admitted | :refused | :undecidable | :unknown_class
```

# `t`

```elixir
@type t() :: %Spectre.GAM.Decision{
  accountable_ref: String.t() | nil,
  authenticated_principal_ref: String.t(),
  authentication_ref: String.t(),
  authority_revision: non_neg_integer(),
  authorizer_ref: String.t() | nil,
  candidate_class: String.t(),
  candidate_digest: String.t(),
  candidate_identity_key: String.t(),
  channel_ref: String.t() | nil,
  consent: Spectre.GAM.Consent.t() | nil,
  decided_at: integer(),
  domain_ref: String.t(),
  executor_ref: String.t() | nil,
  host_generation: non_neg_integer(),
  host_profile_ref: String.t(),
  ingress_ref: String.t(),
  mandate_ref: String.t() | nil,
  mandate_revision: pos_integer() | nil,
  outcome: outcome(),
  proposer_ref: String.t(),
  reasons: [term()],
  recognition_evidence_refs: [String.t()],
  recognition_refs: [String.t()],
  ref: String.t(),
  reservations: Spectre.GAM.Kernel.Meter.Amounts.t(),
  schema_version: 1,
  scope_ref: String.t(),
  session_ref: String.t() | nil,
  submission_context_ref: String.t(),
  surface_revision: non_neg_integer()
}
```

# `admitted?`

```elixir
@spec admitted?(t()) :: boolean()
```

Returns true only for the sole outcome that can produce an Act.

# `canonical`

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

Returns the plain, string-keyed ledger representation.

# `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 decision.

# `from_canonical`

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

Restores a decision from its canonical map.

# `new`

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

Builds and validates a durable decision.

# `reservations?`

```elixir
@spec reservations?(t()) :: boolean()
```

Returns whether Admission planned any Meter reservation.

---

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