<?php

declare(strict_types=1);

namespace Database\Seeders;

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

class PaymentMethodSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $paymentMethods = [
            [
                'type' => 'bank_transfer',
                'gateway_type' => 'manual',
                'name' => 'Bank Transfer',
                'is_active' => true,
                'configuration' => [
                    'bank_name' => 'Example Bank',
                    'account_name' => 'Google Reviews',
                    'account_number' => '1234567890',
                    'routing_number' => '123456789',
                    'swift_code' => 'EXAMPXXX',
                    'instructions' => 'Please transfer the exact amount and upload your receipt.',
                ],
                'display_order' => 1,
                'image_path' => null,
                'processing_time' => '1-3 business days',
                'requires_proof' => true,
                'min_amount' => 10.00,
                'max_amount' => null,
            ],
            [
                'type' => 'crypto',
                'gateway_type' => 'manual',
                'name' => 'Cryptocurrency',
                'is_active' => true,
                'configuration' => [
                    'supported_currencies' => [
                        [
                            'code' => 'BTC',
                            'name' => 'Bitcoin',
                            'wallet_address' => '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
                            'network' => 'Bitcoin',
                        ],
                        [
                            'code' => 'ETH',
                            'name' => 'Ethereum',
                            'wallet_address' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
                            'network' => 'Ethereum (ERC-20)',
                        ],
                        [
                            'code' => 'USDT',
                            'name' => 'Tether',
                            'wallet_address' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
                            'network' => 'Ethereum (ERC-20)',
                        ],
                        [
                            'code' => 'BNB',
                            'name' => 'Binance Coin',
                            'wallet_address' => 'bnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2',
                            'network' => 'Binance Smart Chain',
                        ],
                        [
                            'code' => 'USDC',
                            'name' => 'USD Coin',
                            'wallet_address' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
                            'network' => 'Ethereum (ERC-20)',
                        ],
                    ],
                    'instructions' => 'Select your preferred cryptocurrency, send the exact amount to the wallet address, and provide the transaction hash.',
                ],
                'display_order' => 2,
                'image_path' => null,
                'processing_time' => 'Verification within 24 hours',
                'requires_proof' => true,
                'min_amount' => 10.00,
                'max_amount' => null,
            ],
            [
                'type' => 'paypal',
                'gateway_type' => 'manual',
                'name' => 'PayPal',
                'is_active' => true,
                'configuration' => [
                    'paypal_email' => 'payments@example.com',
                    'instructions' => 'Send payment to our PayPal email and provide the transaction ID.',
                ],
                'display_order' => 3,
                'image_path' => null,
                'processing_time' => 'Verification within 24 hours',
                'requires_proof' => true,
                'min_amount' => 10.00,
                'max_amount' => null,
            ],
            [
                'type' => 'paystack',
                'gateway_type' => 'automated',
                'name' => 'Paystack',
                'is_active' => true,
                'configuration' => [
                    'public_key' => '',
                    'merchant_id' => '',
                    'instructions' => 'Use Paystack checkout to complete your payment instantly and securely.',
                ],
                'display_order' => 4,
                'image_path' => null,
                'processing_time' => 'Instant confirmation',
                'requires_proof' => false,
                'min_amount' => 10.00,
                'max_amount' => null,
            ],
            [
                'type' => 'flutterwave',
                'gateway_type' => 'automated',
                'name' => 'Flutterwave',
                'is_active' => false,
                'configuration' => [
                    'public_key' => '',
                    'merchant_id' => '',
                    'instructions' => 'Enable Flutterwave after entering your merchant details.',
                ],
                'display_order' => 5,
                'image_path' => null,
                'processing_time' => 'Instant confirmation',
                'requires_proof' => false,
                'min_amount' => 10.00,
                'max_amount' => null,
            ],
        ];

        foreach ($paymentMethods as $method) {
            PaymentMethod::updateOrCreate(
                ['type' => $method['type']],
                $method
            );
        }
    }
}
