<?php

namespace Database\Seeders;

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

class SettingsSeeder extends Seeder
{
    public function run(): void
    {
        $settings = [
            ['key' => 'tier_auto_suggest',          'value' => 'true',  'type' => 'boolean', 'label' => 'Auto-suggest tier upgrades/downgrades'],
            ['key' => 'tier_assessment_day',         'value' => '1',     'type' => 'integer', 'label' => 'Day of month to run quarterly assessment'],
            ['key' => 'points_expiry_reminder_days', 'value' => '30',    'type' => 'integer', 'label' => 'Days before expiry to send reminder email'],
            ['key' => 'restaurant_name',             'value' => 'JAM by Chef Sunil', 'type' => 'string', 'label' => 'Restaurant name'],
            ['key' => 'restaurant_email',            'value' => 'manager@jamcorner.com.au', 'type' => 'string', 'label' => 'Contact email'],
            ['key' => 'restaurant_phone',            'value' => '(07) 4721 4900', 'type' => 'string', 'label' => 'Contact phone'],
            // Notification toggles
            ['key' => 'notify_welcome',              'value' => 'true',  'type' => 'boolean', 'label' => 'Welcome email on registration'],
            ['key' => 'notify_points_credited',      'value' => 'true',  'type' => 'boolean', 'label' => 'Points credited notification'],
            ['key' => 'notify_points_debited',       'value' => 'true',  'type' => 'boolean', 'label' => 'Points debited notification'],
            ['key' => 'notify_tier_upgraded',         'value' => 'true',  'type' => 'boolean', 'label' => 'Tier upgraded notification'],
            ['key' => 'notify_tier_downgraded',       'value' => 'true',  'type' => 'boolean', 'label' => 'Tier downgraded notification'],
            ['key' => 'notify_expiry_reminder',       'value' => 'true',  'type' => 'boolean', 'label' => 'Points expiry reminder'],
        ];

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