<?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('name');
            $table->string('slug')->unique();
            $table->text('description')->nullable();
            $table->decimal('price', 10, 2);
            $table->string('unit')->nullable();
            $table->decimal('unit_price', 10, 2)->nullable();
            $table->string('image_url')->nullable();
            $table->string('nutri_score')->nullable();
            $table->json('tags')->nullable();
            $table->json('nutrition')->nullable();
            $table->json('preparation')->nullable();
            $table->text('ingredients')->nullable();
            $table->text('allergens_info')->nullable();
            $table->string('brand')->nullable();
            $table->decimal('discount', 5, 2)->nullable();
            $table->decimal('original_price', 10, 2)->nullable();
            $table->unsignedBigInteger('category_id')->nullable();
            $table->boolean('is_active')->default(true);
            $table->boolean('is_save_the_food')->default(false);
            $table->boolean('is_weekly_special')->default(false);
            $table->timestamps();
        });
    }
    public function down(): void {
        Schema::dropIfExists('products');
    }
};
