<?php
require_once '../../core/bootstrap.php';

header('Content-Type: application/json');

$query = $_GET['q'] ?? '';

if (strlen($query) < 2) {
    echo json_encode([]);
    exit();
}

$userModel = new User();
// Search for users who are 'user' or 'fan' (eligible for hire)
$users = $userModel->searchEligibleStaff($query);

echo json_encode($users);
?>