<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Partner;

class PartnerSeeder extends Seeder
{
    /**
     * Seed data logo mitra / asosiasi untuk ditampilkan di beranda.
     * Menggunakan URL logo dari CDN publik (SimpleIcons / logo.clearbit.com).
     */
    public function run(): void
    {
        // Kosongkan tabel terlebih dahulu agar tidak duplikasi
        Partner::truncate();

        $partners = [
            // ── Payment Gateways ────────────────────────────────────────────
            [
                'name'       => 'BCA',
                'logo'       => 'https://upload.wikimedia.org/wikipedia/commons/5/5c/Bank_Central_Asia.svg',
                'link'       => null,
                'sort_order' => 1,
            ],
            [
                'name'       => 'Mandiri',
                'logo'       => 'https://upload.wikimedia.org/wikipedia/commons/a/ad/Bank_Mandiri_logo_2016.svg',
                'link'       => null,
                'sort_order' => 2,
            ],
            [
                'name'       => 'GoPay',
                'logo'       => 'https://upload.wikimedia.org/wikipedia/commons/8/86/Gopay_logo.svg',
                'link'       => null,
                'sort_order' => 3,
            ],
            [
                'name'       => 'OVO',
                'logo'       => 'https://upload.wikimedia.org/wikipedia/commons/e/eb/Logo_ovo_purple.svg',
                'link'       => null,
                'sort_order' => 4,
            ],
            [
                'name'       => 'Dana',
                'logo'       => 'https://upload.wikimedia.org/wikipedia/commons/7/72/Logo_dana_blue.svg',
                'link'       => null,
                'sort_order' => 5,
            ],
            // ── Logistics / Ekspedisi ────────────────────────────────────────
            [
                'name'       => 'JNE',
                'logo'       => 'partners/jne.svg',
                'link'       => 'https://jne.co.id',
                'sort_order' => 6,
            ],
            [
                'name'       => 'J&T Express',
                'logo'       => 'partners/jnt.svg',
                'link'       => 'https://jtexpress.id',
                'sort_order' => 7,
            ],
            [
                'name'       => 'SiCepat',
                'logo'       => 'partners/sicepat.svg',
                'link'       => 'https://sicepat.com',
                'sort_order' => 8,
            ],
        ];

        foreach ($partners as $data) {
            Partner::create($data);
        }

        $this->command->info('✅ PartnerSeeder: ' . count($partners) . ' logo mitra berhasil ditambahkan.');
    }
}
