<?php

namespace App\Filament\Widgets;

use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
use App\Repositories\ProfesseurRepository;

class ProfesseursKPI extends BaseWidget
{
    protected ?string $pollingInterval = '15s';
    
    protected function getStats(): array
    {
        $repository = app(ProfesseurRepository::class);
        $stats = $repository->getStatistics();
        
        return [
            Stat::make('Total Professeurs', $stats['total'])
                ->description('Nombre total de professeurs')
                ->descriptionIcon('heroicon-o-users')
                ->color('primary'),
            Stat::make('Par Statut', count($stats['by_statut'] ?? []))
                ->description('Nombre de statuts')
                ->descriptionIcon('heroicon-o-tag')
                ->color('success'),
            Stat::make('Par Cycle', count($stats['by_cycle'] ?? []))
                ->description('Nombre de cycles')
                ->descriptionIcon('heroicon-o-academic-cap')
                ->color('warning'),
        ];
    }
}
