<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void {
        Schema::create('quotation_items', function (Blueprint $t) {
            $t->id(); $t->foreignId('quotation_id')->constrained()->cascadeOnDelete();
            $t->foreignId('product_id')->nullable()->constrained()->nullOnDelete(); $t->string('description');
            $t->decimal('quantity',12,2)->default(1); $t->decimal('unit_price',12,2)->default(0);
            $t->decimal('discount',12,2)->default(0); $t->decimal('tax_rate',6,2)->default(0);
            $t->decimal('line_total',12,2)->default(0); $t->timestamps();
        });
    }
    public function down(): void { Schema::dropIfExists('quotation_items'); }
};
