# Instructions for AI Agents — Hospital / Doctor App

When working on this project, follow the **Hospital Management Solution** documentation and audit process so the app matches the intended structure and no topics are missed.

## 1. Documentation

- **Project documentation (requirements, topics, steps):** `docs/PROJECT_DOCUMENTATION.md`  
  - Contains: Business context, User roles, Functional requirements (Lead → Patient → Appointment → Consultation → Billing), **Business Rules BR-01 to BR-34**, **User Stories US-01 to US-23**, Data tables, Dashboards, End-to-end flow.
- **How to audit and fix gaps:** `docs/AGENT_AUDIT_GUIDE.md`

## 2. When to Use the Audit Process

Use the audit process when the user asks to:

- Check if the app follows the documentation
- Find missing features or topics
- Implement all steps from the documentation
- Ensure proper structure as per the documentation

## 3. What to Do

1. **Read** `docs/PROJECT_DOCUMENTATION.md` (including any custom documentation the user added).
2. **Follow** the steps in `docs/AGENT_AUDIT_GUIDE.md`:
   - Build a checklist from the documentation.
   - Map each topic to routes, controllers, views, models.
   - Identify missing, broken, or incorrect items (Gap Report).
   - Fix missing/broken items (routes, controllers, views, models, permissions).
   - Re-verify against the checklist.
3. **Respect** the structure defined in the documentation (roles, URLs, multi-tenant rules).

## 4. Important Files

| Purpose           | File |
|-------------------|------|
| Requirements      | `docs/PROJECT_DOCUMENTATION.md` |
| Audit steps       | `docs/AGENT_AUDIT_GUIDE.md` |
| Routes            | `routes/web.php` |
| Controllers       | `app/Http/Controllers/` |
| Views             | `resources/views/` |
| Models            | `app/Models/` |

## 5. Quick Checks

- Every route that uses a controller must have that controller in a `use` statement at the top of `routes/web.php`.
- Every documented topic should have a corresponding route (if it’s a feature), controller logic, and view where applicable.
- Role-based access must match the documentation (Super Admin, Hospital Admin, CRM Agent, Doctor, Billing Executive).
- Multi-tenant: data must be scoped by `hospital_id` where the documentation says so.

By following `PROJECT_DOCUMENTATION.md` and `AGENT_AUDIT_GUIDE.md`, the agent can identify missing topics and implement all steps mentioned in the documentation in a consistent way.
