<?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('booking_items', function (Blueprint $table) {
            $table->id();
            $table->foreignId('booking_id')->constrained('bookings')->onDelete('cascade');
            $table->unsignedBigInteger('category_id')->nullable();
            $table->unsignedBigInteger('paper_size_id')->nullable();
            $table->decimal('custom_width', 8, 2)->nullable();
            $table->decimal('custom_height', 8, 2)->nullable();
            $table->string('custom_unit')->nullable();
            $table->unsignedBigInteger('paper_type_id')->nullable();
            $table->unsignedBigInteger('paper_brand_id')->nullable();
            $table->unsignedBigInteger('paper_gsm_id')->nullable();
            $table->unsignedBigInteger('print_type_id')->nullable();
            $table->unsignedBigInteger('color_type_id')->nullable();
            $table->unsignedBigInteger('print_method_id')->nullable();
            $table->unsignedBigInteger('lamination_id')->nullable();
            $table->unsignedBigInteger('lamination_side_id')->nullable();
            $table->unsignedBigInteger('corner_type_id')->nullable();
            $table->unsignedBigInteger('binding_id')->nullable();
            $table->unsignedBigInteger('folding_id')->nullable();
            
            $table->integer('quantity')->default(1);
            $table->integer('extra_copies')->default(0);
            $table->decimal('waste_percentage', 5, 2)->default(0);
            $table->integer('total_quantity')->default(1);
            $table->timestamps();
        });
    }

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