<?php

namespace Database\Seeders;

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

class PaymentMethodsSeeder extends Seeder
{
    public function run(): void
    {
        $sort = 0;
        foreach (config('payments.drivers') as $driver => $data) {
            PaymentMethod::updateOrCreate(
                ['company_id' => null, 'driver' => $driver],
                [
                    'name'         => $data['name'],
                    'is_active'    => $data['enabled'] ?? false,
                    'is_test_mode' => true,
                    'sort_order'   => $sort++,
                ]
            );
        }
    }
}
