Use safer string to enum functions to avoid static_cast.