<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->string('sku', 50)->unique();
            $table->string('name');
            $table->string('category', 100)->default('Umum');
            $table->string('unit', 50)->default('pcs');
            $table->integer('current_stock')->default(0);
            $table->integer('min_stock')->default(5);
            $table->unsignedBigInteger('buy_price')->default(0);
            $table->unsignedBigInteger('sell_price')->default(0);
            $table->string('barcode', 100)->nullable()->unique();
            $table->text('description')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('products');
    }
};
