<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('kots', function (Blueprint $table) {
            $table->id();
            $table->foreignId('branch_id')->constrained()->cascadeOnDelete();
            $table->foreignId('order_id')->constrained()->cascadeOnDelete();
            $table->foreignId('waiter_id')->nullable()->constrained('users')->nullOnDelete();

            $table->string('status')->default('pending'); // pending, cooking, ready, completed

            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('kots');
    }
};
