<?php

use Illuminate\Support\Facades\Route;
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController;
use Laravel\Fortify\Http\Controllers\ConfirmablePasswordController;
use Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController;
use Laravel\Fortify\Http\Controllers\EmailVerificationPromptController;
use Laravel\Fortify\Http\Controllers\NewPasswordController;
use Laravel\Fortify\Http\Controllers\PasswordController;
use Laravel\Fortify\Http\Controllers\PasswordResetLinkController;
use Laravel\Fortify\Http\Controllers\ProfileInformationController;
use Laravel\Fortify\Http\Controllers\RecoveryCodeController;
use Laravel\Fortify\Http\Controllers\RegisteredUserController;
use Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController;
use Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController;
use Laravel\Fortify\Http\Controllers\TwoFactorRecoveryCodeController;
use Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController;
use Laravel\Fortify\Http\Controllers\VerifyEmailController;

// -------------------
// Authentication
// -------------------
// Route::get('/login', [AuthenticatedSessionController::class, 'create'])
//     ->middleware(['guest'])
//     ->name('login');

Route::post('/login', [AuthenticatedSessionController::class, 'store'])
    ->middleware(['guest']);

// Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
//     ->middleware(['auth'])
//     ->name('logout');

// -------------------
// Registration
// -------------------
// Route::get('/register', [RegisteredUserController::class, 'create'])
//     ->middleware(['guest'])
//     ->name('register');

Route::post('/register', [RegisteredUserController::class, 'store'])
    ->middleware(['guest']);

// -------------------
// Password Reset
// -------------------
// Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
//     ->middleware(['guest'])
//     ->name('password.request');

// Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
//     ->middleware(['guest'])
//     ->name('password.email');

// Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
//     ->middleware(['guest'])
//     ->name('password.reset');

// Route::post('/reset-password', [NewPasswordController::class, 'store'])
//     ->middleware(['guest'])
//     ->name('password.update');

// -------------------
// Email Verification
// -------------------
Route::get('/email/verify', [EmailVerificationPromptController::class, '__invoke'])
    ->middleware(['auth'])
    ->name('verification.notice');

// Route::get('/email/verify/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
//     ->middleware(['auth', 'signed', 'throttle:6,1'])
//     ->name('verification.verify');

Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
    ->middleware(['auth', 'throttle:6,1'])
    ->name('verification.send');

// -------------------
// Password Confirmation
// -------------------
Route::get('/user/confirm-password', [ConfirmablePasswordController::class, 'show'])
    ->middleware(['auth'])
    ->name('password.confirm');

Route::post('/user/confirm-password', [ConfirmablePasswordController::class, 'store'])
    ->middleware(['auth']);

// -------------------
// Profile & Password Update
// -------------------
Route::put('/user/password', [PasswordController::class, 'update'])
    ->middleware(['auth'])
    ->name('user-password.update');

Route::put('/user/profile-information', [ProfileInformationController::class, 'update'])
    ->middleware(['auth'])
    ->name('user-profile-information.update');

// -------------------
// Two-Factor Authentication
// -------------------
Route::get('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'create'])
    ->middleware(['guest'])
    ->name('two-factor.login');

Route::post('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'store'])
    ->middleware(['guest']);

Route::post('/user/two-factor-authentication', [TwoFactorSecretKeyController::class, 'store'])
    ->middleware(['auth'])
    ->name('two-factor.enable');

Route::delete('/user/two-factor-authentication', [TwoFactorSecretKeyController::class, 'destroy'])
    ->middleware(['auth'])
    ->name('two-factor.disable');

Route::get('/user/two-factor-qr-code', [TwoFactorQrCodeController::class, 'show'])
    ->middleware(['auth'])
    ->name('two-factor.qr-code');

Route::get('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'index'])
    ->middleware(['auth'])
    ->name('two-factor.recovery-codes');

Route::post('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'store'])
    ->middleware(['auth']);
