# Module-by-module Execution Roadmap (API + Flutter)

This is the practical delivery checklist to implement the customer mobile app with the same flow as the web platform, using the contracts in `docs/mobile/API_CONTRACTS_V1.md`.

## 0) Foundations (Week 0)

### Laravel (API)
- [ ] Implement API response envelope helper + `/api/*` exception rendering.
- [ ] Add `GET /api/v1/me`, `POST /api/v1/auth/logout`.
- [x] Security: env-only Razorpay keys; TLS verify enabled.
- [ ] Add `trace_id` to responses (request id).

### Flutter
- [x] Create Flutter project under `mobile/lucknowone_app`.
- [x] Add dependencies: Riverpod, Dio, GoRouter, Freezed/JSON, secure storage, intl.
- [x] Add theme tokens (`AppColors`, `AppTheme`) and router scaffold.
- [ ] Add Dio client provider + interceptors:
  - auth header injection
  - standardized error mapping
  - retry/backoff for idempotent GETs
- [ ] Add secure token repository (get/set/clear) + auth state provider.
- [ ] Add localization scaffold (`intl` + ARB) even if only `en` initially.

## 1) Auth (OTP) + Session bootstrap (Week 1)

### API requirements
- `POST /auth/send-otp`
- `POST /auth/verify-otp` → token
- `GET /me`
- `POST /auth/logout`

### Flutter screens
- Login (mobile input + send OTP)
- OTP verify (6-digit + resend timer)
- Basic “Account” screen (logout)

### Validation logic
- Mobile: `^[6-9][0-9]{9}$`
- OTP: 6 digits

### Edge cases
- Rate-limit hits (show retry countdown)
- Token expired/invalid → force logout + go to login

## 2) Home + Ads (Week 1–2)

### API requirements
- `GET /ads?placement=home`
- (optional) `POST /ads/{id}/click` for analytics

### Flutter screen structure
- Home: banner carousel + CTAs (Property/Jobs/Education/Services) + featured categories + ad placements

### Reusable components
- Carousel widget
- Ad card widget + click handler

## 3) Modules listing (Week 2–3)

### API requirements
- `GET /modules?type=property|job|education|service&page&per_page`
- Filtering additions (incremental):
  - property: `purpose`, `area_id`
  - jobs: `segment`, `job_category_id`
  - education: `study_level`

### Flutter screen structure
- `ModuleListScreen(type)`
  - tabs/chips for filters
  - paging list/grid switching where relevant (property list/grid)
  - skeleton + empty/error states

### Edge cases
- Large datasets → paging + image caching
- Filter state persistence per module tab

## 4) Module detail (Week 3–4)

### API requirements (type-safe)
- `GET /property/{id}` (auth-gated if parity maintained)
- `GET /jobs/{id}`
- `GET /education/{id}`
- `GET /services/{id}`

### Flutter screens
- Property detail: gallery, specs, map open, enquiry CTA
- Job detail: description, salary/package, apply/enquire CTAs
- Education detail: about, countries/universities, enquiry CTA
- Service detail: provider, pricing, enquiry form (area/pincode)

### Reusable components
- Gallery pager + thumb strip
- Spec table widget
- “Call/WhatsApp” action row

### Edge cases
- Already interested (disable CTA, show banner)
- Missing description/images (fallback)

## 5) Lead capture (Week 4)

### API requirements
- `POST /leads` (module enquiry)
- `GET /me/leads`
- `POST /jobs/apply` (auth)
- `POST /education/enquire` (public)

### Flutter screens
- Lead form (module enquiry)
- Job application form (with resume picker)
- Education enquiry form
- My leads list (simple history)

### Validation logic
- Same as web; service enquiry requires `area_id` + 6-digit pincode.

### Edge cases
- Duplicate lead → treat as success (“already submitted”)
- File upload failures (resume)

## 6) Quick Pay (Week 5)

### API requirements
- `GET /services` (optional for quick-pay service master) or a dedicated `/quick-pay/services`
- `POST /payments/razorpay/order`
- `POST /payments/razorpay/verify`
- `GET /me/payments`

### Flutter screens
- Quick pay service picker
- Amount + user details form
- Razorpay checkout integration (native SDK)
- Receipt/history

### Edge cases
- Checkout cancelled → status failed, show retry
- Signature mismatch → failed, show support hint

## 7) Dashboard + My Properties + Profile (Week 6+)

### API requirements
- Customer properties CRUD:
  - list my properties
  - create/update/resubmit
  - upload images
- Profile:
  - `PUT /me` (profile fields + avatar)
  - `PUT /me/password`

### Flutter screens
- Dashboard: stats + notifications (status/comment)
- My properties: list, create, edit, detail
- Profile: edit + change password

### Edge cases
- Offline handling for drafts (optional)
- Partial uploads / large images (compress + background upload)

# Module-by-Module Execution Roadmap (API + Flutter)

This is the **implementation checklist** to deliver the Flutter customer app with parity to the current web platform, while improving architecture and mobile UX.

The order is intentionally:
**Foundations → Auth/Profile → Home/Ads → Modules → Leads → Quick Pay → My Properties**

## 0) Foundations (Week 0 baseline)

### Laravel (API foundations)
- [ ] Add API response envelope helper (see `docs/mobile/LARAVEL_API_REFACTOR_PLAN.md`)
- [ ] Add exception-to-JSON renderers in `bootstrap/app.php` for all `/api/*`
- [ ] Add `trace_id` propagation (log context + response meta)
- [ ] Standardize pagination meta structure

