<?php

namespace App\Livewire\Admin;

use App\Domain\Shared\Models\Academy;
use App\Models\User;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Component;

#[Layout('layouts.app')]
#[Title('لوحة المدير العام')]
class SuperAdminPanel extends Component
{
    public function mount(): void
    {
        $this->authorize('super_admin.access');
    }

    public function render()
    {
        $academies = Academy::withoutGlobalScopes()
            ->withCount(['users'])
            ->get();

        return view('livewire.admin.super-admin-panel', [
            'academies' => $academies,
            'totalUsers' => User::withoutGlobalScopes()->count(),
            'totalAcademies' => Academy::withoutGlobalScopes()->count(),
        ]);
    }
}
