<?php

namespace App\Http\Controllers\Member;

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

// ══════════════════════════════════════════════════════════════════
//  InPractice — DashboardController
//  Location: app/Http/Controllers/Member/DashboardController.php
//
//  Thin controller — follows the Project Bible strictly.
//
//  index() → calls DashboardService → passes data to Vue page
//
//  NO business logic here.
//  NO database queries here.
//  Everything lives in DashboardService.
// ══════════════════════════════════════════════════════════════════

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

    /**
     * Show the member dashboard.
     */
    public function index(Request $request): Response
    {
        $data = $this->dashboardService->getData($request->user());

        return Inertia::render('Member/Dashboard', $data);
    }
}
