<?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('ad_placements', function (Blueprint $table) {
            $table->id();
            $table->string('name'); // e.g. "Homepage Sidebar Top"
            $table->string('placement_key')->unique(); // e.g. "home_sidebar_top"
            $table->enum('type', ['code', 'image']); // JS Code or Custom Image
            $table->longText('content')->nullable(); // The script tag or image URL
            $table->string('target_url')->nullable(); // Link if it's an image
            $table->string('dimensions')->nullable(); // e.g. "300x250"
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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