The simplest FSM โ two states, one event. The machine owns the transition logic:
state off on TOGGLE โ on, and vice versa.
Actions attached to transitions update the context (toggle count) as a pure function.
No if/else, no scattered mutation.