<?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('reservation_passengers', function (Blueprint $table) {
            $table->id();
            $table->foreignId('reservation_id')->constrained('reservations')->cascadeOnDelete();
            $table->foreignId('passenger_id')->constrained('customer_passengers')->cascadeOnDelete();
            
            // Ekstra alanlar gerekebilir (örneğin bu rezervasyona özel koltuk no, oda no vb.)
            $table->string('room_number')->nullable();
            $table->string('seat_number')->nullable();
            $table->text('special_request')->nullable();
            
            $table->timestamps();
            
            // Bir yolcu aynı rezervasyonda birden fazla kez bulunmasın (opsiyonel ama mantıklı)
            $table->unique(['reservation_id', 'passenger_id']);
        });
    }

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