<?php

use App\Http\Controllers\Auth\TwoFactorChallengeController;
use App\Http\Controllers\SecuritySettingsController;
use Illuminate\Support\Facades\Route;

Route::middleware('guest')->group(function (): void {
    Route::get('/two-factor-challenge', [TwoFactorChallengeController::class, 'create'])->name('two-factor.challenge');
    Route::post('/two-factor-challenge', [TwoFactorChallengeController::class, 'store'])->middleware('throttle:6,1')->name('two-factor.challenge.store');
});

Route::middleware('auth')->group(function (): void {
    Route::get('/security', [SecuritySettingsController::class, 'show'])->name('security.show');
    Route::post('/security/two-factor/enable', [SecuritySettingsController::class, 'enable'])->middleware('throttle:5,1')->name('security.two-factor.enable');
    Route::post('/security/two-factor/confirm', [SecuritySettingsController::class, 'confirm'])->middleware('throttle:6,1')->name('security.two-factor.confirm');
    Route::post('/security/two-factor/disable', [SecuritySettingsController::class, 'disable'])->middleware('throttle:5,1')->name('security.two-factor.disable');
    Route::post('/security/two-factor/recovery-codes', [SecuritySettingsController::class, 'recoveryCodes'])->middleware('throttle:5,1')->name('security.two-factor.recovery-codes');
});
