Write a parser that converts machine codes (e.g. 123) into corresponding typed objects via an enum (TYPE1, TYPE2, TYPE3...).
Asked in the phone screen stage. The main prompt was points-walled; only the clarifying example was visible.
Implement parse_machine_codes(codes). codes is a list of integers. Code 123 maps to TYPE1, 456 maps to TYPE2, and 789 maps to TYPE3. Unknown codes map to UNKNOWN. Return a list of objects represented as dictionaries with code and type fields, preserving input order.
def parse_machine_codes(codes):