I have a REST API that returns a json document, one field is numeric, mode. The values of the mode field are limited 0-3, they represent different states. To me this looks like an enum from other languages. What is the recommend way to represent this data in enum? I was thinking a Union type would be best, but then I was thinking about how to decode that and thought maybe there is a better way.
This is what I was thinking of doing.
type Mode = OFF | HEAT | COOL | AUTO