<?php

namespace Functional\Streaks\Http\Controllers;

use Functional\Streaks\Services\DashboardService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

/**
 * Liste complète des badges débloqués par l'utilisateur authentifié.
 */
class AchievementsController
{
    public function __construct(
        private readonly DashboardService $dashboardService,
    ) {
    }

    /** GET /api/achievements */
    public function index(Request $request): JsonResponse
    {
        return response()->json([
            'data' => $this->dashboardService->achievementsList($request->user()),
        ]);
    }
}
