<?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('booking_id');
            $table->unsignedBigInteger('customer_id');
            $table->unsignedBigInteger('room_id');
            $table->timestamp('booking_date')->useCurrent();
            $table->string('check_in', 100)->nullable();
            $table->string('check_out', 100);
            $table->integer('total_price');
            $table->integer('remaining_price');
            $table->boolean('payment_status')->default(false);
            
            $table->foreign('customer_id')->references('customer_id')->on('customers');
            $table->foreign('room_id')->references('room_id')->on('rooms');
        });
    }

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