<?php

use App\Http\Controllers\Auth\AuthController;
use Illuminate\Support\Facades\Route;

Route::prefix(config('app.admin_slug', 'admin'))->group(function () {
    Route::middleware('guest')->group(function () {
        Route::get('/', [AuthController::class, 'showLogin'])->name('admin.login');
        Route::post('/login', [AuthController::class, 'login'])
            ->defaults('expected_role', 'admin')
            ->middleware('throttle:login')
            ->name('admin.login.submit');
    });

    Route::middleware(['auth', 'verified', 'role:admin'])->name('admin.')->group(function () {
        require __DIR__.'/admin/dashboard.php';
        require __DIR__.'/admin/members.php';
        require __DIR__.'/admin/orders.php';
        require __DIR__.'/admin/income.php';
        require __DIR__.'/admin/wallet.php';
        require __DIR__.'/admin/payments.php';
        require __DIR__.'/admin/settings.php';
        require __DIR__.'/admin/misc.php';
    });
});
