<?php
/**
 * API: تسجيل الخروج
 * POST /api/logout.php
 */

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

require_once __DIR__ . '/../includes/config.php';
require_once __DIR__ . '/../includes/functions.php';

logEvent('session_end', ['phone' => $_SESSION['whatsapp_number'] ?? 'unknown']);

$_SESSION = [];
session_destroy();

jsonResponse(['success' => true]);
