<?php

/*
|--------------------------------------------------------------------------
| Waiter Routes
|--------------------------------------------------------------------------
*/

use App\Http\Controllers\Waiter\AuthController;
use App\Http\Controllers\Waiter\DashboardController;
use Illuminate\Support\Facades\Route;

Route::name('waiter.')->group(function () {
    Route::get('login', [AuthController::class, 'login'])->name('login');
    Route::post('login', [AuthController::class, 'authenticate']);
    Route::post('logout', [AuthController::class, 'logout'])->name('logout');

    Route::middleware(['auth', 'waiter'])->group(function () {
        Route::get('/', [DashboardController::class, 'index'])->name('dashboard');

        // Waiter API Endpoints
        Route::get('api/tables', [DashboardController::class, 'getTables'])->name('api.tables');
        Route::get('api/categories', [DashboardController::class, 'getCategories'])->name('api.categories');
        Route::get('api/items', [DashboardController::class, 'getItems'])->name('api.items');
        Route::get('api/deals', [DashboardController::class, 'getDeals'])->name('api.deals');
        Route::get('api/order/{table}', [DashboardController::class, 'getOrder'])->name('api.order');
        Route::post('api/order/kot', [DashboardController::class, 'submitKot'])->name('api.order.kot');
        Route::post('api/order/item/serve', [DashboardController::class, 'serveItem'])->name('api.order.item.serve');
    });
});
