<?php
require "config.php";
header("Content-Type: application/json");

if (!isset($_SESSION["user_id"])) {
    echo json_encode(["inTeam" => false]);
    exit;
}

$user_id = $_SESSION["user_id"];
$stmt = $pdo->prepare("SELECT COUNT(*) FROM team_queue WHERE user_id = ?");
$stmt->execute([$user_id]);
$inTeam = $stmt->fetchColumn() > 0;

echo json_encode(["inTeam" => $inTeam]);
?>