<?php
namespace App\Controllers;

require_once BASE_PATH . '/app/helpers/permissions.php';
use App\Core\Controller;
use App\Core\Database;

class AdminAnalyticsController extends Controller
{
    public function index(): void
    {
        $db = Database::getInstance();

        $data = $db->query("
        SELECT stage, COUNT(*) as total
        FROM submissions
        GROUP BY stage
        ")->fetchAll();

        header('Content-Type: application/json');
        echo json_encode($data);
    }
}
