<?php

namespace Database\Seeders;

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

class EmailSettingsSeeder extends Seeder
{
    public function run()
    {
        $settings = [
            [
                'key' => 'mail_mailer',
                'value' => 'smtp',
                'label' => 'Mailer',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_host',
                'value' => 'smtp.mailtrap.io',
                'label' => 'Mail Host',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_port',
                'value' => '2525',
                'label' => 'Mail Port',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_username',
                'value' => '',
                'label' => 'Mail Username',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_password',
                'value' => '',
                'label' => 'Mail Password',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_encryption',
                'value' => 'tls',
                'label' => 'Mail Encryption',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_from_address',
                'value' => 'hello@example.com',
                'label' => 'From Address',
                'group' => 'email',
                'type' => 'text',
            ],
            [
                'key' => 'mail_from_name',
                'value' => 'The Mini Port',
                'label' => 'From Name',
                'group' => 'email',
                'type' => 'text',
            ],
        ];

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