<?php

namespace App\Filament\Widgets;

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

class StructuresPedagogiquesKPI extends BaseWidget
{
    protected ?string $pollingInterval = '15s';
    
    protected function getStats(): array
    {
        $repository = app(StructurePedagogiqueRepository::class);
        $stats = $repository->getStatistics();
        
        return [
            Stat::make('Total Structures', $stats['total'])
                ->description('Nombre total de structures')
                ->descriptionIcon('heroicon-o-building-library')
                ->color('primary'),
            Stat::make('Total Élèves', $stats['total_eleves'] ?? 0)
                ->description('Nombre total d\'élèves')
                ->descriptionIcon('heroicon-o-users')
                ->color('success'),
            Stat::make('Total Filles', $stats['total_filles'] ?? 0)
                ->description('Nombre total de filles')
                ->descriptionIcon('heroicon-o-user-group')
                ->color('warning'),
        ];
    }
}
