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

Immutable material prepared for a later, governed consent request.

A Presentation records what may be shown; recording it does not claim that
anybody saw it. Delivery is the closed `presentation.show` consequence and
must cross the normal Candidate -> Act -> Attempt -> Outcome boundary.

`candidate_binding_ref` addresses the final Candidate's acyclic pre-consent
material. The final Candidate may therefore add this Presentation and the
later approval Evidence without creating a reference cycle.

Approval is observed Evidence for the exact Presentation and the exact
successful show Act. Its source must be one of `approval_source_refs`, and
its authenticated issuer must be one of the declared recipients.

# `t`

```elixir
@type t() :: %Spectre.GAM.Presentation{
  alternatives: [term()],
  approval_source_refs: [String.t()],
  candidate_binding_ref: String.t(),
  cost: term(),
  data: term(),
  disclosure: Spectre.GAM.Disclosure.t(),
  material_digest: String.t(),
  prepared_at: integer(),
  purpose_params: map(),
  purpose_ref: String.t(),
  recipient_refs: [String.t()],
  ref: String.t(),
  rendered_payload: term(),
  rendered_payload_ref: String.t() | nil,
  renderer_ref: String.t(),
  reversibility: term(),
  risk: term(),
  schema_version: 1,
  scope_ref: String.t()
}
```

# `approval_proposition`

```elixir
@spec approval_proposition(String.t(), String.t()) :: map()
```

Returns the closed proposition approving one successful show Act.

# `approval_refs`

```elixir
@spec approval_refs(Spectre.GAM.Evidence.t()) ::
  :not_approval | {:ok, String.t(), String.t()} | {:error, term()}
```

Classifies a reserved approval proposition and rejects non-canonical variants.

# `canonical`

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

Returns the plain, string-keyed ledger representation.

# `consent_material`

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

Recalculates the closed consent material represented by this Presentation.

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

# `from_canonical`

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

Restores a presentation from its canonical map.

# `material`

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

Returns the fields whose exact value is material to consent.

# `new`

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

Builds and validates prepared consent material.

# `response_evidence`

```elixir
@spec response_evidence(
  Spectre.GAM.SubmissionContext.t(),
  t(),
  Spectre.GAM.Act.t(),
  Spectre.GAM.Evidence.stance(),
  integer(),
  map() | keyword()
) :: {:ok, Spectre.GAM.Evidence.t()} | {:error, term()}
```

Builds an authenticated supporting or contradicting response to one exact show Act.

# `show_class`

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

Returns the one reserved class used to show prepared material.

# `show_consequence`

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

Returns the exact executor-facing consequence for this Presentation.

# `show_dimensions`

```elixir
@spec show_dimensions() :: [Spectre.GAM.Row.dimension()]
```

Returns the exact Row dimensions of `presentation.show`.

# `show_presentation_ref`

```elixir
@spec show_presentation_ref(term()) :: {:ok, String.t()} | {:error, term()}
```

Extracts a Presentation ref only from the closed show consequence.

# `show_row`

```elixir
@spec show_row() :: Spectre.GAM.Row.t()
```

Returns the exact Row of `presentation.show`.

# `validate_approval`

```elixir
@spec validate_approval(
  Spectre.GAM.Evidence.t(),
  t(),
  map(),
  [Spectre.GAM.Outcome.t()],
  [Spectre.GAM.Evidence.t()],
  integer()
) :: :ok | {:error, term()}
```

Validates one approval against its prepared material and successful show.

# `validate_approval_with_basis`

```elixir
@spec validate_approval_with_basis(
  Spectre.GAM.Evidence.t(),
  t(),
  map(),
  [Spectre.GAM.Outcome.t()],
  [Spectre.GAM.Evidence.t()],
  integer()
) :: {:ok, [String.t()]} | {:error, term()}
```

Validates an approval and returns its exact Evidence basis.

# `validate_candidate`

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

Validates every consent field against one current Candidate-like record.

# `validate_response_with_basis`

```elixir
@spec validate_response_with_basis(
  Spectre.GAM.Evidence.t(),
  t(),
  map(),
  [Spectre.GAM.Outcome.t()],
  [Spectre.GAM.Evidence.t()],
  integer()
) :: {:ok, [String.t()]} | {:error, term()}
```

Validates either a supporting approval or a contradicting response with its basis.

# `validate_show`

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

Validates the closed show semantics shared by a Candidate and its Act.

---

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