Problem statement
Design the object model and public APIs for the seat-map core a carrier uses during booking, where a passenger views a cabin's seat layout, temporarily holds a seat while they pay, and either confirms it or lets the hold expire back to available.
Operating context. A flight has a seat map: rows and columns across cabins (economy, premium, business), each seat with attributes (window / aisle / middle, extra-legroom, exit-row eligibility, fare surcharge). A passenger selects a seat, which is held for a short TTL while checkout completes; a confirmed hold becomes booked, and an expired hold reverts to available automatically. Held and booked seats are never offered to another passenger. Many passengers browse and hold concurrently. Single flight instance, in-process, one wall clock.
Out of scope. The fare / ticketing engine, payment capture, the REST surface, aircraft-swap re-accommodation, and persistence (assume in-memory for v1).
What to produce. The class hierarchy (SeatMap, Seat, Cabin, Hold, seat service), each class's public API, and the seat state machine (available → held → booked, with held → available on expiry). Be explicit about: how a hold's TTL expiry is modeled without a busy-wait per seat, how concurrent holds on the same seat resolve to one holder, and how seat-eligibility rules (exit-row limits, surcharge tiers) are pluggable.
Requirements
The requirements come with Premium
PremiumThe statement above is free to read.