<?php

use App\Http\Livewire\Pages\Admin\Auth\Login as AdminLogin;
use App\Http\Livewire\Pages\Admin\Auth\Logout as AdminLogout;
use App\Http\Livewire\Pages\Admin\Chat;
use App\Http\Livewire\Pages\Admin\Home;
use App\Http\Livewire\Pages\Admin\Listing;
use App\Http\Livewire\Pages\Admin\Upload;
use App\Http\Livewire\Pages\Auth\ForgotPassword;
use App\Http\Livewire\Pages\Auth\Login;
use App\Http\Livewire\Pages\Auth\Logout;
use App\Http\Livewire\Pages\Auth\Register;
use App\Http\Livewire\Pages\Auth\ResetPassword;
use App\Http\Livewire\Pages\Index;
use App\Http\Livewire\Pages\Main\AboutUs;
use App\Http\Livewire\Pages\Main\Cars;
use App\Http\Livewire\Pages\Main\CarDetail;
use App\Http\Livewire\Pages\Main\HowItWorks;
use App\Http\Livewire\Pages\Main\CarFinancing;
use App\Http\Livewire\Pages\Main\CarAudit;
use App\Http\Livewire\Pages\Main\CarDelivery;
use App\Http\Livewire\Pages\Main\ElectricHybridVehicles;
use App\Http\Livewire\Pages\Main\Orders;
use App\Http\Livewire\Pages\Main\Payment;
use App\Http\Livewire\Pages\Main\Terms;
use App\Http\Livewire\Pages\Main\Warranty;
use Illuminate\Support\Facades\Route;


Route::get('/', Index::class)->name('home');

Route::get('/cars/{category?}', Cars::class)->name('cars');
Route::get('/car/{id}', CarDetail::class)->name('car-detail');

Route::get('/how-it-works', HowItWorks::class)->name('how-it-works');
Route::get('/car-financing', CarFinancing::class)->name('car-financing');
Route::get('/caraudit', CarAudit::class)->name('caraudit');
Route::get('/warranty', Warranty::class)->name('warranty');
Route::get('/car-delivery', CarDelivery::class)->name('car-delivery');
Route::get('/electric-hybrid-vehicles', ElectricHybridVehicles::class)->name('electric-hybrid-vehicles');
Route::get('/about-us', AboutUs::class)->name('about-us');
Route::get('/terms-of-use', Terms::class)->name('terms');

Route::middleware('guest')->group(function() {
    Route::get('/register', Register::class)->name('register');
    Route::get('/login', Login::class)->name('login');
    Route::get('/forgot_password', ForgotPassword::class)->name('password.email');
    Route::get('/reset_password/{token}', ResetPassword::class)->name('password.reset');
});

Route::middleware('auth')->group(function() {
    Route::get('/logout', Logout::class)->name('logout');
    Route::get('/payment/{order_id}', Payment::class)->name('payment');
    Route::get('/orders', Orders::class)->name('orders');
});

Route::prefix('/admin')->group(function() {
    Route::get('/auth', AdminLogin::class)->name('admin.auth');

    Route::middleware('admin')->group(function() {
        Route::get('/logout', AdminLogout::class)->name('admin.logout');

        Route::get('/home', Home::class)->name('admin');
        Route::get('/chat', Chat::class)->name('admin.chat');
        Route::get('/listing', Listing::class)->name('admin.listing');
        Route::get('/upload/{id?}', Upload::class)->name('admin.upload');
    });
});