encode and decode for enums.
Going to generate code and support multiclocked schemes.