# `Spectre.GAM.Duty.Derive.Facts`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/duty/derive/facts.ex#L1)

Read-only input prepared for pure Duty derivation.

Governed records stay as their decoded structs. Ledger position and
acquisition time stay in `Spectre.GAM.Domain.Event.Metadata`, where replay put
them. This avoids manufacturing a second, map-shaped representation of an
Act, Evidence or Outcome merely to attach metadata.

Each governed collection keeps the projection's single keyed representation;
derivation traverses those maps directly instead of allocating parallel lists
or retaining derived indexes beside their source. This view is disposable and
carries no authority: the append-only ledger remains the source of truth and
`Spectre.GAM.GovernedAct.State` remains the complete replay projection.

# `t`

```elixir
@type t() :: %Spectre.GAM.Duty.Derive.Facts{
  acts: %{optional(String.t()) =&gt; Spectre.GAM.Act.t()},
  attempts: %{optional(String.t()) =&gt; Spectre.GAM.Attempt.t()},
  availability: {non_neg_integer(), MapSet.t(String.t())} | nil,
  duties: %{optional(term()) =&gt; Spectre.GAM.Duty.t()},
  erasures: %{optional(String.t()) =&gt; Spectre.GAM.Erasure.t()},
  event_metadata: %{
    optional(String.t()) =&gt; Spectre.GAM.Domain.Event.Metadata.t()
  },
  evidence: %{optional(String.t()) =&gt; Spectre.GAM.Evidence.t()},
  mandates: %{optional(String.t()) =&gt; Spectre.GAM.Mandate.t()},
  outcomes: %{optional(String.t()) =&gt; Spectre.GAM.Outcome.t()},
  presentations: %{optional(String.t()) =&gt; Spectre.GAM.Presentation.t()},
  scopes: %{optional(String.t()) =&gt; Spectre.GAM.Scope.Opening.t()},
  sources: %{optional(atom()) =&gt; [term()]}
}
```

# `available_at?`

```elixir
@spec available_at?(t(), String.t(), integer()) :: boolean()
```

Returns whether a fact was durably available at the given trusted time.

# `available_evidence`

```elixir
@spec available_evidence(t(), integer()) :: [Spectre.GAM.Evidence.t()]
```

Returns Evidence durably present and not erased at trusted `time`.

# `evidence_through`

```elixir
@spec evidence_through(t(), non_neg_integer()) :: [Spectre.GAM.Evidence.t()]
```

Returns Evidence durably known in the ledger prefix ending at `revision`.

# `from_state`

```elixir
@spec from_state(Spectre.GAM.GovernedAct.State.t()) :: t()
```

Builds the minimal indexed view used by the Duty algebra.

# `later_evidence`

```elixir
@spec later_evidence(t(), Spectre.GAM.Evidence.t(), non_neg_integer(), integer()) ::
  {:ok, Spectre.GAM.Domain.Event.Metadata.t()} | :error
```

Returns metadata when Evidence was recorded after a revision and no later than `time`.

# `metadata`

```elixir
@spec metadata(t(), String.t()) ::
  {:ok, Spectre.GAM.Domain.Event.Metadata.t()}
  | {:error, :missing_event_metadata}
```

Looks up trusted ledger metadata for a typed record identity.

# `recorded_through?`

```elixir
@spec recorded_through?(t(), String.t(), non_neg_integer()) :: boolean()
```

Returns whether a fact was durably known at the given ledger revision.

# `records_through`

```elixir
@spec records_through(t(), Enumerable.t(), non_neg_integer()) :: [struct()]
```

Filters typed records to the ledger prefix ending at `revision`.

---

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