<?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('productos', function (Blueprint $table) {
            $table->id();
            $table->string('sku')->unique();
            $table->string('nombre');
            $table->foreignId('categoria_id')->constrained('categorias');
            $table->foreignId('marca_producto_id')->nullable()->constrained('marcas_producto');
            $table->foreignId('referencia_celular_id')->nullable()->constrained('referencias_celular');
            $table->foreignId('color_id')->nullable()->constrained('colores');
            $table->foreignId('proveedor_id')->nullable()->constrained('proveedores');
            $table->decimal('precio_costo', 12, 2)->default(0);
            $table->decimal('precio_venta', 12, 2)->default(0);
            $table->integer('stock')->default(0);
            $table->integer('stock_minimo')->default(5);
            $table->tinyInteger('activo')->default(1);
            $table->timestamps();
        });
    }

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