<?php

namespace Database\Seeders;

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

class SettingsSeeder extends Seeder
{
    public function run(): void
    {
        $defaults = [
            'company_name' => ['Telecom Store', 'company'],
            'company_logo' => ['', 'company'],
            'company_address' => ['', 'company'],
            'company_phone' => ['', 'company'],
            'company_email' => ['', 'company'],
            'currency' => ['EGP', 'finance'],
            'tax_rate' => ['0', 'finance'],
            'invoice_prefix' => ['INV', 'invoice'],
            'invoice_next_number' => ['1', 'sequence'],
            'payment_next_number' => ['1', 'sequence'],
            'sale_next_number' => ['1', 'sequence'],
            'default_language' => ['ar', 'general'],
            'default_payment_method' => ['cash', 'finance'],
            'printer_type' => ['a4', 'invoice'],
            'date_format' => ['Y-m-d', 'general'],
            'timezone' => ['Africa/Cairo', 'general'],
            'backup_retention_days' => ['30', 'system'],
            'invoice_footer' => ['', 'invoice'],
        ];

        foreach ($defaults as $key => [$value, $group]) {
            Setting::query()->firstOrCreate(['key' => $key], ['value' => $value, 'group' => $group]);
        }
    }
}
