<?php
require_once __DIR__ . '/../../../connect.php';

try {
    $sql = "SELECT id, first_name,last_name, phone FROM driver WHERE status <> 'active' ORDER BY id DESC";
    $stmt = $con->prepare($sql);
    $stmt->execute();
    $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);

    // فك التشفير
    foreach ($rows as &$r) {
        $r['phone'] = $encryptionHelper->decryptData($r['phone']);
        $r['first_name']  = $encryptionHelper->decryptData($r['first_name']);
      	$r['last_name']  = $encryptionHelper->decryptData($r['last_name']);
    }

    jsonSuccess($rows); // يرجع كـ message: [...]
} catch (PDOException $e) {
    jsonError("Error: " . $e->getMessage());
}