<?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('evento_form', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('evento_id')->nullable();
            $table->integer('ordine_visualizzazione')->default(0)->nullable();
            $table->string('label', 255)->nullable();
            $table->text('descrizione')->nullable();
            $table->boolean('obbligatoria')->default(false)->nullable();
            $table->boolean('nascosta')->default(false)->nullable();
            $table->string('tipo', 255)->nullable();
            $table->decimal('costo', 10, 2)->nullable();
            $table->integer('posti_disponibili')->default(0)->nullable();
            $table->boolean('nascondi_se_auth')->default(0)->nullable();
            $table->text('opzioni')->nullable();
            $table->integer('remote_id')->nullable();
            $table->boolean('posti_definiti_opzioni')->default(0)->nullable();
            $table->timestamps();
        });

        Schema::table('evento_form', function (Blueprint $table) {
            $table->foreign('evento_id')->references('id')->on('evento')->onDelete('cascade');
        });
   

    }

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