<?php

namespace App\Http\Controllers;

use App\Services\DashboardService;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

class DashboardController extends Controller
{
    public function __construct(
        private DashboardService $service
    ) {}

    public function __invoke(Request $request): Response
    {
        $user = $request->user();

        return Inertia::render('dashboard', [
            'attendance' => $this->service->getAttendanceStats($user),
            'revenueSummary' => $this->service->getRevenueSummary($user),
            'expenseSummary' => $this->service->getExpenseSummary($user),
            'orderStats' => $this->service->getOrderStats($user),
            'todayAttendance' => $this->service->getTodayAttendance($user),
            'isOnLeave' => $this->service->isOnLeave($user),
            'canCheckIn' => $user->employee !== null,
        ]);
    }
}
