Room Pricing
Room prices are fixed based on room type and charged per night.Price Structure
| Room Type | Price per Night |
|---|---|
| Single | €50 |
| Double | €80 |
| Suite | €150 |
These prices are defined in the room objects and stored in
~/workspace/source/data/rooms.json. The base price is multiplied by the number of nights to calculate the room portion of the total cost.Price Calculation
The total reservation price is calculated as:pricePerNightis the room’s base ratenightsis the number of nights (checkOut - checkIn)sum(extras)is the total of all extra services (price × quantity for each extra)
Extra Services
Guests can add optional services to their reservations. Services are categorized as daily charges or one-time fees.Available Services
Daily Services
Daily Services
These services are charged per day/night of the stay:
| Service | Price per Day | Example Usage |
|---|---|---|
| Breakfast | €10 | Charged for each night of stay |
| Parking | €15 | Charged for each night of stay |
One-Time Services
One-Time Services
These services are charged as a single fee:
| Service | Price | Description |
|---|---|---|
| Late Check-out | €30 | One-time fee for extended checkout |
| Early Check-in | €20 | One-time fee for early arrival |
Extra Service Structure
Each extra service in the reservation has this structure:Name of the service (e.g., “Breakfast”, “Parking”, “Late Checkout”)
Price per unit in euros
Number of units (typically equals number of nights for daily services, 1 for one-time services)
Night Restrictions
Reservations must comply with minimum and maximum night limits.Minimum stay: 1 nightThe check-out date must be at least one day after the check-in date.
Maximum stay: 14 nightsReservations cannot exceed 14 consecutive nights.
Implementation
This validation is enforced in~/workspace/source/utils/validation.js:92-95:
The minimum of 1 night is implicitly enforced by the date range validation that requires check-out to be after check-in.
Room Status Transitions
Rooms transition through different states based on reservations and hotel operations.Status Types
Defined in~/workspace/source/utils/constants.js:9-13:
Status Flow
Available
Available
Status:
"available"The room is ready for new reservations and can be booked by guests.Transitions to:occupiedwhen a guest checks inmaintenancewhen maintenance is required
Occupied
Occupied
Status:
"occupied"The room is currently occupied by a guest with an active reservation.Transitions to:availablewhen the guest checks outmaintenanceif issues are reported during stay
checkIn() functionMaintenance
Maintenance
Status:
"maintenance"The room is unavailable due to maintenance, cleaning, or repairs.Transitions to:availablewhen maintenance is complete
Rooms in maintenance status cannot be booked and are excluded from availability searches.
Reservation Status Flow
Reservations progress through a lifecycle from creation to completion or cancellation.Status Types
Defined in~/workspace/source/utils/constants.js:1-7:
Status Flow
Confirmed
Confirmed
Status:
"confirmed"Initial status when a reservation is created. The room is reserved for the specified dates.Location: Active reservations array (hotel.reservations)Allowed actions:- Add extras
- Check-in (on or after check-in date)
- Cancel reservation
checked-inviacheckIn()functioncancelledviacancelReservation()function
Checked-in
Checked-in
Status:
"checked-in"Guest has arrived and checked into the room. The room status is set to occupied.Location: Active reservations array (hotel.reservations)Validation:- Can only check in from
confirmedstatus - Check-in date must be today or in the past
- Reservation must exist
checked-outviacheckOut()functioncancelledviacancelReservation()(with potential penalties)
Checked-out
Checked-out
Status:
"checked-out"Guest has completed their stay and checked out. Invoice is generated.Location: History array (hotel.history)Effects:- Room status changed to
available - Reservation moved from
hotel.reservationstohotel.history - Invoice generated with full breakdown
Cancelled
Cancelled
Status:
"cancelled"Reservation was cancelled before or during the stay.Location: History array (hotel.history)Cancellation policy:- More than 7 days before check-in: No charge
- 3-7 days before check-in: 50% of total
- Less than 3 days before check-in: 100% of total
- Room is freed and becomes available
- Reservation moved to history
- Penalty calculated based on cancellation policy
State Validation
The system enforces state transition rules:- Check-in requires status
confirmed - Check-out requires status
checked-in - Cancellation allowed from
confirmedorchecked-in - Adding extras allowed for
confirmedandchecked-instatuses
Once a reservation reaches
checked-out or cancelled status, it is moved to the history array and becomes immutable.