# `ExGAM.Mandate.Ancestry`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/mandate/ancestry.ex#L1)

Pure traversal of the current typed Mandate lineage.

The caller supplies the exact indexes derived by the governed-act fold. This
module neither decodes records nor tolerates alternate key shapes: a missing
ancestor, malformed index entry or cycle is a history error, never an
implicit revocation decision.

# `mandates`

```elixir
@type mandates() :: %{optional(String.t()) =&gt; ExGAM.Mandate.t()}
```

# `revocations`

```elixir
@type revocations() :: %{optional(String.t()) =&gt; ExGAM.Mandate.Revocation.t()}
```

# `status`

```elixir
@type status() :: :current | {:revoked, :direct | :ancestor, String.t()}
```

# `affected_by?`

```elixir
@spec affected_by?(mandates(), String.t(), String.t(), boolean()) ::
  {:ok, boolean()} | {:error, term()}
```

Checks whether an authority change affects a Mandate.

# `descendant?`

```elixir
@spec descendant?(mandates(), String.t(), String.t()) ::
  {:ok, boolean()} | {:error, term()}
```

Checks whether a Mandate is the target or descends from it.

# `directly_revoked?`

```elixir
@spec directly_revoked?(revocations(), ExGAM.Mandate.t(), integer()) ::
  {:ok, boolean()} | {:error, term()}
```

Checks only the Mandate's own revocation record, excluding ancestors.

# `lineage`

```elixir
@spec lineage(mandates(), ExGAM.Mandate.t()) ::
  {:ok, [ExGAM.Mandate.t()]} | {:error, term()}
```

Returns the Mandate and each typed ancestor in leaf-to-root order.

# `revoked?`

```elixir
@spec revoked?(mandates(), revocations(), ExGAM.Mandate.t(), integer()) ::
  {:ok, boolean()} | {:error, term()}
```

Checks direct and cascading revocation without guessing through an invalid lineage.

# `select`

```elixir
@spec select(mandates(), [String.t()]) :: mandates()
```

Selects named Mandates and their complete ancestry without unrelated branches.

Selection does not validate or repair the graph. Cycles and malformed records
remain visible to `lineage/2`; a missing parent remains missing. This prevents
a narrowed read from accidentally turning invalid ancestry into a new root.

# `status`

```elixir
@spec status(mandates(), revocations(), ExGAM.Mandate.t(), integer()) ::
  {:ok, status()} | {:error, term()}
```

Returns the exact Mandate in the lineage whose recorded revocation applies.

# `terminal?`

```elixir
@spec terminal?(mandates(), revocations(), ExGAM.Mandate.t(), integer()) ::
  {:ok, boolean()} | {:error, term()}
```

Returns whether a Mandate is expired or revoked at the supplied trusted time.

---

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