<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CurrentTeamController;
use App\Http\Controllers\Livewire\ApiTokenController;
use App\Http\Controllers\Livewire\TeamController;
use App\Http\Controllers\Livewire\UserProfileController;
use App\Http\Main\Engineers\Drive\Create;
use App\Http\Main\Engineers\Drive\Find;
use App\Http\Main\Engineers\Drive\Index;
use App\Http\Main\Test;
use App\Helpers\MainHelper;
use App\Http\Controllers\ClientController;
use App\Http\Dashboard;
use App\Models\Team;
use Illuminate\Support\Facades\Auth;
use Laravel\Fortify\Fortify;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

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

Fortify::loginView(function () {
    return view('auth.login');
});

Fortify::registerView(function () {
    return view('auth.register');
});
Fortify::requestPasswordResetLinkView(function () {
    return view('auth.forgot-password');
});
Fortify::resetPasswordView(function ($request) {
    return view('auth.reset-password', ['request' => $request]);
});
// Fortify::verifyEmailView(function () {
//     return view('auth.verify-email');
// });

Route::get('/users/login', App\Http\Main\Users\Index::class)->name('users.index');

Route::post('/users/login', [App\Http\Controllers\User\Login::class, 'index']);
Route::post('logout', [ClientController::class, 'logout'])->name('logout');

Route::group(['middleware' => ['auth:sanctum']], function () {

    Route::get('/', Test::class)->name('index');
    Route::get('admin/', Test::class)->name('index');

    Route::get('/users/drives/{id}', App\Http\Main\Users\Show::class)->name('user');
    Route::get('/users/drives', App\Http\Main\Users\Drives::class)->name('user.drives');
    Route::get('users/messages', App\Http\Main\Engineers\Messages\SendMessage::class)->name('messages');













    Route::group(['middleware' => ['frontdesk'], 'prefix' => 'frontdesk'], function () {
        Route::get('/', App\Http\Main\Frontdesk\Find::class)->name('dashboard');
        Route::get('/dashboard', App\Http\Main\Frontdesk\Find::class)->name('dashboard');
        Route::get('/drives', App\Http\Main\Engineers\Drive\Index::class)->name('drives');
        Route::get('/drives/create', App\Http\Main\Engineers\Drive\Create::class)->name('drives.create');
        Route::post('/drives/create', [App\Http\Controllers\Drives\Create::class, 'index'])->name('drives.create');
        Route::get('/drives/find', App\Http\Main\Engineers\Drive\Find::class)->name('drives.find');
        Route::get('/users/create', App\Http\Main\Users\Create::class)->name('users.create');
        Route::get('/users/find', App\Http\Main\Users\Find::class)->name('users.find');
        Route::get('/drives/{id}', App\Http\Main\Users\Show::class);
        Route::get('/messages', App\Http\Main\Engineers\Messages\SendMessage::class)->name('messages');
        Route::get('/messages/alert', App\Http\Main\Engineers\Messages\Alert::class)->name('messages.alert');
    });

    Route::group(['middleware' => ['engineer'], 'prefix' => 'engineers'], function () {
        Route::get('/', Dashboard::class)->name('dashboard');
        Route::get('/dashboard', Dashboard::class)->name('dashboard');
        Route::get('/drives', App\Http\Main\Engineers\Drive\Index::class)->name('drives');
        Route::get('/drives/create', App\Http\Main\Engineers\Drive\Create::class)->name('drives.create');
        Route::post('/drives/create', [App\Http\Controllers\Drives\Create::class, 'index'])->name('drives.create');
        Route::get('/drives/find', App\Http\Main\Engineers\Drive\Find::class)->name('drives.find');


        Route::get('/donors', App\Http\Main\Engineers\Donor\Index::class)->name('donors');
        Route::get('/donors/create', App\Http\Main\Engineers\Donor\Create::class)->name('donors.create');
        Route::post('/donors/create', App\Http\Main\Engineers\Donor\Create::class)->name('donors.create');
        Route::get('/donors/find', App\Http\Main\Engineers\Donor\Find::class)->name('donors.find');
        Route::get('/donors/{id}', App\Http\Main\Engineers\Donor\Show::class);
        Route::get('/donors/{id}/edit', App\Http\Main\Engineers\Donor\Edit::class);
        


        Route::get('/users/create', App\Http\Main\Users\Create::class)->name('users.create');
        Route::get('/users/find', App\Http\Main\Users\Find::class)->name('users.find');
        Route::get('/messages', App\Http\Main\Engineers\Messages\SendMessage::class)->name('messages');
        Route::get('/messages/alert', App\Http\Main\Engineers\Messages\Alert::class)->name('messages.alert');
        Route::get('/drives/{id}', App\Http\Main\Users\Show::class);
        Route::get('/drives/{id}/edit', App\Http\Main\Engineers\Drive\Edit::class);
    });
});
