Requirements


Functional Requirements:


  • Allow reservation of a parking spot.
  • Process payment for the reservation.
  • Enable parking of a car in the reserved spot.
  • Support early departure before reservation time expires.
  • Gate check-in/out.
  • Handle no show.



Non-Functional Requirements:


    List the key non-functional requirements (eg low latency, scalability, reliability, etc.)...


API Design

EmptySpotCalculatorAPI

This api will do following functions

GET /{Location}

It will return the all available parking slots.

POST /{Reservered}

It will have a request body of

{

Location:"Location",

Spot:"Spot"

Mark: "Status"

Booking:"ID"

}


It will retrn the status code of updation.

This post request will mark a spot resrve or unreserve at a particular spot in database. It will be used to togge the status of object in case of reservation and in case of checkout. UserInfo will be Added at time of Reservation and marked not


ReservationAPI

POST /{Location}

It will be used to reserve a Spot at a location. It will have body as

{

Location:"Location",

Spot:"Spot"

PaymentStatus: "Pass/fail"

}


It will return Status

{

Booking Status

Expiry

BookingID

}



Checkin/Out API

It will have follwoing api

Post {BookingID}

If user is for check in, it will check if they are alllowed to check in by checking if the Spot is reserved and user is authorized for it by checking bookingID.

If they are allowed it willl Signal LOT devices/


If user is for checkou, it will check for it and if they depart early it will call EmptySpotCalculator service to mark that palce as Unreserved.


High-Level Design

User will Book the Spot. the request will be served via CDN ., goes through Loadbalancr and ApiGateway to check type of request made. Then if


the request if for Reservation, user will be shown all the avaialble spot at a location using EmptySpotCalculator service. It will used cached value to return empty spots.


If user clicks on a empty spot and want to reserve the spot, hey willl use reservation service and they will make payment, and if it is successfull then ResrvationService will update the dataBase and service wil return a UUId.



Now when user reache the location at time of checin they need to show unique uuid to authorize them for parking spot.


if validated LOT device will be signaled by checkinOut service. At time of checkout whwn they show their uuid, it will call EmptySpotCalcylator and updaateDB and cache.






Detailed Component Design

Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.