<?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('bookings', function (Blueprint $table) {
            $table->id();
            $table->string('booking_id');
            $table->foreignId('space_id');
            $table->foreignId('user_id');
            $table->json('billing_details');
            $table->json('facilities')->nullable();
            $table->timestamp('booking_from');
            $table->timestamp('booking_to');
            $table->foreignId('gateway_id')->nullable();
            $table->foreignId('transaction_id')->nullable();
            $table->string('total_amount');
            $table->boolean('is_paid')->default(false);
            $table->enum('status', ['pending', 'booked', 'cancelled']);
            $table->timestamps();
        });
    }

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