# Phase 2: Room Types & Rooms

## Objective
Implement full room type and room management for both Filament admin and API (hotel manager + customer browsing).

---

## Tasks

### 2.1 Filament — HotelResource

**File:** `app/Filament/Resources/HotelResource.php`

CRUD for hotels with:
- Form: name, description (translatable), slug, stars, check_in_time, check_out_time, policies, contact info, is_active, photos
- Table: name, place, stars, rooms count, is_active
- Navigation group: `Hotel`

**Relation Managers:**
- `RoomTypesRelationManager` — CRUD room types inline
- `RoomsRelationManager` — CRUD rooms inline
- `ExtrasRelationManager` — CRUD extras inline (Phase 6 placeholder)

### 2.2 Filament — ManageHotels Page on PlaceResource

**File:** `app/Filament/Resources/PlaceResource/Pages/Management/ManageHotels.php`

Same pattern as ManageRestaurants — shows hotels for this place.

### 2.3 API — Hotel Manager Room Type Controllers

**Directory:** `app/Http/Controllers/Api/Employee/HotelManager/`

#### ListRoomTypesController
```
GET /v1/places/{place}/hotels/{hotel}/room-types
```
Returns room types with availability summary (total rooms, available rooms count for today).

#### ShowRoomTypeController
```
GET /v1/places/{place}/hotels/{hotel}/room-types/{roomType}
```
Returns room type detail with:
- All rooms and their current status
- Current applicable rate (seasonal or base)
- Photos, amenities, bed type

### 2.4 API — Hotel Manager Room Controllers

#### ListRoomsController
```
GET /v1/places/{place}/hotels/{hotel}/rooms
```
Returns all rooms with:
- Current status + housekeeping status
- Room type info
- Current occupant (if occupied) — reservation public_id + guest name
- Filterable by: status, housekeeping_status, room_type_id, floor

#### ShowRoomController
```
GET /v1/places/{place}/hotels/{hotel}/rooms/{room}
```
Returns room detail with:
- Room type details
- Current reservation (if occupied)
- Upcoming reservations
- Recent housekeeping history

#### UpdateRoomStatusController
```
PATCH /v1/places/{place}/hotels/{hotel}/rooms/{room}/status
```
Updates room status (maintenance, out-of-order, etc.). Creates housekeeping log if relevant.

### 2.5 API — Customer Hotel & Room Browsing

**Directory:** `app/Http/Controllers/Api/Hotel/`

#### ListHotelsController
```
GET /v1/places/{place}/hotels
```
Returns active hotels at this place with basic info, photos, stars.

#### ShowHotelController
```
GET /v1/places/{place}/hotels/{hotel}
```
Returns hotel details: hours, policies, photos, room types summary.

#### ListHotelRoomTypesController
```
GET /v1/places/{place}/hotels/{hotel}/room-types
```
Returns active room types with photos, amenities, base pricing (respecting member pricing if authenticated user is member).

### 2.6 Resources

**Files:** `app/Http/Resources/HotelManager/`

- `HotelResource` — Hotel details for manager
- `HotelRoomTypeResource` — Room type with pricing & availability
- `HotelRoomResource` — Room with status & occupant info
- `HotelRoomTypeSummaryResource` — Compact room type for customer view

### 2.7 Form Requests

**Files:** `app/Http/Requests/HotelManager/`

- `UpdateRoomStatusRequest` — status enum validation

### 2.8 Tests

**File:** `tests/Feature/Controllers/HotelManager/RoomTypesAndRoomsTest.php`

- [ ] Hotel manager can list room types
- [ ] Hotel manager can view room type detail with rooms
- [ ] Hotel manager can list rooms with filters
- [ ] Hotel manager can view room detail
- [ ] Hotel manager can update room status
- [ ] Customer can list hotels at a place
- [ ] Customer can view hotel details
- [ ] Customer can list room types with correct pricing (member vs non-member)
- [ ] Room status update creates housekeeping log when relevant

---

## Files Created/Modified

| Action | File |
|---|---|
| Create | `app/Filament/Resources/HotelResource.php` |
| Create | `app/Filament/Resources/HotelResource/Pages/` (List, Create, Edit) |
| Create | `app/Filament/Resources/HotelResource/RelationManagers/RoomTypesRelationManager.php` |
| Create | `app/Filament/Resources/HotelResource/RelationManagers/RoomsRelationManager.php` |
| Create | `app/Filament/Resources/PlaceResource/Pages/Management/ManageHotels.php` |
| Modify | `app/Filament/Resources/PlaceResource.php` — add ManageHotels page |
| Create | `app/Http/Controllers/Api/Employee/HotelManager/ListRoomTypesController.php` |
| Create | `app/Http/Controllers/Api/Employee/HotelManager/ShowRoomTypeController.php` |
| Create | `app/Http/Controllers/Api/Employee/HotelManager/ListRoomsController.php` |
| Create | `app/Http/Controllers/Api/Employee/HotelManager/ShowRoomController.php` |
| Create | `app/Http/Controllers/Api/Employee/HotelManager/UpdateRoomStatusController.php` |
| Create | `app/Http/Controllers/Api/Hotel/ListHotelsController.php` |
| Create | `app/Http/Controllers/Api/Hotel/ShowHotelController.php` |
| Create | `app/Http/Controllers/Api/Hotel/ListHotelRoomTypesController.php` |
| Create | `app/Http/Resources/HotelManager/HotelResource.php` |
| Create | `app/Http/Resources/HotelManager/HotelRoomTypeResource.php` |
| Create | `app/Http/Resources/HotelManager/HotelRoomResource.php` |
| Create | `app/Http/Resources/HotelManager/HotelRoomTypeSummaryResource.php` |
| Create | `app/Http/Requests/HotelManager/UpdateRoomStatusRequest.php` |
| Modify | `routes/api.php` — add room type & room routes |
| Create | `tests/Feature/Controllers/HotelManager/RoomTypesAndRoomsTest.php` |

---

## Acceptance Criteria

- [ ] Filament HotelResource with full CRUD and relation managers
- [ ] ManageHotels page on PlaceResource
- [ ] All 5 manager API endpoints functional
- [ ] All 3 customer API endpoints functional
- [ ] Room status update works with housekeeping log creation
- [ ] Customer sees member pricing when applicable
- [ ] All Swagger annotations present
- [ ] All tests pass
- [ ] Pint + PHPStan pass on new/modified files
