<?php

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

Route::name('kitchen.')->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', 'kitchen'])->group(function () {
        Route::get('/', [DashboardController::class, 'index'])->name('dashboard');

        // KDS API Endpoints
        Route::get('api/kots/active', [DashboardController::class, 'activeKots'])->name('api.kots.active');
        Route::post('api/kots/{item}/status', [DashboardController::class, 'updateItemStatus'])->name('api.kots.item.status');
        Route::post('api/kots/ticket/{kot}/status', [DashboardController::class, 'updateKotStatus'])->name('api.kots.ticket.status');
    });
});
