<?php

namespace App\Http\Controllers;

use App\Models\MexcoInvoice;
use App\Services\BillingService;
use Illuminate\Http\Request;
use Illuminate\View\View;

class MexcoSuperAdminBillingController extends Controller
{
    public function __construct(private BillingService $billing) {}

    public function index(Request $request): View
    {
        $stats = $this->billing->dashboardStats();

        $recentInvoices = MexcoInvoice::query()
            ->with(['organisation', 'event', 'license.plan'])
            ->orderByDesc('created_at')
            ->limit(10)
            ->get();

        $status = $request->input('status', '');

        return view('super-admin.billing.index', compact('stats', 'recentInvoices', 'status'));
    }
}
