<?php

use App\Http\Controllers\Admin\WebAdminController;
use App\Http\Controllers\Front\FrontController;
use Illuminate\Support\Facades\Route;

Route::get('/', [FrontController::class, 'home'])->name('front.home');
Route::get('/register/customer', [FrontController::class, 'customerRegister'])->name('front.customer.register');
Route::post('/register/customer', [FrontController::class, 'storeCustomer'])->name('front.customer.store');
Route::get('/register/vendor', [FrontController::class, 'vendorRegister'])->name('front.vendor.register');
Route::post('/register/vendor', [FrontController::class, 'storeVendor'])->name('front.vendor.store');

Route::prefix('admin')->group(function () {
    Route::get('/login', [WebAdminController::class, 'login'])->name('admin.login');
    Route::post('/login', [WebAdminController::class, 'authenticate'])->name('admin.authenticate');
    Route::post('/logout', [WebAdminController::class, 'logout'])->name('admin.logout');

    Route::get('/dashboard', [WebAdminController::class, 'dashboard'])->name('admin.dashboard');
    Route::get('/tracking', [WebAdminController::class, 'liveTracking'])->name('admin.tracking');
    Route::get('/reports', [WebAdminController::class, 'reports'])->name('admin.reports');

    Route::get('/module/{module}', [WebAdminController::class, 'moduleIndex'])->name('admin.module.index');
    Route::get('/module/{module}/create', [WebAdminController::class, 'moduleCreate'])->name('admin.module.create');
    Route::post('/module/{module}', [WebAdminController::class, 'moduleStore'])->name('admin.module.store');
    Route::get('/module/{module}/{id}/edit', [WebAdminController::class, 'moduleEdit'])->name('admin.module.edit');
    Route::put('/module/{module}/{id}', [WebAdminController::class, 'moduleUpdate'])->name('admin.module.update');
    Route::delete('/module/{module}/{id}', [WebAdminController::class, 'moduleDestroy'])->name('admin.module.destroy');
});
