<?php

use Functional\Tracking\Http\Controllers\BodyMetricsController;
use Functional\Tracking\Http\Controllers\HistoryController;
use Functional\Tracking\Http\Controllers\SessionsController;
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.

// Scopées à l'utilisateur authentifié (auth()->id()).
Route::middleware('auth:sanctum')->group(function () {
    Route::post('/sessions', [SessionsController::class, 'store']);
    Route::get('/sessions/{session}', [SessionsController::class, 'show']);
    Route::post('/sessions/{session}/sets', [SessionsController::class, 'storeSet']);
    Route::post('/sessions/{session}/complete', [SessionsController::class, 'complete']);

    Route::get('/history', [HistoryController::class, 'index']);

    Route::get('/metrics', [BodyMetricsController::class, 'index']);
    Route::post('/metrics', [BodyMetricsController::class, 'store']);
});
