<?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();
            // Nyambungkeun ka tabel categories
            $table->foreignId('category_id')->constrained('categories')->onDelete('cascade');
            $table->string('api_code')->unique(); // Ieu jang buyer_sku_code ti Digiflazz
            $table->string('name');
            $table->integer('base_price'); // Harga ti Digiflazz
            $table->integer('selling_price'); // Harga jual sanggeus markup
            $table->string('stock_status')->default('available');
            $table->timestamps();
        });
    }

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