<?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('category_ad_placements', function (Blueprint $table) {
            $table->id();
            $table->text('value');
            $table->foreignId('category_id')->constrained('categories')->cascadeOnDelete();
            $table->foreignId('subcategory_id')->nullable()->constrained('categories')->nullOnDelete();
            $table->boolean('is_active')->default(true);
            $table->enum('priority', ['main', 'sub'])->default('main');
            $table->string('position')->default('below-filter');
            $table->timestamps();
        });
    }

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