# `Flicker.FacetEditor.Switch`
[🔗](https://github.com/team-alembic/flicker/blob/v0.1.0/lib/flicker/facet_editor/switch.ex#L1)

The boolean editor ([Spec 019](https://github.com/team-alembic/flicker/blob/main/docs/specs/spec-019-facet-editors.md)) —
and the one editor with no pop-out.

A flick is a complete value, so there is nothing for a modal surface to
protect: it commits on toggle, inline
([ADR-011](https://github.com/team-alembic/flicker/blob/main/docs/adrs/adr-011-facet-editors-are-modal-subcontexts.md)).
Atomic commit still applies — this is the degenerate case where "atomic" and
"one interaction" coincide.

"Filtered false" and "not filtered at all" stay distinct: the switch expresses
the first, and the pill's remove control the second. That is why there is no
third position here.

# `complete?`

```elixir
@spec complete?(term(), Flicker.Facet.t()) :: boolean()
```

Any boolean is complete; `nil` (nothing chosen yet) is not.

## Examples

    iex> Flicker.FacetEditor.Switch.complete?(false, %Flicker.Facet{key: :v})
    true

    iex> Flicker.FacetEditor.Switch.complete?(nil, %Flicker.Facet{key: :v})
    false

# `parse`

```elixir
@spec parse(String.t(), Flicker.Facet.t()) :: {:ok, boolean()} | :error
```

Parses either literal, case-insensitively — matching the parser rather than
being stricter than it.

## Examples

    iex> Flicker.FacetEditor.Switch.parse("TRUE", %Flicker.Facet{key: :verified?})
    {:ok, true}

    iex> Flicker.FacetEditor.Switch.parse("maybe", %Flicker.Facet{key: :verified?})
    :error

# `serialise`

```elixir
@spec serialise(boolean(), Flicker.Facet.t()) :: String.t()
```

`"true"` or `"false"` — the same literals the grammar accepts.

## Examples

    iex> Flicker.FacetEditor.Switch.serialise(true, %Flicker.Facet{key: :verified?})
    "true"

---

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