<?php

use App\Http\Controllers\ProfileController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\AdminController;
use Illuminate\Support\Facades\Route;

// Route::get('/', function () {
//     return view('front.index');
// })->name('home');

Route::get('/', [HomeController::class, 'home'])->name('home');
Route::get('/add-property', [HomeController::class, 'addProperty'])->name('property.add');
Route::post('/submit-property', [HomeController::class, 'submitProperty'])->name('property.submit');
Route::get('/user-property-list', [HomeController::class, 'listPropertyUser'])->name('property.listing.user');

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

Route::prefix('admin')->group(function () {
    Route::get('/login', [AdminController::class, 'login'])->name('admin.login');
    Route::get('/dashboard', [AdminController::class, 'dashboard'])->name('admin.dashboard');
    Route::get('/user-listing', [AdminController::class, 'userList'])->name('admin.userList');
    Route::get('/property-listing', [AdminController::class, 'propertyList'])->name('admin.propertyList');
});

require __DIR__.'/auth.php';
