feat(types/formula): use enum class instead of enum

 - use enum type as it is, instead of unsigned/int.
 - support basic pattern matching, no need to have "unreachable" after
   switch case.