<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        $ads = [
            [
                'name' => 'Global - Header Top',
                'placement_key' => 'global_header_top',
                'type' => 'code',
                'content' => '<div style="width:100%;height:90px;background:#f3f4f6;border-bottom:1px dashed #ccc;display:flex;align-items:center;justify-content:center;color:#6b7280;font-size:12px;font-weight:bold;text-transform:uppercase;">Header Top Ad (728x90)</div>',
                'dimensions' => 'Responsive',
                'is_active' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'name' => 'Global - Mobile Sticky Bottom',
                'placement_key' => 'global_sticky_bottom',
                'type' => 'code',
                'content' => '<div style="width:100%;height:50px;background:#f3f4f6;border-top:1px dashed #ccc;display:flex;align-items:center;justify-content:center;color:#6b7280;font-size:12px;font-weight:bold;text-transform:uppercase;">Mobile Sticky (320x50)</div>',
                'dimensions' => '320x50',
                'is_active' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ],
        ];

        DB::table('ad_placements')->insertOrIgnore($ads);
    }

    public function down(): void
    {
        DB::table('ad_placements')->whereIn('placement_key', [
            'global_header_top',
            'global_sticky_bottom'
        ])->delete();
    }
};