% ------------------------------------------------------------------------------
% Copyright (c) 2019, 2025 Contributors to the Eclipse Foundation
%
% See the NOTICE file(s) distributed with this work for additional
% information regarding copyright ownership.
%
% This program and the accompanying materials are made available under the terms
% of the MIT License which is available at https://opensource.org/licenses/MIT
%
% SPDX-License-Identifier: MIT
% ------------------------------------------------------------------------------
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, arrows, automata, positioning, shapes, shapes.misc}
\usepackage[paperwidth=40in, paperheight=20in]{geometry}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[
    auto,
    ->,
    node distance=4cm,
    every state/.style={ellipse, semithick, fill=black!5, minimum size=2cm, font=\Large},
    initial distance=1.2cm,
    every initial by arrow/.style={-{Stealth[scale=1.4]}},
    initial text=,
    transform shape,
    double distance=2pt,
    every loop/.style={min distance=10mm}
]

\node[state, initial, accepting] (A) {\emph{$0$, Off}};
\node[state, right of=A] (B) {\emph{$1$, Off}};
\node[state, right of=B] (C) {\emph{$2$, Off}};
\node[state, right of=C] (D) {\emph{$3$, Off}};
\node[state, right of=D] (E) {\emph{$4$, Off}};
\node[state, above of=A] (F) {\emph{$0$, On}};
\node[state, above of=C] (G) {\emph{$2$, On}};
\node[state, above of=E] (H) {\emph{$4$, On}};

\path[-{Stealth[scale=1.4]}]
    (A) edge[bend left, above] node[align=center] {\texttt{increment}} (B)
    (B) edge[bend left, below] node[align=center] {\texttt{decrement}} (A)
    (B) edge[bend left, above] node[align=center] {\texttt{increment}} (C)
    (C) edge[bend left, below] node[align=center] {\texttt{decrement}} (B)
    (C) edge[bend left, above] node[align=center] {\texttt{increment}} (D)
    (D) edge[bend left, below] node[align=center] {\texttt{decrement}} (C)
    (D) edge[bend left, above] node[align=center] {\texttt{increment}} (E)
    (E) edge[bend left, below] node[align=center] {\texttt{decrement}} (D)
    (A) edge[bend left, left] node[align=center] {\texttt{turn\_on}} (F)
    (F) edge[bend left, right] node[align=center] {\texttt{turn\_off}} (A)
    (C) edge[bend left, left] node[align=center] {\texttt{turn\_on}} (G)
    (G) edge[bend left, right] node[align=center] {\texttt{turn\_off}} (C)
    (E) edge[bend left, left] node[align=center] {\texttt{turn\_on}} (H)
    (H) edge[bend left, right] node[align=center] {\texttt{turn\_off}} (E)
;

\end{tikzpicture}
\end{document}
