Design an Elevator Control System
Model elevator cars, hall and cabin requests, dispatch assignment, movement state, and safe fault handling.
For this exercise, assume that a rider requests service from a floor, a controller assigns an eligible car, and the car completes pickup and destination stops safely.
The design must support submit a hall request with direction; submit a cabin destination; assign and reorder stops; take a car out of service and reassign pending requests. Preserve this invariant: a car never moves with doors open, serves only valid floors, and one request has at most one active assignment.
Treat invalid floor, duplicate request, unavailable car, obstructed door, stalled car, and reassignment after fault as explicit outcomes. Keep unrelated product features, infrastructure, and persistence implementation outside the first version unless a checkpoint asks for them.