Room
Represents a room in a hotel with specific attributes, price, type, and scheduling availability.
Attributes:
| Name | Type | Description |
|---|---|---|
instance_count |
int
|
Counter to assign unique room numbers. |
number |
int
|
The unique identifier of the room instance. |
_type |
RoomTypeEnum
|
Type of the room, defined by RoomTypeEnum. |
_price |
float
|
Base price for the room. |
_multiplier_factor_price |
float
|
Multiplier for the room rate based on room type. |
_schedules |
List[Schedule]
|
List of scheduled bookings for the room. |
Source code in hazbin_hotel/src/room.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
multiplier_factor_price: float
property
float: Gets the multiplier factor for the room price based on room type.
price: float
property
writable
float: Gets or sets the base price of the room.
schedules: List[Schedule]
property
List[Schedule]: Gets the list of schedules associated with the room.
type: RoomTypeEnum
property
writable
RoomTypeEnum: Gets or sets the type of the room.
__init__(room_type, price, schedules)
Initializes the Room with a type, price, and existing schedules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
room_type
|
RoomTypeEnum
|
Type of the room. |
required |
price
|
float
|
Base price of the room. |
required |
schedules
|
List[Schedule]
|
Initial list of schedules associated with the room. |
required |
Raises:
| Type | Description |
|---|---|
InvalidRoomType
|
If the room type is invalid. |
ValueError
|
If the price is negative. |
Source code in hazbin_hotel/src/room.py
add_schedule(schedule)
Adds a schedule to the room if the period is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schedule
|
Schedule
|
The schedule to add. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the period is not available. |
Source code in hazbin_hotel/src/room.py
is_period_available(period, *, ignore_schedule=False, schedule_id=None)
Checks if a given period is available for scheduling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
Period
|
The period to check. |
required |
ignore_schedule
|
bool
|
Whether to ignore a specific schedule. Defaults to False. |
False
|
schedule_id
|
int
|
ID of the schedule to ignore if |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the period is available, False otherwise. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in hazbin_hotel/src/room.py
update_price(new_price)
Updates the room price.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_price
|
float
|
The new price to set. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the new price is negative. |
Source code in hazbin_hotel/src/room.py
update_schedule(schedule, schedule_id)
Updates an existing schedule if the period is available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schedule
|
Schedule
|
New schedule details. |
required |
schedule_id
|
int
|
ID of the schedule to update. |
required |
Raises:
| Type | Description |
|---|---|
ScheduleCannotBeOverwritten
|
If the period is not available for update. |