Fix Enum so that they can be used for json parsing

Added apply() and unapply() methods.