<?php

namespace App\Http\Controllers\Portal;

use App\Http\Controllers\Controller;
use App\Models\RestaurantTable;
use Illuminate\View\View;

class DashboardController extends Controller
{
    public function index(): View
    {
        $branchId = auth()->user()->active_branch_id;

        $totalTables = RestaurantTable::forBranch($branchId)->count();
        $occupiedTables = RestaurantTable::forBranch($branchId)->where('status', 'occupied')->count();

        return view('portal.dashboard', [
            'user' => auth()->user(),
            'activeBranch' => auth()->user()->activeBranch,
            'totalTables' => $totalTables,
            'occupiedTables' => $occupiedTables,
        ]);
    }
}