### Flutter (app foundations)
- [x] Create project: `mobile/lucknowone_app`
- [x] Add deps: Riverpod, Dio, GoRouter, Freezed/JSON, secure storage, intl
- [x] Create theme tokens aligned to web (`#de6d0f`, radii, light/dark)
- [ ] Create `core/network` Dio client:
  - base URL config
  - interceptors: auth header, retry/backoff (idempotent only), error mapping
  - request logging in debug only
- [ ] Create auth storage abstraction (`core/storage`) for token and user profile cache
- [ ] Create reusable UI: skeleton loaders, empty state, error state, pull-to-refresh
- [ ] Localization scaffold (intl; ARB structure even if only English initially)

## 1) Auth + Profile

### API requirements
- [ ] `POST /api/v1/auth/send-otp`
- [ ] `POST /api/v1/auth/verify-otp`
- [ ] `GET /api/v1/me` (auth)
- [ ] `POST /api/v1/auth/logout` (auth)
- [ ] `PUT /api/v1/me` (auth) — parity with web profile update

### Flutter screens
- [ ] Login (OTP) screen
- [ ] OTP verify screen
- [ ] (Optional) password login screen (web has it; decide if needed for mobile)
- [ ] Profile view/edit screen
- [ ] Change password screen (optional; web supports it)

### Validation logic (mobile)
- Mobile number: `^[6-9][0-9]{9}$`
- OTP code: 6 digits
- Profile image: size constraints aligned with API

### Edge cases
- Token expired / revoked → hard logout
- OTP resend cooldown UI (30s) to match current web behavior
- Rate limit responses (429) → show retry-after message

## 2) Home + Ads

### API requirements
- [ ] `GET /api/v1/ads?placement=home`
- [ ] `POST /api/v1/ads/{id}/click` (mobile-specific tracking)
- [ ] (Optional) `GET /api/v1/home/banners` if banners are dynamic in mobile

### Flutter screens/components
- [ ] Home screen (banners carousel)
- [ ] Featured categories grid (Property/Jobs/Education/Services)
- [ ] Ads carousel / slider (with click tracking)
- [ ] “Free Ad Posting” CTA → My Properties create (auth-gated)

### Reusable components
- BannerCarousel, AdCarousel, CategoryTile

## 3) Modules (List + Detail)

Modules:
- Property
- Jobs
- Education
- Services (Local Services listings)
- Service Category screen

### API requirements
- [ ] `GET /api/v1/modules?type=...` (paginated)
- [ ] Type-safe detail:
  - [ ] `GET /api/v1/property/{id}`
  - [ ] `GET /api/v1/jobs/{id}`
  - [ ] `GET /api/v1/education/{id}`
  - [ ] `GET /api/v1/services/{id}`
- [ ] Filtering support (per module):
  - Property: `purpose`, `area_id`
  - Jobs: `segment`, `category_id`
  - Education: `study_level`
  - Services: `category_id`

### Flutter screens
- [ ] Module list shell (shared):
  - pagination + pull-to-refresh
  - list/grid mode where needed
  - filter panels/chips
- [ ] Property list + detail
- [ ] Job list + detail
- [ ] Education list + detail
- [ ] Services list + detail
- [ ] Service category detail + lead form

### Edge cases
- Empty results → branded empty state
- Large images → cached + placeholder + error fallback
- Share action → native share (title + deep link)
- Maps → open in Google Maps / Apple Maps

## 4) Leads (Enquiry, My Leads, Specialized forms)

### API requirements
- [ ] `POST /api/v1/leads` (generic enquiry)
- [ ] `GET /api/v1/me/leads` (auth)
- [ ] `POST /api/v1/jobs/apply` (auth; mirrors web job apply)
- [ ] `POST /api/v1/education/enquire` (public; mirrors web)

### Flutter screens/components
- [ ] Generic enquiry bottom sheet (name/mobile/message)
- [ ] Service enquiry form (requires area_id + pincode)
- [ ] Job application form (file upload resume)
- [ ] Education enquiry form
- [ ] My Leads list (status filters)

### Validation + UX
- Deduplicate module enquiries (show “already submitted”)
- Offline handling: queue lead submission (optional) or block with explicit error

## 5) Quick Pay (Razorpay)

### API requirements
- [ ] `GET /api/v1/quick-pay/services` (or reuse `GET /services` + server-defined list)
- [ ] `POST /api/v1/payments/razorpay/order` (auth)
- [ ] `POST /api/v1/payments/razorpay/verify` (auth)
- [ ] `GET /api/v1/me/payments` (auth)

### Flutter screens
- [ ] Quick Pay service picker
- [ ] Quick Pay form (name, mobile, amount)
- [ ] Razorpay checkout (native SDK integration)
- [ ] Payment status + receipt screen
- [ ] Transactions history (also shown in dashboard)

### Edge cases
- Payment cancelled in checkout → verify endpoint marks failed + show toast
- Verification failed → show support CTA

## 6) My Properties (Customer posting flow)

### API requirements
- [ ] `GET /api/v1/me/properties` (auth)
- [ ] `POST /api/v1/me/properties` (auth) + multipart image upload
- [ ] `GET /api/v1/me/properties/{id}` (auth)
- [ ] `PUT /api/v1/me/properties/{id}` (auth)
- [ ] `POST /api/v1/me/properties/{id}/resubmit` (auth)
- [ ] Comments/review feedback payload (admin comments shown in dashboard notifications)

### Flutter screens
- [ ] My Properties list
- [ ] Create property wizard (mobile-optimized steps)
- [ ] Edit property
- [ ] Property status + comments timeline

### Validation
- Keep parity with existing web rules + add stronger server validation
- File size handling (map to existing PostTooLarge behavior)

