<?php

namespace Database\Seeders;

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

class SettingsSeeder extends Seeder
{
    public function run()
    {
        $settings = [
            // General Settings
            ['key' => 'company_name', 'value' => 'Walton Plaza', 'group' => 'general', 'type' => 'text'],
            ['key' => 'company_address', 'value' => 'Dhaka, Bangladesh', 'group' => 'general', 'type' => 'text'],
            ['key' => 'company_phone', 'value' => '09612-712345', 'group' => 'general', 'type' => 'text'],
            ['key' => 'company_email', 'value' => 'info@waltonplaza.com', 'group' => 'general', 'type' => 'email'],
            
            // Sales Settings
            ['key' => 'default_vat_rate', 'value' => '15', 'group' => 'sales', 'type' => 'number'],
            ['key' => 'invoice_prefix', 'value' => 'INV', 'group' => 'sales', 'type' => 'text'],
            ['key' => 'default_payment_method', 'value' => 'cash', 'group' => 'sales', 'type' => 'text'],
            
            // Installment Settings
            ['key' => 'default_interest_rate', 'value' => '5', 'group' => 'installment', 'type' => 'number'],
            ['key' => 'minimum_down_payment', 'value' => '20', 'group' => 'installment', 'type' => 'number'],
            ['key' => 'max_installment_months', 'value' => '36', 'group' => 'installment', 'type' => 'number'],
            ['key' => 'grace_period_days', 'value' => '7', 'group' => 'installment', 'type' => 'number'],
            ['key' => 'late_fee_percentage', 'value' => '2', 'group' => 'installment', 'type' => 'number'],
            
            // Inventory Settings
            ['key' => 'low_stock_threshold', 'value' => '5', 'group' => 'inventory', 'type' => 'number'],
            ['key' => 'enable_stock_alert', 'value' => '1', 'group' => 'inventory', 'type' => 'boolean'],
            
            // Notification Settings
            ['key' => 'sms_reminder_days', 'value' => '3', 'group' => 'notification', 'type' => 'number'],
            ['key' => 'enable_sms', 'value' => '1', 'group' => 'notification', 'type' => 'boolean'],
        ];

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