<?php

namespace Database\Seeders;

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

class SettingsSeeder extends Seeder
{
    public function run(): void
    {
        $settings = [
            // ========== الإعدادات العامة ==========
            [
                'key' => 'site_name',
                'value' => 'نظام إدارة الصالة الرياضية',
                'group' => 'general',
                'sort_order' => 1,
            ],
            [
                'key' => 'site_description',
                'value' => 'نظام متكامل لإدارة الصالات الرياضية',
                'group' => 'general',
                'sort_order' => 2,
            ],
            [
                'key' => 'site_logo',
                'value' => null,
                'group' => 'general',
                'sort_order' => 3,
            ],
            [
                'key' => 'site_favicon',
                'value' => null,
                'group' => 'general',
                'sort_order' => 4,
            ],
            [
                'key' => 'date_format',
                'value' => 'Y-m-d',
                'group' => 'general',
                'sort_order' => 7,
            ],
            [
                'key' => 'time_format',
                'value' => 'H:i',
                'group' => 'general',
                'sort_order' => 8,
            ],

            // ========== إعدادات الصالة الرياضية ==========
            [
                'key' => 'gym_name',
                'value' => 'Fitness Home Gym',
                'group' => 'gym',
                'sort_order' => 1,
            ],
            [
                'key' => 'gym_address',
                'value' => 'المملكة العربية السعودية، المدينة المنورة',
                'group' => 'gym',
                'sort_order' => 2,
            ],
            [
                'key' => 'gym_mobile',
                'value' => '+966523456789',
                'group' => 'gym',
                'sort_order' => 3,
            ],
            [
                'key' => 'gym_email',
                'value' => 'info@gym.com',
                'group' => 'gym',
                'sort_order' => 4,
            ],
            [
                'key' => 'gym_working_hours',
                'value' => 'من 8 صباحاً إلى 12 مساءً',
                'group' => 'gym',
                'sort_order' => 5,
            ],

            // ========== الإعدادات المالية ==========
            [
                'key' => 'currency',
                'value' => 'EGP',
                'group' => 'financial',
                'sort_order' => 1,
            ],
            [
                'key' => 'currency_symbol',
                'value' => 'ج.م',
                'group' => 'financial',
                'sort_order' => 2,
            ],
            [
                'key' => 'tax_rate',
                'value' => '14',
                'group' => 'financial',
                'sort_order' => 3,
            ],
            [
                'key' => 'tax_number',
                'value' => '123-456-789',
                'group' => 'financial',
                'sort_order' => 4,
            ],
            [
                'key' => 'invoice_prefix',
                'value' => 'INV',
                'group' => 'financial',
                'sort_order' => 5,
            ],
            [
                'key' => 'enable_tax',
                'value' => '1',
                'group' => 'financial',
                'sort_order' => 6,
            ],
            [
                'key' => 'payment_installments',
                'value' => '1',
                'group' => 'financial',
                'sort_order' => 7,
            ],
            [
                'key' => 'activate_wallet',
                'value' => '0',
                'group' => 'financial',
                'sort_order' => 8,
            ],
            [
                'key' => 'refund_before_subscription_expiration',
                'value' => '0',
                'group' => 'financial',
                'sort_order' => 9,
            ],

            // ========== إعدادات الإشعارات ==========
            [
                'key' => 'enable_email_notifications',
                'value' => '1',
                'group' => 'notifications',
                'sort_order' => 1,
            ],
            [
                'key' => 'enable_sms_notifications',
                'value' => '0',
                'group' => 'notifications',
                'sort_order' => 2,
            ],
            [
                'key' => 'membership_expiry_reminder_days',
                'value' => '7',
                'group' => 'notifications',
                'sort_order' => 3,
            ],
            [
                'key' => 'payment_due_reminder_days',
                'value' => '3',
                'group' => 'notifications',
                'sort_order' => 4,
            ],
            [
                'key' => 'birthday_notifications',
                'value' => '1',
                'group' => 'notifications',
                'sort_order' => 5,
            ],

            // ========== إعدادات المظهر ==========
            [
                'key' => 'theme_color',
                'value' => '#3490dc',
                'group' => 'appearance',
                'sort_order' => 1,
            ],
            [
                'key' => 'secondary_color',
                'value' => '#38c172',
                'group' => 'appearance',
                'sort_order' => 2,
            ],
            [
                'key' => 'font_family',
                'value' => 'Cairo',
                'group' => 'appearance',
                'sort_order' => 3,
            ],
            [
                'key' => 'dashboard_layout',
                'value' => 'vertical',
                'group' => 'appearance',
                'sort_order' => 4,
            ],

        ];

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