Design a low-level system for a parking lot that satisfies the following requirements:
- The parking lot should have multiple entrances and exits.
- A global display board should show the number of free parking spots of all types.
- The parking lot should have different types of parking spots (mini, compact, and large) that allow parking for motorbikes, cars, and trucks, respectively.
- The parking lot should have multiple floors.
- The admin should be able to add and remove entrances and exits.
- The parking attendant should be able to create parking tickets.
- The parking lot should support different means of payment.
Please provide a detailed low-level design for the parking lot system that can handle the above requirements. You should consider how the parking lot will handle incoming and outgoing vehicles, track parking spots, generate and process parking tickets, and manage payments. Additionally, you should consider how the system will communicate with the display board and handle different parking strategies.
- The parking lot should have the ability to offer car wash and electric charging services to customers at the parking spot.
- The parking lot should support different parking strategies like nearest first or farthest first on the basis of floor number and id of the parking spot.
Please incorporate this requirement into your design by considering how the system will handle these additional services. For example, you could consider how customers will be able to request these services, how the system will track which cars need these services, and how payment for these services will be processed.
- ParkingLot: Central class managing all floors, entrances, exits, and the global display board.
- ParkingSpot: Abstract class with Mini, Compact, and Large spot subclasses. Each spot tracks occupancy and available services (car wash, electric charging).
- Vehicle: Abstract class with Motorbike, Car, and Truck subclasses.
- Entrance/Exit: Each has a unique ID and can be added or removed by the admin.
- DisplayBoard: Shows real-time availability of spots by type.
- ParkingTicket: Issued at entrance, tracks entry time, spot and vehicle.
- ParkingEvent: Represents events related to parking activities, such as vehicle entry, exit.
- Payment: Handles multiple payment methods and integrates with ticket and service charges.
- ServiceRequest: Tracks additional services (car wash, charging) requested per spot.
- Entrances and exits are managed as objects, allowing dynamic addition/removal.
- Each entrance is responsible for ticket generation and initial spot allocation.
- Supports multiple strategies (nearest first, farthest first).
- Allocation considers both floor number and spot ID.
- All display boards reflect real-time spot availability.
- Updates triggered on vehicle entry/exit and service completion.
- Tickets include vehicle info, assigned spot, entry time, and requested services.
- Payment module supports cash, card, and digital wallets, and processes both parking and service fees.
- Customers can request car wash or electric charging at entry.
- Service requests are linked to the parking spot and tracked in the system.
- Admin: Can add/remove entrances, exits, and manage floors and spots.
- Attendant: Issues tickets, assists with spot allocation, and manages service requests.
- Singleton: For the ParkingLot class and DisplayBoard to ensure a single instance.
- Strategy: For parking spot allocation strategies (nearest first, farthest first).
- Observer: For updating display boards in real time on the bases of parking event.
- Decorator: For adding additional service for the spot such as Car wash or electric charging as per the customer's requiremnts.
- SOLID Principles: The design follows SOLID principles to ensure maintainability, scalability, and ease of extension.
- Error Handling: The system validates spot availability, payment status, and service completion before exit.
- Concurrency: Thread-safe operations for spot allocation and display updates.