<?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('products', function (Blueprint $table) {
            $table->id();
            $table->enum('type', ['bike', 'accessory', 'clothing', 'spare', 'children', 'skate', 'rollers','other']); 
            $table->text('name')->nullable();
            $table->text('description')->nullable();;
            $table->decimal('price', 10, 2); // Precio 
            $table->decimal('cost', 10, 2)->nullable(); // Costo
            $table->integer('stock_quantity')->default(100);
            $table->integer('min_stock_alert')->default(5); // Alerta
            $table->foreignId('suppliers_id')->constrained()->default(1);
            $table->timestamps();
        });
    }

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