<?php

declare(strict_types=1);

namespace Database\Seeders;

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

final class SettingsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $settings = [
            // General Settings
            [
                'key' => 'site_name',
                'value' => 'Google Reviews',
                'type' => 'string',
                'group' => 'general',
                'description' => 'Website name',
            ],
            [
                'key' => 'site_url',
                'value' => 'https://estate.cycloverseworld.info',
                'type' => 'string',
                'group' => 'general',
                'description' => 'Website URL',
            ],
            [
                'key' => 'site_email',
                'value' => 'info@estate.cycloverseworld.info',
                'type' => 'string',
                'group' => 'general',
                'description' => 'Primary contact email',
            ],
            [
                'key' => 'site_phone',
                'value' => '+1 (555) 123-4567',
                'type' => 'string',
                'group' => 'general',
                'description' => 'Primary contact phone',
            ],

            // Appearance Settings
            [
                'key' => 'site_logo',
                'value' => config('branding.default_site_logo'),
                'type' => 'file',
                'group' => 'appearance',
                'description' => 'Site logo path',
            ],
            [
                'key' => 'site_favicon',
                'value' => '/images/favicon.ico',
                'type' => 'file',
                'group' => 'appearance',
                'description' => 'Site favicon path',
            ],
            [
                'key' => 'email_logo',
                'value' => '/images/email-logo.png',
                'type' => 'file',
                'group' => 'appearance',
                'description' => 'Logo for email templates',
            ],

            // Email Settings
            [
                'key' => 'email_verification_enabled',
                'value' => '1',
                'type' => 'boolean',
                'group' => 'email',
                'description' => 'Enable email verification for new users',
            ],

            // SMTP Settings
            [
                'key' => 'smtp_host',
                'value' => 'smtp.mailtrap.io',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'SMTP server host',
            ],
            [
                'key' => 'smtp_port',
                'value' => '2525',
                'type' => 'integer',
                'group' => 'smtp',
                'description' => 'SMTP server port',
            ],
            [
                'key' => 'smtp_username',
                'value' => '',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'SMTP username',
            ],
            [
                'key' => 'smtp_password',
                'value' => '',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'SMTP password',
            ],
            [
                'key' => 'smtp_encryption',
                'value' => 'tls',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'SMTP encryption (tls, ssl, null)',
            ],
            [
                'key' => 'smtp_from_address',
                'value' => 'noreply@estate.cycloverseworld.info',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'From email address',
            ],
            [
                'key' => 'smtp_from_name',
                'value' => 'Google Reviews',
                'type' => 'string',
                'group' => 'smtp',
                'description' => 'From name',
            ],
        ];

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