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

Portable evidence requirement attached to a mandate.

Conditions describe what Recognition must establish.  They never select a
mandate and never produce authority or a grant. Atom keys in opaque
application maps are converted recursively to strings at construction, so
attenuation and content identity never depend on which key spelling crossed
the boundary; colliding atom/string keys are rejected.

# `t`

```elixir
@type t() :: %Spectre.GAM.Condition{
  accepted_provenance: [:observed | :derived | :generated],
  allow_provisional: boolean(),
  bindings: map(),
  cardinality: %{required(String.t()) =&gt; non_neg_integer() | nil},
  coverage: term(),
  freshness_ms: non_neg_integer() | nil,
  parameters: map(),
  proposition: term(),
  ref: String.t(),
  schema_version: 1
}
```

# `attenuates?`

```elixir
@spec attenuates?(t() | map() | keyword(), t() | map() | keyword()) :: boolean()
```

Returns whether `child` is a valid attenuation of `parent`.

# `attenuation`

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

Checks that `child` is the same requirement as, or a stricter requirement
than, `parent`.

The comparison is deliberately structural and closed. It permits stronger
coverage/bindings, a narrower provenance set, tighter cardinality and
freshness, and rejecting provisional Evidence. Proposition and opaque
domain-specific parameters must remain byte-for-byte equivalent because the
core cannot safely infer a restriction relation for their vocabulary.
References are identifiers and are therefore not used as proof of semantic
equivalence.

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

# `from_canonical`

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

Restores a condition from its canonical map.

# `new`

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

Builds and validates an evidence condition.

---

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