<?php

namespace Database\Seeders;

use App\Enums\AdType;
use App\Models\AdPlatform;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

class AdPlatformSeeder extends Seeder
{
    /**
     * Seed platform/marketplace iklan (RPD §3.1).
     * is_active=false = coming soon.
     */
    public function run(): void
    {
        $platforms = [
            // Affiliate — aktif
            ['name' => 'Shopee', 'ad_type' => AdType::Affiliate, 'countries' => 'ID', 'is_active' => true, 'sort_order' => 1],
            ['name' => 'Shopee Food', 'ad_type' => AdType::Affiliate, 'countries' => 'ID', 'is_active' => true, 'sort_order' => 2],
            ['name' => 'Lazada', 'ad_type' => AdType::Affiliate, 'countries' => 'ID,MY,PH,TH', 'is_active' => true, 'sort_order' => 3],
            // Affiliate — coming soon
            ['name' => 'TikTok', 'ad_type' => AdType::Affiliate, 'countries' => 'ID', 'is_active' => false, 'sort_order' => 4],
            ['name' => 'Blibli', 'ad_type' => AdType::Affiliate, 'countries' => 'ID', 'is_active' => false, 'sort_order' => 5],
            ['name' => 'AliExpress', 'ad_type' => AdType::Affiliate, 'countries' => 'ID', 'is_active' => false, 'sort_order' => 6],
            // Link website — aktif (butuh verifikasi)
            ['name' => 'Website UMKM', 'ad_type' => AdType::LinkWebsite, 'countries' => null, 'is_active' => true, 'sort_order' => 10],
            ['name' => 'Banner', 'ad_type' => AdType::LinkWebsite, 'countries' => null, 'is_active' => true, 'sort_order' => 11],
            // Coming soon
            ['name' => 'Backlink / PBN', 'ad_type' => AdType::Backlink, 'countries' => null, 'is_active' => false, 'sort_order' => 20],
            ['name' => 'Press Release Portal Media', 'ad_type' => AdType::PressRelease, 'countries' => null, 'is_active' => false, 'sort_order' => 21],
        ];

        foreach ($platforms as $p) {
            AdPlatform::firstOrCreate(
                ['slug' => Str::slug($p['name'])],
                array_merge($p, ['slug' => Str::slug($p['name'])])
            );
        }
    }
}
