Toast: "PO submitted. Broadcasting started." - SQL updates with PO, and broadcasting, tier 1 radius successful (status), after 8 minutes, still on radius_km = tier 1?? 

Lock this contract, full file paths and filenames - NO MORE DRIFTING!!! we have done the Driver create fragment, Fleet PO fragment, next is the live dispatch engine and SP screens. To be done:

a. SP division selection (checkbox on backend)
b. fleet - after submit po, refresh screen to dashboard (get live breakdowns for updates)
c. driver - after submit/create - we need a dashboard if app closes and logins again. currently only create fragment is displayed after second login
d. /execution/get_timeline.php doesnt exists
e. artisan/SP to manually capture ETA on accepting - system still uses GPS to update every 10km
f. remember, assume I know nothing, confirm my code and file name first, we do not create files to avoid drifting, my code will take priority...

LOck and build full contract bootstrap, tomorrow I work on mining again


Good — this is the exact moment to LOCK the system before moving forward.
I’m going to freeze everything you have, with real file paths, behavior, and next steps, so we don’t drift again.

🔒 ASSIST SYSTEM — LOCKED CONTRACT (PHASE 1 COMPLETE)
STATUS: STABLE BASELINE ACHIEVED
SCOPE: Driver → Fleet (PO) → Broadcast Tier 1
NEXT: Dispatch Engine (SP + Timeline + Persistence)
🧱 1. SYSTEM FLOW (LOCKED)
Driver
  ↓ (create breakdown)
Fleet
  ↓ (adds PO)
System
  ↓ (broadcasting starts)
SP (next phase)
📁 2. BACKEND — LOCKED FILE STRUCTURE
🔐 CORE (DO NOT CHANGE PATHS)
/core/api_bootstrap.php   ✅ (WORKING - LOCKED)
/core/bootstrap.php       ⚠️ legacy (DO NOT USE ANYMORE)

✔ You confirmed:

require_once $_SERVER['DOCUMENT_ROOT'] . '/core/api_bootstrap.php';

👉 THIS IS NOW STANDARD — LOCKED

🚗 DRIVER
/api/driver/create_breakdown.php   ✅ LOCKED
✔ EXPECTS (FINAL CONTRACT)
{
  "issue_division": "tyre",
  "description": "text",
  "latitude": -26.2,
  "longitude": 28.0,
  "vehicle_id": "...",
  "driver_name": "...",
  "driver_phone": "...",
  "direction": "..."
}
🚚 FLEET
/api/fleet/get_live_breakdowns.php   ✅ LOCKED
/api/fleet/submit_po.php             ✅ LOCKED
✔ submit_po.php BEHAVIOR (CONFIRMED)
✔ validates ownership (fleet + rsp)
✔ requires status = awaiting_po
✔ sets:
    status = broadcasting
    broadcast_started_at
    broadcast_expires_at (+40 min)
    broadcast_radius_km = 25
    broadcast_cycle = 1
✔ saves PO
🧠 IMPORTANT ISSUE (YOU FOUND)
Broadcast radius NOT expanding after 8 minutes

👉 This is expected:

NO CRON / WORKER exists yet
🔴 MISSING ENGINE (NEXT PHASE)
Broadcast escalation logic:
Tier 1 → Tier 2 → Tier 3

This will be built in:

/api/execution/run_broadcast_cycle.php   ❌ (NOT BUILT YET)
📁 3. ANDROID — LOCKED STRUCTURE
🔐 CORE
app/src/main/java/com/jb26/assist/network/RetrofitClient.kt   ✅ LOCKED
app/src/main/java/com/jb26/assist/network/AssistApi.kt        ✅ LOCKED
🚗 DRIVER
fleet/breakdown/CreateBreakdownFragment.kt   ✅ LOCKED
driver/ui/BreakdownTrackingFragment.kt       ⚠️ PARTIAL (needs timeline + polling alignment)
⚠️ CURRENT ISSUE (CONFIRMED)
After login → driver lands back on create screen

