<?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('stock_ledgers', function (Blueprint $table) {
            $table->string('unit', 50)->nullable()->after('piece_quantity')->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 ledger entry');
        });
    }

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