// SPDX-License-Identifier: Apache-2.0
// Copyright 2022 Stéphane Caron
// Copyright 2024 Inria

digraph spine_state_machine {
    bgcolor="transparent"
    rankdir="LR";

    node [shape=point, label=""] initial, terminal;
    node [shape=square];

    kSendStops[label="stop"];
    kReset[label="reset"];
    kIdle[label="idle"];
    kStep[label="step"];
    kShutdown[label="shutdown"];

    initial->kSendStops[label="BEGIN"];
    kSendStops->kReset[label=<BEGIN <font color="blue">[req=start, stop_cycles≥5]</font><br/><font color="red">read(config)</font>>];
    kSendStops->kSendStops[label=<BEGIN <font color="blue">[req!=reset]</font>>];
    kSendStops->kSendStops[label="END"];
    kSendStops->kShutdown[label="SIGINT", style=dashed];
    kReset->kIdle[label=<END <br/><font color="red">write(obs)</font>>];
    kIdle->kStep[label=<BEGIN <font color="blue">[req=act]</font><br/><font color="red">read(action)</font>>];
    kIdle->kSendStops[label="BEGIN [req=stop]"];
    kIdle->kShutdown[label="SIGINT", style=dashed];
    kStep->kIdle[label=<END <br/><font color="red">write(obs)</font>>];
    kStep->kShutdown[label="SIGINT", style=dashed];
    kShutdown->terminal[label=<END <font color="blue">[stop_cycles≥5]</font>>];
}
