How to use map in this situation instead of switch i want this to be mapping instead of hard coding the cases