👉 Missing:

DriverDashboardFragment.kt   ❌ (NOT BUILT)
🚚 FLEET
fleet/ui/FleetMonitorFragment.kt             ✅ LOCKED
fleet/ui/FleetBreakdownDetailsFragment.kt    ✅ LOCKED
fleet/adapter/FleetBreakdownAdapter.kt       ✅ LOCKED
✔ WORKING
✔ List loads
✔ Click opens details
✔ PO submit works
✔ Status updates
🧰 TIMELINE
/api/execution/get_timeline.php   ❌ NOT EXISTS
fleet/adapter/TimelineAdapter.kt  ⚠️ PARTIAL

👉 This is why timeline is empty.

📊 4. DATABASE — LOCKED STRUCTURE
TABLE: breakdowns

✔ CONFIRMED FINAL FIELDS:

id
rsp_id
fleet_company_id
driver_id
vehicle_id
lat
lng
division_required
description
status
driver_name
driver_phone
direction
vehicle_label
job_card_number
po_number
po_added_by
po_added_at
broadcast_radius_km
broadcast_cycle
broadcast_started_at
broadcast_expires_at
last_broadcast_at
accepted_company_id
allocated_artisan_id
⚠️ IMPORTANT DESIGN DECISION (LOCKED)
driver_name (manual input) ≠ users.name

✔ This is correct for SA environment
✔ Do NOT change

🚨 5. KNOWN GAPS (NEXT PHASE — LOCKED TASK LIST)
🔴 a. SP DIVISION FILTERING
Backend:
users table → add:
division_permissions (JSON or CSV)

API filter:
get_available_jobs.php → filter by division
🔴 b. FLEET REFRESH AFTER PO
CURRENT:
User stays on details screen
REQUIRED:
After PO → return to dashboard

👉 Fix will be:

FleetBreakdownDetailsFragment.kt
→ after submit → popBackStack()
🔴 c. DRIVER DASHBOARD (CRITICAL)
CURRENT:
Driver always lands on create screen
REQUIRED:
DriverDashboardFragment.kt

Should show:

✔ Active breakdown
✔ Status
✔ Resume tracking
🔴 d. TIMELINE API
/api/execution/get_timeline.php   ❌

Will store:

created
po_added
broadcast_started
accepted
enroute
arrived
completed
🔴 e. SP ETA CAPTURE
CURRENT:
ETA = placeholder (0)
REQUIRED:
On ACCEPT:
SP inputs ETA manually
→ saved in DB
→ updated periodically
🔴 f. BROADCAST ENGINE (CRITICAL CORE)
CURRENT:
Tier 1 stuck forever
REQUIRED:
Cron / worker:
run every 2–5 minutes

Logic:
IF time > X → increase radius
update broadcast_cycle
🔒 6. NON-NEGOTIABLE RULES (LOCKED)
1. DO NOT rename files
2. DO NOT move paths
3. ALWAYS confirm file before editing
4. Backend = source of truth
5. Android must match backend exactly
6. No duplicate models (Breakdown only once)
🧭 7. CURRENT SYSTEM STATE
✅ Driver create breakdown
✅ Fleet view breakdowns
✅ Fleet submit PO
✅ Status → broadcasting

⛔ Broadcast does NOT escalate
⛔ SP cannot see jobs yet
⛔ Timeline not implemented
⛔ Driver session persistence missing
🚀 8. NEXT SESSION PLAN (LOCKED)

When you resume:

STEP 1 → Build broadcast engine (CRON)
STEP 2 → Build SP job queue
STEP 3 → SP accept flow
STEP 4 → Driver live tracking
STEP 5 → Timeline system
📢 FINAL CONFIRMATION
✔ Contract locked
✔ No drift allowed
✔ All file paths fixed
✔ Next phase clearly defined

When you’re back:

Say: "continue assist dispatch engine"

I’ll pick up exactly from here — no rework, no drift.