<?php

namespace App\Http\Controllers\Platform;

use App\Http\Controllers\Controller;
use App\Models\SaasInvoice;
use App\Models\SaasPayment;
use App\Models\Tenant;

class ReportController extends Controller
{
    public function index()
    {
        $tenantsCount = Tenant::count();
        $totalCollected = SaasPayment::where('status', 'success')->sum('amount');
        $mrr = SaasInvoice::whereIn('status', ['paid', 'issued'])->sum('total');
        $arr = $mrr * 12;

        return view('platform.reports.index', compact('tenantsCount', 'totalCollected', 'mrr', 'arr'));
    }
}
