<?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('meals', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('slug')->unique();
            $table->text('description');
            $table->string('image')->nullable();
            $table->enum('category', ['breakfast', 'lunch', 'dinner', 'snack']);
            $table->json('tags')->nullable();               // ["high-protein", "keto"]
            $table->json('dietary_info')->nullable();        // ["vegetarian", "gluten-free"]
            $table->json('allergens')->nullable();           // ["nuts", "dairy"]
            $table->integer('calories')->nullable();
            $table->decimal('protein', 5, 1)->nullable();
            $table->decimal('carbs', 5, 1)->nullable();
            $table->decimal('fat', 5, 1)->nullable();
            $table->integer('prep_time_minutes')->nullable();
            $table->boolean('is_available')->default(true);
            $table->timestamps();
        });
    }

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