<?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('pases', function (Blueprint $table) {
            $table->id('id_pase');
            $table->char('id_jugador', 36)->nullable();
            $table->integer('id_club_origen')->nullable();
            $table->integer('id_club_destino')->nullable();
            $table->string('estado')->default('Pendiente'); // Pendiente, Aprobado, Rechazado
            
            // Si la FK en jugadores es de tipo uuid, usamos char(36)
            $table->foreign('id_jugador')->references('id_jugador')->on('jugadores')->onDelete('cascade');
            $table->foreign('id_club_origen')->references('id_club')->on('clubes')->onDelete('cascade');
            $table->foreign('id_club_destino')->references('id_club')->on('clubes')->onDelete('cascade');
            
            $table->timestamps();
        });
    }

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