<?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('obat_masuks', function (Blueprint $table) {
            // Rename nama_supplier to sumber_dana
            $table->renameColumn('nama_supplier', 'sumber_dana');
            
            // Add new fields
            $table->string('barcode')->nullable()->after('kode_batch');
            $table->string('no_sbbk')->nullable()->after('no_faktur');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('obat_masuks', function (Blueprint $table) {
            $table->dropColumn(['barcode', 'no_sbbk']);
            $table->renameColumn('sumber_dana', 'nama_supplier');
        });
    }
};
