<?php

use Functional\Exercises\Http\Controllers\ExercisesController;
use Functional\Exercises\Http\Controllers\StatsController;
use Illuminate\Support\Facades\Route;

// Routes here are wrapped in the 'api' middleware group with the 'api'
// prefix by the layer service provider. To version your endpoints
// (/api/v1/...), nest Route::prefix('v1')->group(...) inside.

// Catalogue public, lecture seule — aucun middleware d'authentification.
// /facets doit être déclaré avant /{exercise} pour ne pas être capturé par le binding.
Route::get('/exercises/facets', [ExercisesController::class, 'facets']);
Route::get('/exercises', [ExercisesController::class, 'index']);
Route::get('/exercises/{exercise}', [ExercisesController::class, 'show']);

// Stats publiques agrégées (widget Homepage).
Route::get('/stats', StatsController::class);
