<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('prenotazione', function (Blueprint $table) {
            $table->id();
            $table->string('nome');
            $table->string('cognome');
            $table->string('email');
            $table->string('telefono');
            $table->bigInteger('evento_id')->unsigned()->nullable();
            $table->bigInteger('cucina_id')->unsigned()->nullable();
            $table->string('stato')->nullable();
            $table->string('note')->nullable();
            $table->string('codice')->unique()->nullable();
            $table->string('stato_pagamento')->nullable();
            $table->string('metodo_pagamento')->nullable();
            $table->timestamps();
        });

        Schema::table('prenotazione', function (Blueprint $table) {
            $table->foreign('cucina_id')->references('id')->on('cucina')->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('prenotazione');
    }
};
