<?php

namespace App\Filament\Widgets;

use App\Models\Application;
use App\Models\ConsultationRequest;
use App\Models\Program;
use App\Models\Scholarship;
use App\Models\University;
use Filament\Support\Icons\Heroicon;
use Filament\Widgets\StatsOverviewWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;

class AdminStatsOverview extends StatsOverviewWidget
{
    protected ?string $heading = 'Operations snapshot';

    protected ?string $description = 'Admissions, content, and lead activity across the platform.';

    protected function getStats(): array
    {
        return [
            Stat::make('Applications', Application::count())
                ->description(Application::where('status', 'submitted')->count().' submitted')
                ->icon(Heroicon::OutlinedClipboardDocumentCheck)
                ->color('primary'),
            Stat::make('Open leads', ConsultationRequest::where('status', 'pending')->count())
                ->description(ConsultationRequest::where('status', 'contacted')->count().' contacted')
                ->icon(Heroicon::OutlinedChatBubbleLeftRight)
                ->color('warning'),
            Stat::make('Published scholarships', Scholarship::where('status', 'published')->count())
                ->description(Scholarship::whereDate('deadline', '>=', now())->count().' active deadlines')
                ->icon(Heroicon::OutlinedTrophy)
                ->color('success'),
            Stat::make('Universities / programs', University::count().' / '.Program::count())
                ->description(Program::where('is_active', true)->count().' active programs')
                ->icon(Heroicon::OutlinedBuildingLibrary)
                ->color('info'),
        ];
    }
}
