# `LibTmux.Snapshot`
[🔗](https://github.com/libtmux/libtmux-elixir/blob/b72452c198917433229bdc266a68c163541b6127/lib/libtmux/snapshot.ex#L1)

An indexed immutable graph observed over a capture interval.

Construction and traversal perform no I/O. `fields` declares loaded fields
over the supplied entity IDs; `complete` declares complete server entity
sets. Missing declarations remain unloaded, including on empty sets.
Unavailable capabilities use a separate declaration. Relations require
complete join domains. A snapshot reserves no tmux objects.

# `coverage`

```elixir
@type coverage() :: %{
  entities: %{required(LibTmux.Schema.entity()) =&gt; entity_coverage()}
}
```

Declared entity sets and field availability; completeness is separate from an empty captured set.

# `entity_coverage`

```elixir
@type entity_coverage() :: %{
  ids: MapSet.t(LibTmux.Ref.id()),
  complete: boolean(),
  fields: %{optional(atom()) =&gt; :loaded | :unavailable}
}
```

Coverage of one captured entity domain; missing field entries are unloaded.

# `option`

```elixir
@type option() ::
  {:server_instance, String.t()}
  | {:captured_from, integer()}
  | {:captured_until, integer()}
  | {:fields, %{optional(LibTmux.Schema.entity()) =&gt; [atom()]}}
  | {:complete, [LibTmux.Schema.entity()]}
  | {:unavailable, %{optional(LibTmux.Schema.entity()) =&gt; [atom()]}}
```

Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations.

# `rows`

```elixir
@type rows() :: %{
  optional(LibTmux.Schema.entity()) =&gt; [map() | LibTmux.Schema.observation()]
}
```

Observed rows grouped by canonical entity; construction validates and deduplicates their identities.

# `t`

```elixir
@type t() :: %LibTmux.Snapshot{
  captured_from: integer(),
  captured_until: integer(),
  clients: %{optional(String.t()) =&gt; LibTmux.Client.t()},
  coverage: coverage(),
  id: pos_integer(),
  indexes: indexes(),
  order: %{required(LibTmux.Schema.entity()) =&gt; [LibTmux.Ref.id()]},
  panes: %{optional(String.t()) =&gt; LibTmux.Pane.t()},
  schema_version: 1,
  server_instance: String.t(),
  sessions: %{optional(String.t()) =&gt; LibTmux.Session.t()},
  window_links: %{optional(LibTmux.Ref.id()) =&gt; LibTmux.WindowLink.t()},
  windows: %{optional(String.t()) =&gt; LibTmux.Window.t()}
}
```

An immutable observation interval with indexed entities and explicit coverage.

# `clients`

```elixir
@spec clients(t()) :: LibTmux.Selection.t(LibTmux.Client.t())
```

Returns a materialized attached-client selection without I/O.

# `fetch`

```elixir
@spec fetch(t(), LibTmux.Schema.entity_selector(), LibTmux.Ref.id()) ::
  {:ok, LibTmux.Schema.observation()} | {:error, LibTmux.Error.t()}
```

Looks up one exact observed ID without I/O.

# `items`

```elixir
@spec items(t(), LibTmux.Schema.entity_selector()) :: [LibTmux.Schema.observation()]
```

Returns plain observed items in stable identity order without loading data.

# `new`

```elixir
@spec new(rows(), [option()]) :: {:ok, t()} | {:error, LibTmux.Error.t()}
```

Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.

# `panes`

```elixir
@spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())
```

Returns a materialized physical pane selection without I/O.

# `related`

```elixir
@spec related(t(), LibTmux.Schema.entity_selector(), LibTmux.Ref.id(), atom()) ::
  LibTmux.Schema.observation() | nil | [LibTmux.Schema.observation()]
```

Resolves a covered relation through captured indexes; never refreshes.

# `require_complete!`

```elixir
@spec require_complete!(t(), LibTmux.Schema.entity_selector()) :: :ok
```

Requires a declared complete entity set, even when it has no rows.

# `require_field!`

```elixir
@spec require_field!(t(), LibTmux.Schema.entity_selector(), atom()) :: :ok
```

Requires a loaded field over the captured entity domain before evaluation.

# `require_relation!`

```elixir
@spec require_relation!(
  t(),
  LibTmux.Schema.entity_selector(),
  atom(),
  :all | [LibTmux.Ref.id()]
) :: :ok
```

Requires a complete relation domain, including known-empty domains.

# `sessions`

```elixir
@spec sessions(t()) :: LibTmux.Selection.t(LibTmux.Session.t())
```

Returns a materialized session selection without I/O.

# `window_links`

```elixir
@spec window_links(t()) :: LibTmux.Selection.t(LibTmux.WindowLink.t())
```

Returns a materialized membership selection without I/O.

# `windows`

```elixir
@spec windows(t()) :: LibTmux.Selection.t(LibTmux.Window.t())
```

Returns a materialized physical window selection without I/O.

---

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