Design an Intersection Traffic-Light Controller
Model signal phases, safety transitions, manual override, pedestrian push-button requests, recovery, and expansion beyond two directions.
For this exercise, assume an intersection traffic-light controller used by traffic operators and the automatic timer.
The core journey is to let a technician configure positive green and yellow durations, then cycle east-west and north-south signals through green and yellow with a one-second all-red clearance, then safely enter and leave manual override.
The following practice constraints complete the reported seed: opposing directions share a movement group; only one movement group may be green or yellow; override requests take effect through an all-red safety transition; advance requires a positive tick count, and each tick emits the current snapshot before decrementing and possibly transitioning; a new plan activates only at an all-red boundary; a configuration accepted while an override transition is pending stays staged until override release and never cancels that transition; each movement group's crosswalk has a pedestrian push button, and the pedestrian follow-up defines how a press is served; vehicle-sensor optimization and hardware protocols are outside scope.
Design the object model, responsibilities, focused contracts, state transitions, and important errors. Protect this invariant: no conflicting movement groups are green or yellow together and every ownership change crosses all-red.
Explain how the design reports invalid phase plan, unknown movement group, stale timer event, and conflicting override. After the design, implement the bounded core behavior requested in the implementation checkpoint.