<?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('detail_additionals', function (Blueprint $table) {
            $table->id('id_detail_additional');

            // Foreign Keys
            $table->foreignId('id_booking')->constrained('booking_fotos', 'id_booking')->onDelete('cascade');
            $table->foreignId('id_additional')->constrained('additionals', 'id_additional')->onDelete('cascade');

            $table->integer('qty');
            $table->decimal('subtotal', 12, 2); // Harga Additional * Qty
            $table->timestamps();
        });
    }

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