<?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('variante_piatto', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('attivita_id')->unsigned();
            $table->bigInteger('piatto_id')->unsigned()->nullable();
            $table->string('label')->nullable();
            $table->decimal('prezzo', 10, 2)->nullable();
            $table->boolean('is_attivo')->default(true);
            $table->bigInteger('cucina_id')->unsigned()->nullable();
            $table->timestamps();
        });
        Schema::table('variante_piatto', function (Blueprint $table) {
            $table->foreign('attivita_id')->references('id')->on('attivita');
            $table->foreign('piatto_id')->references('id')->on('piatto');
            $table->foreign('cucina_id')->references('id')->on('cucina');
        });
    }

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