<?php

namespace Database\Seeders;

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

class EnsurePaymentGatewaysSeeder extends Seeder
{
    public function run()
    {
        $settings = [
            [
                'key' => 'razorpay_enabled',
                'value' => '1',
                'group' => 'payment',
                'type' => 'boolean',
                'label' => 'Enable Razorpay',
            ],
            [
                'key' => 'paypal_enabled',
                'value' => '1',
                'group' => 'payment',
                'type' => 'boolean',
                'label' => 'Enable PayPal',
            ],
            [
                'key' => 'manual_payment_enabled',
                'value' => '1',
                'group' => 'payment',
                'type' => 'boolean',
                'label' => 'Enable Manual Payment',
            ],
            [
                'key' => 'demo_mode_enabled',
                'value' => '0',
                'group' => 'payment',
                'type' => 'boolean',
                'label' => 'Enable Demo Mode',
            ],
            [
                'key' => 'gst_percentage',
                'value' => '18',
                'group' => 'payment',
                'type' => 'text',
                'label' => 'GST Percentage (%)',
            ],
            [
                'key' => 'paypal_mode',
                'value' => 'sandbox',
                'group' => 'payment',
                'type' => 'select',
                'label' => 'PayPal Mode',
            ],
            [
                'key' => 'payment_gateway_mode',
                'value' => 'sandbox',
                'group' => 'payment',
                'type' => 'select',
                'label' => 'Global Gateway Mode',
            ],
        ];

        foreach ($settings as $setting) {
            Setting::updateOrCreate(
                ['key' => $setting['key']],
                $setting
            );
        }

        $this->command->info('Payment gateway toggles have been ensured.');
    }
}
