<?php

namespace App\Http\Controllers;

use App\Models\Event;
use App\Models\Offer;
use App\Models\Ride;

class HomeController extends Controller
{
    public function __invoke()
    {
        return view('home', [
            'featuredOffers' => Offer::query()->where('status', 'published')->orderByDesc('is_featured')->orderByDesc('priority_score')->take(3)->get(),
            'metrics' => [
                'rides' => Ride::count(),
                'views' => Event::where('event_type', 'recommendation_viewed')->count(),
                'bookings' => Event::where('event_type', 'booking_completed')->count(),
            ],
        ]);
    }
}
