Design a Movie Ticket Booking System
Model a customer journey that holds seats for a scheduled show and safely turns a valid hold into a booking.
For this exercise, assume customers browse movies and scheduled shows at venues, inspect the seats for one show, place a short-lived hold on selected seats, and either confirm or cancel the booking.
A seat within one show may belong to at most one active hold or confirmed booking, and concurrent hold attempts for overlapping seats must resolve atomically so at most one succeeds. Expired or cancelled holds release their seats.
Confirmation uses an injected payment collaborator; a repeated confirmation request must not create a second charge or booking, and a payment failure leaves the hold active only until its original expiry. For this exercise, also assume a hold lasts ten minutes, a configured duration.
One customer may have at most four seats across all of their active holds; confirmed, expired, and cancelled holds do not count, and a hold request that would go over the limit is rejected whole. Buying means confirming the customer's own existing active hold.
Design the object model, contracts, and interactions, then implement the bounded in-memory seat-hold operation, and finish by comparing ways to manage hold expiry.
External payment-provider integration, refunds, promotions, dynamic pricing, recommendations, venue administration, and distributed persistence are outside scope.