# `ToonEx.Btoon.Encode.Options`
[🔗](https://github.com/ohhi-vn/toon_ex/blob/v1.6.0/lib/toon_ex/btoon/encode/options.ex#L1)

Validation and normalization of BTOON encoding options.

## Options

  * `:dictionary` - a `Btoon.Dictionary` session dictionary, or `nil`.
    Strings present in the dictionary are encoded as `StringRef`.
  * `:string_table` - `:auto` (default) builds a per-message string table
    for strings absent from the session dictionary; `:off` writes full
    strings instead.
  * `:no_string_table` - `true` omits the per-message string table entirely.
    Requires `:dictionary` to be set. When enabled, all strings MUST be in
    the session dictionary or written inline. Overrides `:string_table`.
  * `:schema` - a `Btoon.Schema` to encode in schema mode, or `nil`.
  * `:schema_id_uint16` - `true` encodes the schema ID as UInt16 (2 bytes)
    instead of UInt32 (4 bytes). Requires `:schema` to be set.
  * `:typed_arrays` - `true` (default) encodes homogeneous numeric lists
    as `TypedArray` (tag `0x0C`).
  * `:object_tables` - `true` (default) encodes homogeneous object lists as
    columnar `ObjectTable` (tag `0x0D`).

# `validated`

```elixir
@type validated() :: %{
  dictionary: ToonEx.Btoon.Dictionary.t() | nil,
  string_table: :auto | :off,
  no_string_table: boolean(),
  schema: ToonEx.Btoon.Schema.t() | nil,
  schema_id_uint16: boolean(),
  typed_arrays: boolean(),
  object_tables: boolean()
}
```

Validated encoding options.

# `defaults`

```elixir
@spec defaults() :: validated()
```

Returns the default validated options.

# `validate`

```elixir
@spec validate(keyword()) :: {:ok, validated()} | {:error, String.t()}
```

Validates encoding options.

Returns `{:ok, validated}` or `{:error, message}`.

# `validate!`

```elixir
@spec validate!(keyword()) :: validated()
```

Validates encoding options, raising `ArgumentError` on error.

---

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