<?php
use App\Http\Controllers\Admin\AuthController;
use App\Http\Controllers\Admin\MemberController;
use Illuminate\Support\Facades\Route;

Route::prefix('admin')->name('admin.')->group(function () {

    // Login
    Route::get('login',  [AuthController::class, 'showLogin'])->name('login');
    Route::post('login', [AuthController::class, 'login'])->name('login.post');
    Route::post('logout',[AuthController::class, 'logout'])->name('logout');

    // Protected
    Route::middleware('admin.auth')->group(function () {
        Route::get('dashboard',            [MemberController::class, 'dashboard'])->name('dashboard');
        Route::get('members',              [MemberController::class, 'index'])->name('members.index');
        Route::get('members/export/csv',   [MemberController::class, 'exportCsv'])->name('members.export');
        Route::get('members/{id}',         [MemberController::class, 'show'])->name('members.show');
        Route::delete('members/{id}',      [MemberController::class, 'destroy'])->name('members.destroy');
    });
});
