<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class PaymentMethodSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $methods = [
            [
                'name' => 'Cash on Delivery',
                'slug' => 'cod',
                'type' => 'cod',
                'logo' => 'https://cdn-icons-png.flaticon.com/512/2331/2331941.png', // Placeholder
                'is_active' => true,
            ],
            [
                'name' => 'Credit/Debit Card',
                'slug' => 'card',
                'type' => 'stripe',
                'logo' => 'https://cdn-icons-png.flaticon.com/512/179/179457.png',
                'is_active' => true,
                'config' => [
                    'stripe_mode' => 'sandbox',
                    'stripe_sandbox_publishable_key' => 'pk_test_placeholder',
                    'stripe_sandbox_secret_key' => 'sk_test_placeholder',
                    'stripe_live_publishable_key' => '',
                    'stripe_live_secret_key' => '',
                ],
            ],
            [
                'name' => 'PayPal',
                'slug' => 'paypal',
                'type' => 'paypal',
                'logo' => 'https://cdn-icons-png.flaticon.com/512/174/174861.png',
                'is_active' => true,
                'config' => [
                    'paypal_mode' => 'sandbox',
                    'paypal_sandbox_client_id' => 'sb-client-id-placeholder',
                    'paypal_sandbox_secret' => 'sb-secret-placeholder',
                    'paypal_live_client_id' => '',
                    'paypal_live_secret' => '',
                ],
            ],
            [
                'name' => 'Razorpay',
                'slug' => 'razorpay',
                'type' => 'razorpay',
                'logo' => 'https://cdn.iconscout.com/icon/free/png-256/free-razorpay-logo-icon-download-in-svg-png-gif-file-formats--payment-gateway-brand-logos-icons-1399875.png',
                'is_active' => true,
                'config' => ['razorpay_key_id' => 'rzp_test_placeholder'],
            ]
        ];

        foreach ($methods as $method) {
            \App\Models\PaymentMethod::updateOrCreate(
                ['slug' => $method['slug']],
                $method
            );
        }
    }
}
