Use the enum like an enum

Enums are first-class objects, meant to replace these ugly if
statements. Use them like that!