<?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('ads', function (Blueprint $table) {
            $table->id();
            $table->foreignId('ad_set_id')->constrained('ad_sets')->onDelete('cascade');
            $table->string('meta_ad_id')->nullable();
            $table->string('headline');
            $table->text('primary_text');
            $table->text('description')->nullable();
            $table->string('call_to_action');
            $table->string('destination_url')->nullable();
            $table->string('media_type')->default('image'); // image, video, existing_post
            $table->string('media_path')->nullable();
            $table->string('meta_post_id')->nullable();
            $table->string('status')->default('draft'); // draft, active, paused, archived
            $table->timestamps();
        });
    }

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