<?php

namespace App\Http\Controllers\Admin\Dashboard;

use App\Http\Controllers\Controller;
use App\Services\Analytics\StatsService;
use Inertia\Inertia;
use Inertia\Response;

class DashboardController extends Controller
{
    public function __construct(
        private readonly StatsService $statsService
    ) {}

    public function index(): Response
    {
        $stats = $this->statsService->getUserStats();
        $onlineData = $this->statsService->getOnlineData();

        return Inertia::render('admin/dashboard/index', [
            'usersCount' => $stats['total'],
            'adminsCount' => $stats['admins'],
            'playersCount' => $stats['players'],
            'onlineCount' => $onlineData['count'],
        ]);
    }
}
