<?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('categories', function (Blueprint $table) {
            $table->id();
            $table->boolean('is_enabled')->default(false);
            $table->string('name');
            $table->text('description');
            $table->vector('embedding', 384);

            // Nested set model columns (Kalnoy NestedSet)
            $table->nestedSet();

            // Nullable columns for category/subcategory-specific fields
            $table->json('subcategories')->nullable();
            $table->json('meme_angles')->nullable();
            $table->json('sample_captions')->nullable();
            $table->json('keywords')->nullable();

            // Store original JSON payload
            $table->json('payload');

            $table->timestamps();
        });
    }

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