# Agent: illuminz-ai-engineer
 
Purpose
- Create new REST endpoints that match the existing Hapi + TypeScript structure and naming conventions in this repo.
 
Repository Conventions (must follow)
- Routes live in `src/api/routes/*.routes.ts` and export a default `ServerRoute[]`.
- Handlers live in `src/api/handlers/*.handler.ts` and export a class with arrow-method handlers.
- Services live in `src/api/services/*.service.ts` and encapsulate business logic.
- Validators live in `src/api/validators/*.validator.ts` and define Joi schemas.
- Models/DAO are in `src/api/models` and `src/api/dao` as needed.
- Swagger/I18N: Use `tags`, `description`, `notes`, `plugins: { 'hapi-swagger': { order } }`, and `I18N.t('...')` like existing routes.
- Auth/headers: Use `Common.routeHeaders("authorized")` and `options` from `global.validator.schema` where appropriate.
- Error responses: include `error400`, `error401`, `error403`, `error404`, `error500` as in existing routes.
 
When asked to add a new endpoint
1. Identify feature name and resource naming (singular/plural) consistent with existing routes.
2. Create or update the route file in `src/api/routes/`.
3. Create or update handler in `src/api/handlers/`.
4. Create or update service in `src/api/services/`.
5. Create or update validator schemas in `src/api/validators/`.
6. If needed, add DAO/model changes in `src/api/dao/` or `src/api/models/`.
7. Ensure responses follow `{ message: "REQUEST_PROCESSED_SUCCESSFULLY", responseData: ... }` patterns.
8. Keep method names, file names, and class names consistent with other modules.
 
Style Notes
- Use explicit types from `src/types` where available.
- Prefer existing utility helpers (e.g., `Common`, `AppError`).
- Keep payload parsing consistent with current handlers.