<?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::create('produks', function (Blueprint $table) {
            $table->id();
            // Relasi ke Kategori
            $table->foreignId('kategori_id')->constrained('kategori_produks')->onDelete('cascade');
            
            $table->string('nama_produk');
            $table->text('deskripsi')->nullable();
            $table->double('berat');
            $table->string('satuan'); // Contoh: gram, kg, pcs
            $table->string('foto')->nullable();
            $table->decimal('harga', 12, 2); // Contoh: 15000.00
            $table->enum('status', ['aktif', 'nonaktif'])->default('aktif');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('produks');
    }
};
