<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');

$limit = isset($_GET['limit']) ? (int)$_GET['limit'] : 5;

$mockData = [
    [
        'name' => 'أحمد محمد',
        'center_name' => 'المركز الرئيسي',
        'total_inspections' => 45,
        'rating_avg' => 4.9,
        'quality_score' => 95
    ],
    [
        'name' => 'خالد علي',
        'center_name' => 'فرع المهندسين',
        'total_inspections' => 38,
        'rating_avg' => 4.7,
        'quality_score' => 88
    ],
    [
        'name' => 'محمود حسن',
        'center_name' => 'فرع المعادي',
        'total_inspections' => 42,
        'rating_avg' => 4.6,
        'quality_score' => 82
    ],
    [
        'name' => 'سامي عبدالله',
        'center_name' => 'فرع مدينة نصر',
        'total_inspections' => 35,
        'rating_avg' => 4.5,
        'quality_score' => 79
    ],
    [
        'name' => 'نادر عمر',
        'center_name' => 'المركز الرئيسي',
        'total_inspections' => 40,
        'rating_avg' => 4.4,
        'quality_score' => 76
    ]
];

// تطبيق الحد الأقصى
$data = array_slice($mockData, 0, $limit);

echo json_encode([
    'success' => true,
    'data' => $data
]);
?>