The system should allow:
The system should handle
If it's possible, we can have the system to be able to accommodate up to 200 vehicles, so we can cover rush hours easily.
We need to support the following types of requests:
Since we have several main business entities here like Reservation and Spot, which relate to each other in particular way. And since we would want to effectively query and connect those entities SQL (like PostgreSQL) database seems like a good choice here.
Reservations database stores records for reservations made by clients with the following fields:
Spot database:
We have several main components in the system:
First a client request a new reservation from the system. Then the client requests opening the gate with a reservation id, gets a parking spot id and parks the vehicle. When the client wants to leave it first sends a payment request with a reservation id and then requests opening the gates again with an identifier of the payed reservation and leaves.
Reservation service will need to use some smart mechanism to assign a parking spot based on a current load and a requested vehicle type. We can use a bin packing algorithm to do it efficiently.
Explain any trade offs you have made and why you made certain tech choices...
We may want to offer dynamic prices to better adopt to rush hours and intervals of low demand. Or we can make our spot finding algorithm more flexible, teaching it to combine smaller parking spots into one spot for a bigger vehicle, if necessary.