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

Defines observed fields, wire names and graph relations.

The table is a semantic overlay on tmux 3.3 format variables. It drives
observation validation, portable filtering and reference generation. Empty text
remains text; only explicitly nullable fields admit `nil`.

# `entity`

```elixir
@type entity() :: :session | :window | :window_link | :pane | :client
```

An entity's canonical local name. Physical windows and membership links are distinct.

# `entity_module`

```elixir
@type entity_module() ::
  LibTmux.Session
  | LibTmux.Window
  | LibTmux.WindowLink
  | LibTmux.Pane
  | LibTmux.Client
```

The observation struct modules accepted alongside canonical entity names.

# `entity_selector`

```elixir
@type entity_selector() :: entity() | entity_module()
```

A canonical entity atom or its corresponding observation module.

# `field`

```elixir
@type field() :: %{
  name: atom(),
  wire: String.t(),
  format: String.t() | nil,
  type: value_type(),
  since: String.t(),
  nullable: boolean()
}
```

Field metadata shared by validation and documentation; nil format identifies a derived field.

# `observation`

```elixir
@type observation() ::
  LibTmux.Session.t()
  | LibTmux.Window.t()
  | LibTmux.WindowLink.t()
  | LibTmux.Pane.t()
  | LibTmux.Client.t()
```

One physical or contextual observation from a captured graph.

# `observed`

```elixir
@type observed(value) :: value | :unloaded | :unavailable
```

A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type.

# `operator`

```elixir
@type operator() ::
  :equals
  | :not
  | :in
  | :not_in
  | :lt
  | :lte
  | :gt
  | :gte
  | :contains
  | :starts_with
  | :ends_with
```

A scalar filter operator; each field category permits only its applicable subset.

# `relation`

```elixir
@type relation() :: {:one | :many, entity()}
```

The cardinality and target entity of one indexed graph relation.

# `value_type`

```elixir
@type value_type() ::
  :string | :integer | :nullable_integer | :boolean | {:id, entity()}
```

A field's validation category; integer fields use the schema's nonnegative 32-bit range.

# `entities`

```elixir
@spec entities() :: [entity()]
```

Returns supported entity names in a stable order.

# `entity`

```elixir
@spec entity(entity_selector()) :: entity()
```

Resolves an entity atom or its observation module.

# `field`

```elixir
@spec field(entity_selector(), atom()) :: field() | nil
```

Returns field metadata, or nil for a field outside the schema.

# `fields`

```elixir
@spec fields(entity_selector()) :: %{required(atom()) =&gt; field()}
```

Returns the whitelisted field metadata for an entity.

# `module`

```elixir
@spec module(entity()) :: entity_module()
```

Returns the ordinary observation struct module for an entity.

# `operators`

```elixir
@spec operators(field()) :: [operator()]
```

Returns the portable operators allowed by a scalar field's value category.

# `relation_wire`

```elixir
@spec relation_wire(atom()) :: String.t()
```

Returns a relation's explicit stable wire name.

# `relations`

```elixir
@spec relations(entity_selector()) :: %{required(atom()) =&gt; relation()}
```

Returns each relation's cardinality and target entity.

---

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