<?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('products', function (Blueprint $table) {
            // Kita set default 'trading' agar semua barang lama Anda otomatis dianggap barang dagangan biasa
            $table->enum('product_type', ['trading', 'raw_material', 'consumable','finished_good'])
                  ->default('trading')
                  ->after('category_id')
                  ->comment('trading=Beli & Jual, raw_material=Hanya Beli & Produksi (Sembunyi di Kasir), consumable=Hanya Beli & Produksi (Sembunyi di Kasir), finished_good=Hasil Produksi & Jual');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn('product_type');
        });
    }
};