Phase 1 — Driver KYC Request (Queue)

Driver App
    |
    |-- "Start KYC" button tap
    |
    └── Server pe queue mein add ho jao
            |
            └── Driver ko dikhao:
                "Your token: #47"
                "People ahead: 3"
                "Estimated wait: ~15 mins"

Phase 2 — Admin KYC Session Start
Admin Panel
    |
    └── Queue list dikhega:
        #45 - Rahul Kumar - Waiting
        #46 - Amit Singh - Waiting  
        #47 - Vijay Yadav - Waiting
            |
            └── Admin clicks "Start KYC" for next driver

Phase 3 — Live Video Session

Admin                          Driver
  |                               |
  |<====== WebRTC Connected ======|
  |                               |
  | Step 1: Introduction          |
  | Admin talks to driver         |
  | (verify face liveness)        |
  |                               |
  | Step 2: Admin clicks          |
  | "Show Aadhar" button          |-- Notification → Driver App
  |                               |   "Please show Aadhar card"
  |                               |   Card frame overlay appears
  |                               |
  | Admin sees card in frame      |
  | Admin clicks "Capture"        |
  | Screenshot saved              |
  |                               |
  | Step 3: Admin clicks          |
  | "Show PAN" button             |-- Notification → Driver App  
  |                               |   "Please show PAN card"
  |                               |   Card frame overlay appears
  |                               |
  | Admin captures PAN            |
  |                               |
  | Step 4: Session End           |
  | Admin clicks "Submit"         |
  | All docs saved to DB          |
  | Recording saved               |

Phase 4 — Review & Decision (Async — Later)

Admin Panel (anytime after session)
    |
    └── KYC Review Section
            |
            ├── Watch recording
            ├── View captured screenshots
            ├── Driver details
            └── Approve / Reject (with reason)
                    |
                    └── Driver ko push notification
                        "KYC Approved ✅" / "KYC Rejected ❌"

Table	          Purpose
tbl_kyc_queue->	Driver queue + token number
tbl_kyc_sessions->	Video session details + recording path
tbl_kyc_documents->	Aadhar/PAN/Face screenshots
tbl_driver.kyc_status->	Driver ka current KYC status
tbl_driver.kyc_session_id->	Latest session reference

these table i have created 
ALTER TABLE `tbl_driver` 
ADD COLUMN `kyc_status` enum('not_started','queued','in_progress','pending_review','approved','rejected') DEFAULT 'not_started',
ADD COLUMN `kyc_session_id` int DEFAULT NULL;


CREATE TABLE `tbl_kyc_queue` (
  `id` int NOT NULL AUTO_INCREMENT,
  `driver_id` int NOT NULL,
  `token_no` int NOT NULL,          -- e.g. 47
  `position` int NOT NULL,          -- queue mein kitne log pehle hain
  `status` enum('waiting','called','in_progress','completed','cancelled') DEFAULT 'waiting',
  `requested_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `called_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
);


CREATE TABLE `tbl_kyc_sessions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `queue_id` int NOT NULL,
  `driver_id` int NOT NULL,
  `admin_id` int NOT NULL,
  `session_id` varchar(100) NOT NULL,   -- unique session identifier
  `status` enum('in_progress','pending_review','approved','rejected') DEFAULT 'in_progress',
  `recording_path` varchar(255) DEFAULT NULL,
  `started_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `ended_at` datetime DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `reviewed_at` datetime DEFAULT NULL,
  `reviewed_by` int DEFAULT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE `tbl_kyc_documents` (
  `id` int NOT NULL AUTO_INCREMENT,
  `session_id` int NOT NULL,
  `driver_id` int NOT NULL,
  `doc_type` enum('face','aadhar','pan') NOT NULL,
  `image_path` varchar(255) NOT NULL,
  `captured_at` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
);
