<?php

namespace App\Http\Controllers;

use App\Models\Pasien;
use App\Models\PemeriksaanKesehatan;
use App\Models\EmbeddingWajah;
use Illuminate\Http\Request;

class WelcomeController extends Controller
{
    public function index()
    {
        $stats = [
            'total_pasien'         => Pasien::count(),
            'pasien_hari_ini'      => Pasien::whereDate('created_at', today())->count(),
            'pemeriksaan_hari_ini' => PemeriksaanKesehatan::count(),
            'demam_hari_ini'       => PemeriksaanKesehatan::whereIn('kategori_suhu', [
                                        'DEMAM_RINGAN', 'DEMAM_SEDANG', 'DEMAM_TINGGI'
                                      ])->count(),
            'perlu_review'         => \App\Models\AnalisisAi::where('ditinjau_dokter', false)->count(),
        ];

        $recentPatients = Pasien::latest()->take(5)->get();
        $faceStatus = EmbeddingWajah::latest()->first();

        // WelcomeController.php - method index()
$notifications = collect([
    (object)['icon' => 'bell', 'title' => 'Sistem Aktif', 'message' => 'Semua sistem berjalan normal', 'time' => 'Baru saja'],
    (object)['icon' => 'user-md', 'title' => 'Dokter Tersedia', 'message' => '5 dokter sedang bertugas', 'time' => '5 menit lalu'],
]);

        return view('welcome', compact('stats', 'recentPatients', 'faceStatus',  'notifications'));
    }
}