Preparing your design workspace

Loading the problem and your saved attempt…

Design and Implement Movie Seat Reservations

Model a customer journey that holds seats for a scheduled show and safely turns a valid hold into a booking.

For this exercise, assume an in-memory cinema has scheduled shows and a fixed set of seats for each show. A customer views availability, holds a non-empty set of distinct known seats until a supplied future expiry, and confirms or cancels that hold. For one show, a seat has at most one active hold or confirmed booking.

Holding a selection is atomic: if any seat is unavailable, none of the selection is held. A hold is expired when expiresAt <= now. Expired or cancelled holds release only seats still owned by that hold; confirmed seats stay booked. Each operation uses one observation of an injected clock.

Confirmation atomically checks a valid active hold, obtains a definitive success or failure from an injected payment collaborator, and either creates one stable booking or leaves the hold active until its original expiry.

Repeating confirmation for an already confirmed hold returns that same booking without another payment call. The payment collaborator returns synchronously and immediately without advancing time, throwing, calling back into the system, or producing an ambiguous outcome.

The chosen state owner must prevent confirmation from interleaving with cancellation or expiry for the same hold. Design the objects, contracts and interactions, then implement seat holding.

External payment integration, crashes, durable recovery, refunds, pricing, authentication and distributed persistence are outside scope.