<?php

use App\Http\Controllers\Admin\Auth\LoginController;
use App\Http\Controllers\Admin\Auth\RegisteredUserController;
use App\Http\Controllers\Admin\BusinessAccountController;
use App\Http\Controllers\Admin\PersonalAccountController;
use App\Http\Controllers\Admin\PlanController;
use Illuminate\Support\Facades\Route;



Route::prefix('admin')->middleware('guest:admin')->group(function () {
    Route::get('register', [RegisteredUserController::class, 'create'])->name('admin.register');
    Route::post('register', [RegisteredUserController::class, 'store']);

    Route::get('login', [LoginController::class, 'create'])->name('admin.login');
    Route::post('login', [LoginController::class, 'store']);
});

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

    Route::get('/dashboard', function () {
        return view('admin.dashboard');
    })->name('dashboard');


    Route::get('/personal-accounts', [PersonalAccountController::class, 'index'])->name('users.personal');
    Route::get('/business-accounts', [BusinessAccountController::class, 'index'])->name('users.business');

    Route::get('/personal-account/{id}', [PersonalAccountController::class, 'show'])->name('users.personal.show');


    Route::resource('plans', PlanController::class);

    // Route::get('/dashboard', [AdminController::class, 'index']);
    // Route::resource('users', UserController::class);
    // Route::resource('vehicles', VehicleController::class);

    Route::post('logout', [LoginController::class, 'destroy'])
        ->name('logout');
});