<?php

declare(strict_types=1);

namespace App\Filament\Widgets\ManagedEnvironment;

use App\Filament\Resources\FindingExceptionResource;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;

class FindingExceptionStatsOverview extends BaseWidget
{
    protected static bool $isLazy = false;

    protected ?string $pollingInterval = null;

    /**
     * @return array<int, Stat>
     */
    protected function getStats(): array
    {
        $counts = FindingExceptionResource::exceptionStatsForCurrentTenant();

        return [
            Stat::make('Active', $counts['active'])
                ->icon('heroicon-o-check-badge')
                ->color('success'),
            Stat::make('Expiring', $counts['expiring'])
                ->icon('heroicon-o-exclamation-triangle')
                ->color('warning'),
            Stat::make('Expired', $counts['expired'])
                ->icon('heroicon-o-x-circle')
                ->color('danger'),
            Stat::make('Pending approval', $counts['pending'])
                ->icon('heroicon-o-clock')
                ->color('gray'),
        ];
    }
}
