digraph statemachine {
  rankdir=LR;
  node [shape=rounded, style=filled, fillcolor=white, fontname="Arial"];
  edge [fontname="Arial", fontsize=10];

  CHECK_AVAILABILITY_choice [shape=diamond, label="", fillcolor="blue", width=0.2, height=0.2];
  CHECK_AVAILABILITY -> CHECK_AVAILABILITY_choice [style=dotted, color="blue"];
  _start [shape=circle, label="", fillcolor=black, width=0.1];
  _start -> NEW;
  CANCELLED [fillcolor=lightgray];
  DELIVERED [fillcolor=lightgray];
  RETURNED [fillcolor=lightgray];
  NEW -> CHECK_AVAILABILITY [label="PLACE_ORDER", style="solid", color="black"];
  CHECK_AVAILABILITY_choice -> PENDING_PAYMENT [label="[λ] (order=0)", style="solid", color="blue"];
  CHECK_AVAILABILITY_choice -> CANCELLED [label="(order=1)", style="solid", color="blue"];
  PENDING_PAYMENT -> PAID [label="PAY_ORDER", style="solid", color="black"];
  PAID -> SHIPPED [label="SHIP_ORDER", style="solid", color="black"];
  SHIPPED -> DELIVERED [label="FINALIZE", style="solid", color="black"];
  PAID -> CANCELLED [label="CANCEL_ORDER", style="solid", color="black"];
  DELIVERED -> RETURNED [label="RETURN_ORDER", style="solid", color="black"];
}

