<?php

use Functional\Users\Http\Controllers\AuthController;
use Functional\Users\Http\Controllers\OidcController;
use Illuminate\Support\Facades\Route;

// Auth 100% back par cookie de session Sanctum SPA : inscription, login/logout par mot de passe,
// et login OIDC piloté par le back (pocket-id). Le front ne fait que suivre ces routes.
Route::post('register', [AuthController::class, 'register']);
Route::post('login', [AuthController::class, 'login']);
Route::post('logout', [AuthController::class, 'logout'])->middleware('auth');

Route::prefix('auth/oidc')->name('oidc.')->group(function (): void {
    Route::get('redirect', [OidcController::class, 'redirect'])->name('redirect');
    Route::get('callback', [OidcController::class, 'callback'])->name('callback');
});
