<?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('package_bookings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->foreignId('package_id')->constrained('destinations')->onDelete('cascade');
            
            // Customer information
            $table->string('customer_name');
            $table->string('customer_email');
            $table->string('customer_phone');
            $table->text('customer_address')->nullable();
            $table->text('special_requests')->nullable();
            
            // Booking details
            $table->date('start_date');
            $table->date('end_date');
            $table->integer('adults')->default(1);
            $table->integer('children')->default(0);
            
            // Pricing information
            $table->decimal('base_price', 10, 2);
            $table->decimal('total_price', 10, 2);
            $table->string('currency')->default('USD');
            
            // Payment information
            $table->string('payment_method')->default('stripe');
            $table->string('payment_status')->default('pending');
            $table->string('transaction_id')->nullable();
            $table->text('payment_details')->nullable();
            
            // Booking status
            $table->string('booking_status')->default('confirmed');
            $table->string('booking_reference')->unique();
            
            $table->timestamps();
            $table->softDeletes();
        });
    }

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