following the GoF State pattern: https://en.wikipedia.org/wiki/State_pattern
Based on triggers and rules (a rule is map whose key is a State and values are an array of pairs of Trigger and State)
Based on Go switch statement
This version allows the execution of events with a context (ie a struct containing some data to pass to the next State)