<?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('supplier_opening_stocks', function (Blueprint $table) {
            $table->id();
            $table->string('product_id');
            $table->string('supplier_id')->nullable();
            $table->string('warehouse_id')->nullable();
            $table->string('attribute_id');
            $table->integer('quantity');
            $table->string('pack_price')->nullable();
            $table->string('pack_qty')->nullable();
            $table->decimal('unit_price', 20, 2);
            $table->decimal('tp_price', 20, 2)->nullable();
            $table->decimal('mrp_price', 20, 2)->nullable();
            $table->decimal('tp_price_total', 20, 2)->nullable();
            $table->decimal('mrp_price_total', 20, 2)->nullable();
            $table->decimal('unit_price_total', 20, 2)->nullable();
            $table->string('opening_stock')->nullable();
            $table->string('opening_stock_date')->nullable();
            $table->string('mfg_date')->nullable();
            $table->string('exp_date')->nullable();
            $table->string('batch_no')->nullable();
            $table->unsignedBigInteger('transition_location_id')->nullable(); // or whatever default
            $table->unsignedBigInteger('transition_create_by')->nullable(); // user ID
            $table->unsignedBigInteger('transition_update_by')->nullable(); // user ID

            $table->timestamps();
        });
    }

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