# `Spectre.GAM.Scope.Opening`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/gam/scope/opening.ex#L1)

Durable description of a Scope occurrence and any explicit promise it owns.

A Scope is still only a ledger projection: opening or copying one creates no
Mandate and no Meter allocation.  `:work` and `:vigil` openings must name a
finite due time, a decidable closing Condition, an accountable Principal and
an independent disposition path so unfinished work can be derived as Duty.

# `kind`

```elixir
@type kind() :: :session | :child | :work | :vigil
```

# `t`

```elixir
@type t() :: %Spectre.GAM.Scope.Opening{
  accountable_ref: String.t() | nil,
  authentication_ref: String.t(),
  channel_ref: String.t() | nil,
  disposition_authority_refs: [String.t()],
  domain_ref: String.t(),
  due_at: integer() | nil,
  host_generation: non_neg_integer(),
  ingress_ref: String.t(),
  kind: kind(),
  opened_at: integer(),
  opened_by_ref: String.t(),
  parent_ref: String.t() | nil,
  promise_condition: Spectre.GAM.Condition.t() | nil,
  ref: String.t(),
  schema_version: 1,
  session_ref: String.t() | nil,
  source_act_ref: String.t() | nil,
  submission_context_ref: String.t()
}
```

# `canonical`

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

Returns the plain, string-keyed ledger representation.

# `context_bindings`

```elixir
@spec context_bindings(Spectre.GAM.SubmissionContext.t()) :: map()
```

Returns the trusted opening fields forced by an authenticated context.

# `digest`

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

Returns the stable digest of the complete opening.

# `from_canonical`

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

Restores a Scope opening from canonical data.

# `from_governed_draft`

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

Materializes a canonical governed draft under its authorizing Act.

# `governed?`

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

Returns whether the opening must be authorized by a durable Act.

# `governed_draft`

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

Builds the exact Scope body frozen by a governed opening Candidate.

# `new`

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

Builds and validates a Scope opening.

# `promised?`

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

Returns whether this Scope declares a finite promise.

# `submission_context`

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

Reconstructs the exact ingress context committed by this opening.

# `validate_context`

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

Checks every trusted opening field against an authenticated context.

---

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