<?php

namespace Database\Seeders;

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

class SettingsSeeder extends Seeder
{
    public function run(): void
    {
        $settings = [
            // Financial
            ['key' => 'commission_percentage',   'value' => '10',    'group' => 'financial', 'type' => 'integer', 'label' => 'Commission Percentage (%)',   'is_public' => false],
            ['key' => 'referral_bonus_amount',   'value' => '500',   'group' => 'financial', 'type' => 'integer', 'label' => 'Referral Bonus Amount',       'is_public' => false],
            ['key' => 'points_to_money_rate',    'value' => '0.01',  'group' => 'financial', 'type' => 'integer', 'label' => 'Points to Money Rate',        'is_public' => true],
            ['key' => 'minimum_withdrawal',      'value' => '1000',  'group' => 'financial', 'type' => 'integer', 'label' => 'Minimum Withdrawal Amount',   'is_public' => true],

            // Service
            ['key' => 'default_service_radius',  'value' => '10',    'group' => 'service',   'type' => 'integer', 'label' => 'Default Service Radius (km)', 'is_public' => true],
            ['key' => 'currency',                'value' => 'NGN',   'group' => 'service',   'type' => 'string',  'label' => 'Currency Code',               'is_public' => true],
            ['key' => 'country',                 'value' => 'Nigeria','group' => 'service',  'type' => 'string',  'label' => 'Country',                     'is_public' => true],

            // Ads
            ['key' => 'banner_ad_price',         'value' => '5000',  'group' => 'ads',       'type' => 'integer', 'label' => 'Banner Ad Price',             'is_public' => true],
            ['key' => 'video_ad_price',          'value' => '15000', 'group' => 'ads',       'type' => 'integer', 'label' => 'Video Ad Price',              'is_public' => true],
            ['key' => 'ad_duration_days',        'value' => '30',    'group' => 'ads',       'type' => 'integer', 'label' => 'Default Ad Duration (days)',  'is_public' => true],

            // App
            ['key' => 'app_name',                'value' => 'YAAME', 'group' => 'general',   'type' => 'string',  'label' => 'App Name',                    'is_public' => true],
            ['key' => 'support_email',           'value' => 'support@yaame.com', 'group' => 'general', 'type' => 'string', 'label' => 'Support Email',      'is_public' => true],
            ['key' => 'support_phone',           'value' => '+2348000000000', 'group' => 'general', 'type' => 'string', 'label' => 'Support Phone',         'is_public' => true],
        ];

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