<?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::table('stocks', function (Blueprint $table) {
            $table->decimal('length', 15, 4)->nullable()->after('quantity')->comment('Length of pieces (for manufacturing)');
            $table->string('unit', 50)->nullable()->after('length')->comment('Unit of measurement');
            $table->enum('piece_type', ['complete', 'partial'])->nullable()->after('unit')->comment('Type of piece: complete or partial');
            $table->text('notes')->nullable()->after('piece_type')->comment('Additional notes about the stock');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('stocks', function (Blueprint $table) {
            $table->dropColumn(['length', 'unit', 'piece_type', 'notes']);
        });
    }
};
