<?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('formularios', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->text('descripcion');
            $table->string('nombrecompleto');
            $table->string('correo');
            $table->string('celular');
            $table->string('estado')->default('Pendiente');

            $table->foreignId('profesion_id')
                  ->constrained('profesiones');

            $table->foreignId('servicio_id')->nullable()
                  ->constrained('servicios');

            $table->foreignId('modalidad_id')
                  ->constrained('modalidades');
                
            $table->foreignId('profesional_id')->nullable()
                  ->constrained('profesionales')
                  ->onDelete('set null');
            
            $table->foreignId('cliente_id')->nullable()
                  ->constrained('clientes')
                  ->onDelete('set null');
            
            $table->date('fechaenvio');
        });
    }

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