<?php

declare(strict_types=1);

namespace App\Modules\Administration\Services;

use System\Database\QueryBuilder;

final class DashboardService
{
    public function __construct(
        private QueryBuilder $query
    ) {
    }

    public function statistics(): array
    {
        return [

            'totalUsers' => $this->query
                ->table('users')
                ->count(),

            'activeUsers' => $this->query
                ->table('users')
                ->where('active', 1)
                ->count(),

            'totalRoles' => $this->query
                ->table('roles')
                ->count(),

            'totalPermissions' => $this->query
                ->table('permissions')
                ->count(),

        ];
    }
}